Skip to content

Commit

Permalink
Only validate skull owner name length if using MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelli committed May 11, 2024
1 parent d18a023 commit dbb44ab
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/net/coreprotect/paper/Paper_v1_20.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.bukkit.block.Skull;
import org.bukkit.block.sign.Side;

import net.coreprotect.config.Config;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;

public class Paper_v1_20 extends Paper_v1_17 implements PaperInterface {
Expand All @@ -23,11 +24,13 @@ public String getLine(Sign sign, int line) {
@Override
public String getSkullOwner(Skull skull) {
String owner = skull.getPlayerProfile().getName();
if (owner.length() > 255 && skull.getPlayerProfile().getId() != null) {
return skull.getPlayerProfile().getId().toString();
}
else if (owner.length() > 255) {
return owner.substring(0, 255);
if (Config.getGlobal().MYSQL) {
if (owner.length() > 255 && skull.getPlayerProfile().getId() != null) {
return skull.getPlayerProfile().getId().toString();
}
else if (owner.length() > 255) {
return owner.substring(0, 255);
}
}

return owner;
Expand Down

0 comments on commit dbb44ab

Please sign in to comment.