From 3fc7ed9243d953cbd211817af701570f37e9b19a Mon Sep 17 00:00:00 2001 From: RappyTV Date: Tue, 21 Nov 2023 20:13:42 +0100 Subject: [PATCH] Return null when there is no data to copy, add missing piglin in 1.19.4 implementation --- .../java/com/rappytv/headowner/v1_12_2/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_16_5/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_17_1/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_18_2/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_19_2/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_19_3/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_19_4/SkullApiImpl.java | 6 ++++-- .../java/com/rappytv/headowner/v1_20_1/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_20_2/SkullApiImpl.java | 4 +++- .../java/com/rappytv/headowner/v1_8_9/SkullApiImpl.java | 4 +++- 10 files changed, 31 insertions(+), 11 deletions(-) diff --git a/game-runner/src/v1_12_2/java/com/rappytv/headowner/v1_12_2/SkullApiImpl.java b/game-runner/src/v1_12_2/java/com/rappytv/headowner/v1_12_2/SkullApiImpl.java index 13ec2f5..9ade847 100644 --- a/game-runner/src/v1_12_2/java/com/rappytv/headowner/v1_12_2/SkullApiImpl.java +++ b/game-runner/src/v1_12_2/java/com/rappytv/headowner/v1_12_2/SkullApiImpl.java @@ -25,7 +25,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getTileLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getTileLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_16_5/java/com/rappytv/headowner/v1_16_5/SkullApiImpl.java b/game-runner/src/v1_16_5/java/com/rappytv/headowner/v1_16_5/SkullApiImpl.java index 6b1053b..07d1f98 100644 --- a/game-runner/src/v1_16_5/java/com/rappytv/headowner/v1_16_5/SkullApiImpl.java +++ b/game-runner/src/v1_16_5/java/com/rappytv/headowner/v1_16_5/SkullApiImpl.java @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_17_1/java/com/rappytv/headowner/v1_17_1/SkullApiImpl.java b/game-runner/src/v1_17_1/java/com/rappytv/headowner/v1_17_1/SkullApiImpl.java index 01768da..af100ae 100644 --- a/game-runner/src/v1_17_1/java/com/rappytv/headowner/v1_17_1/SkullApiImpl.java +++ b/game-runner/src/v1_17_1/java/com/rappytv/headowner/v1_17_1/SkullApiImpl.java @@ -27,7 +27,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_18_2/java/com/rappytv/headowner/v1_18_2/SkullApiImpl.java b/game-runner/src/v1_18_2/java/com/rappytv/headowner/v1_18_2/SkullApiImpl.java index a5f6c2d..7b0c557 100644 --- a/game-runner/src/v1_18_2/java/com/rappytv/headowner/v1_18_2/SkullApiImpl.java +++ b/game-runner/src/v1_18_2/java/com/rappytv/headowner/v1_18_2/SkullApiImpl.java @@ -27,7 +27,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_19_2/java/com/rappytv/headowner/v1_19_2/SkullApiImpl.java b/game-runner/src/v1_19_2/java/com/rappytv/headowner/v1_19_2/SkullApiImpl.java index 2f3fe3c..7ee6765 100644 --- a/game-runner/src/v1_19_2/java/com/rappytv/headowner/v1_19_2/SkullApiImpl.java +++ b/game-runner/src/v1_19_2/java/com/rappytv/headowner/v1_19_2/SkullApiImpl.java @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_19_3/java/com/rappytv/headowner/v1_19_3/SkullApiImpl.java b/game-runner/src/v1_19_3/java/com/rappytv/headowner/v1_19_3/SkullApiImpl.java index 010bcfd..26b1dad 100644 --- a/game-runner/src/v1_19_3/java/com/rappytv/headowner/v1_19_3/SkullApiImpl.java +++ b/game-runner/src/v1_19_3/java/com/rappytv/headowner/v1_19_3/SkullApiImpl.java @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_19_4/java/com/rappytv/headowner/v1_19_4/SkullApiImpl.java b/game-runner/src/v1_19_4/java/com/rappytv/headowner/v1_19_4/SkullApiImpl.java index 48cc5d5..c3c5547 100644 --- a/game-runner/src/v1_19_4/java/com/rappytv/headowner/v1_19_4/SkullApiImpl.java +++ b/game-runner/src/v1_19_4/java/com/rappytv/headowner/v1_19_4/SkullApiImpl.java @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { @@ -99,7 +101,7 @@ private String getSkullTypeName() { case PLAYER -> I18n.translate("headowner.types.player"); case CREEPER -> I18n.translate("headowner.types.creeper"); case DRAGON -> I18n.translate("headowner.types.dragon"); - default -> null; + case PIGLIN -> I18n.translate("headowner.types.piglin"); }; } } diff --git a/game-runner/src/v1_20_1/java/com/rappytv/headowner/v1_20_1/SkullApiImpl.java b/game-runner/src/v1_20_1/java/com/rappytv/headowner/v1_20_1/SkullApiImpl.java index c90c7b8..d1b94c1 100644 --- a/game-runner/src/v1_20_1/java/com/rappytv/headowner/v1_20_1/SkullApiImpl.java +++ b/game-runner/src/v1_20_1/java/com/rappytv/headowner/v1_20_1/SkullApiImpl.java @@ -27,7 +27,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_20_2/java/com/rappytv/headowner/v1_20_2/SkullApiImpl.java b/game-runner/src/v1_20_2/java/com/rappytv/headowner/v1_20_2/SkullApiImpl.java index 0013fc1..7407ef2 100644 --- a/game-runner/src/v1_20_2/java/com/rappytv/headowner/v1_20_2/SkullApiImpl.java +++ b/game-runner/src/v1_20_2/java/com/rappytv/headowner/v1_20_2/SkullApiImpl.java @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getBlockLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getBlockLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull { diff --git a/game-runner/src/v1_8_9/java/com/rappytv/headowner/v1_8_9/SkullApiImpl.java b/game-runner/src/v1_8_9/java/com/rappytv/headowner/v1_8_9/SkullApiImpl.java index 0094971..f8cb73e 100644 --- a/game-runner/src/v1_8_9/java/com/rappytv/headowner/v1_8_9/SkullApiImpl.java +++ b/game-runner/src/v1_8_9/java/com/rappytv/headowner/v1_8_9/SkullApiImpl.java @@ -25,7 +25,9 @@ public String getDisplay(HeadOwnerConfig config) { @Override public String getCopy(HeadOwnerConfig config) { - return new Skull(Skull.getTileLooking(config.distance())).getCopy(); + Skull skull = new Skull(Skull.getTileLooking(config.distance())); + if(skull.getSkullTypeName() == null) return null; + return skull.getCopy(); } public static class Skull {