From 9e10958b13dc389c0d624947e2454d59dde18a3c Mon Sep 17 00:00:00 2001
From: Ankoki <72931234+Ankoki-Dev@users.noreply.github.com>
Date: Mon, 19 Jul 2021 15:46:04 +0100
Subject: [PATCH] 1.17.1 support
Took 22 minutes
---
pom.xml | 2 +-
src/main/java/com/ankoki/skjade/SkJade.java | 10 +++++-----
.../skjade/{utils => elements/lasers}/Laser.java | 8 ++++----
.../ankoki/skjade/elements/lasers/LaserManager.java | 2 --
.../elements/lasers/effects/EffChangeLaserColour.java | 2 +-
.../skjade/elements/lasers/effects/EffCreateLaser.java | 2 +-
.../skjade/elements/lasers/effects/EffShowLaser.java | 2 +-
.../skjade/elements/lasers/effects/EffStartLaser.java | 2 +-
.../skjade/elements/lasers/effects/EffStopLaser.java | 2 +-
.../skjade/elements/lasers/expressions/ExprLaser.java | 2 +-
.../elements/lasers/expressions/ExprLaserPoints.java | 2 +-
11 files changed, 17 insertions(+), 19 deletions(-)
rename src/main/java/com/ankoki/skjade/{utils => elements/lasers}/Laser.java (98%)
diff --git a/pom.xml b/pom.xml
index 3593144..b9614a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.ankoki
SkJade
- 1.3.2
+ 1.3.3
1.8
diff --git a/src/main/java/com/ankoki/skjade/SkJade.java b/src/main/java/com/ankoki/skjade/SkJade.java
index 36efd75..02cd6fb 100644
--- a/src/main/java/com/ankoki/skjade/SkJade.java
+++ b/src/main/java/com/ankoki/skjade/SkJade.java
@@ -9,6 +9,7 @@
import ch.njol.util.coll.CollectionUtils;
import com.ankoki.pastebinapi.api.PasteBuilder;
import com.ankoki.skjade.commands.SkJadeCmd;
+import com.ankoki.skjade.elements.lasers.Laser;
import com.ankoki.skjade.elements.pastebinapi.PasteManager;
import com.ankoki.skjade.listeners.PlayerJoin;
import com.ankoki.skjade.utils.*;
@@ -24,7 +25,6 @@
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.*;
-import java.util.logging.Logger;
/**
* IMPORTANT
@@ -244,6 +244,10 @@ public void change(PasteBuilder[] what, @Nullable Object[] delta, ChangeMode mod
.since("1.3.1"));
}
+ private void startRealTime() {
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> Bukkit.getPluginManager().callEvent(new RealTimeEvent(new Date())), 0L, 20 * 60L);
+ }
+
public boolean isBeta() {
return beta;
}
@@ -267,8 +271,4 @@ public boolean isLatest() {
public Config getOwnConfig() {
return config;
}
-
- private void startRealTime() {
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> Bukkit.getPluginManager().callEvent(new RealTimeEvent(new Date())), 0L, 20 * 60L);
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/ankoki/skjade/utils/Laser.java b/src/main/java/com/ankoki/skjade/elements/lasers/Laser.java
similarity index 98%
rename from src/main/java/com/ankoki/skjade/utils/Laser.java
rename to src/main/java/com/ankoki/skjade/elements/lasers/Laser.java
index 7f3b09c..f47e13c 100644
--- a/src/main/java/com/ankoki/skjade/utils/Laser.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/Laser.java
@@ -1,4 +1,4 @@
-package com.ankoki.skjade.utils;
+package com.ankoki.skjade.elements.lasers;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -350,8 +350,8 @@ static int generateEID() {
watcherSet = getMethod(dataWatcherClass, "set");
watcherRegister = getMethod(dataWatcherClass, "register");
if (version >= 15) watcherDirty = getMethod(dataWatcherClass, "markDirty");
- packetSpawn = getNMSClass("network.protocol.game", "PacketPlayOutSpawnEntityLiving").getDeclaredConstructor(version < 17 ? new Class>[0] : new Class>[]{getNMSClass("world.entity", "EntityLiving")});
- packetRemove = getNMSClass("network.protocol.game", "PacketPlayOutEntityDestroy").getDeclaredConstructor(version < 17 ? int[].class : int.class);
+ packetSpawn = getNMSClass("network.protocol.game", "PacketPlayOutSpawnEntityLiving").getDeclaredConstructor(version < 17 ? new Class>[0] : new Class>[]{getNMSClass("world.entity", "EntityLiving")}); packetRemove = getNMSClass("network.protocol.game", "PacketPlayOutEntityDestroy").getDeclaredConstructor(version == 17 && versionMinor == 0 ? int.class : int[].class);
+ packetRemove = getNMSClass("network.protocol.game", "PacketPlayOutEntityDestroy").getDeclaredConstructor(version == 17 && versionMinor == 0 ? int.class : int[].class);
packetMetadata = getNMSClass("network.protocol.game", "PacketPlayOutEntityMetadata").getDeclaredConstructor(int.class, dataWatcherClass, boolean.class);
packetTeleport = getNMSClass("network.protocol.game", "PacketPlayOutEntityTeleport").getDeclaredConstructor(version < 17 ? new Class>[0] : new Class>[]{entityClass});
packetTeam = getNMSClass("network.protocol.game", "PacketPlayOutScoreboardTeam");
@@ -457,7 +457,7 @@ public static Object createPacketGuardianSpawn(Location location, Object watcher
public static Object[] createPacketsRemoveEntities(int... entitiesId) throws ReflectiveOperationException {
Object[] packets;
- if (version < 17) {
+ if (version < 17 || (version == 17 && versionMinor != 0)) {
packets = new Object[]{packetRemove.newInstance(entitiesId)};
} else {
packets = new Object[entitiesId.length];
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/LaserManager.java b/src/main/java/com/ankoki/skjade/elements/lasers/LaserManager.java
index 440a28c..db982c0 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/LaserManager.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/LaserManager.java
@@ -1,7 +1,5 @@
package com.ankoki.skjade.elements.lasers;
-import com.ankoki.skjade.utils.Laser;
-
import java.util.HashMap;
import java.util.Map;
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffChangeLaserColour.java b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffChangeLaserColour.java
index 7489215..5abdcae 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffChangeLaserColour.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffChangeLaserColour.java
@@ -9,7 +9,7 @@
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.util.Kleenean;
-import com.ankoki.skjade.utils.Laser;
+import com.ankoki.skjade.elements.lasers.Laser;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffCreateLaser.java b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffCreateLaser.java
index 4c9e48e..8fc3adb 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffCreateLaser.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffCreateLaser.java
@@ -11,7 +11,7 @@
import ch.njol.skript.util.Timespan;
import ch.njol.util.Kleenean;
import com.ankoki.skjade.elements.lasers.LaserManager;
-import com.ankoki.skjade.utils.Laser;
+import com.ankoki.skjade.elements.lasers.Laser;
import org.bukkit.Location;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffShowLaser.java b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffShowLaser.java
index 8e61f12..d63b48d 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffShowLaser.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffShowLaser.java
@@ -11,7 +11,7 @@
import ch.njol.skript.util.Timespan;
import ch.njol.util.Kleenean;
import com.ankoki.skjade.SkJade;
-import com.ankoki.skjade.utils.Laser;
+import com.ankoki.skjade.elements.lasers.Laser;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStartLaser.java b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStartLaser.java
index 48301a0..534f693 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStartLaser.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStartLaser.java
@@ -10,7 +10,7 @@
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.util.Kleenean;
import com.ankoki.skjade.SkJade;
-import com.ankoki.skjade.utils.Laser;
+import com.ankoki.skjade.elements.lasers.Laser;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStopLaser.java b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStopLaser.java
index af120d5..f7157ab 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStopLaser.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/effects/EffStopLaser.java
@@ -9,7 +9,7 @@
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.util.Kleenean;
-import com.ankoki.skjade.utils.Laser;
+import com.ankoki.skjade.elements.lasers.Laser;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaser.java b/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaser.java
index 0b8b86b..955240a 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaser.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaser.java
@@ -11,7 +11,7 @@
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
import com.ankoki.skjade.elements.lasers.LaserManager;
-import com.ankoki.skjade.utils.Laser;
+import com.ankoki.skjade.elements.lasers.Laser;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaserPoints.java b/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaserPoints.java
index 2ecaa7c..9f346b4 100644
--- a/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaserPoints.java
+++ b/src/main/java/com/ankoki/skjade/elements/lasers/expressions/ExprLaserPoints.java
@@ -12,7 +12,7 @@
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
import ch.njol.util.coll.CollectionUtils;
-import com.ankoki.skjade.utils.Laser;
+import com.ankoki.skjade.elements.lasers.Laser;
import org.bukkit.Location;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;