diff --git a/lib/ProtocolLib.jar b/lib/ProtocolLib.jar
deleted file mode 100644
index 47b952f..0000000
Binary files a/lib/ProtocolLib.jar and /dev/null differ
diff --git a/pom.xml b/pom.xml
index f6ad5f0..629289f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@
4.0.0
net.tylermurphy
KenshinsHideAndSeek
- 1.7.2
+ 1.7.3
Hide and Seek Plugin
@@ -15,7 +15,7 @@
org.apache.maven.plugins
maven-shade-plugin
- 3.2.4
+ 3.4.1
package
@@ -62,7 +62,7 @@
maven-compiler-plugin
- 2.3.2
+ 3.11.0
1.8
@@ -78,10 +78,10 @@
spigot-repo
https://hub.spigotmc.org/nexus/content/repositories/public/
-
-
-
-
+
+ dmulloy2-repo
+ https://repo.dmulloy2.net/repository/public/
+
placeholderapi
https://repo.extendedclip.com/content/repositories/placeholderapi/
@@ -104,9 +104,8 @@
com.comphenix.protocol
ProtocolLib
- 4.8.0
- system
- ${project.basedir}/lib/ProtocolLib.jar
+ 5.0.0
+ provided
org.xerial
@@ -121,7 +120,7 @@
com.github.cryptomorin
XSeries
- 9.2.0
+ 9.3.1
me.clip
@@ -140,4 +139,4 @@
3.1.2
-
\ No newline at end of file
+
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Main.java b/src/main/java/net/tylermurphy/hideAndSeek/Main.java
index 36d92ee..be1c445 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/Main.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/Main.java
@@ -34,6 +34,7 @@ public class Main extends JavaPlugin implements Listener {
private static Main instance;
private static int version;
+ private static int sub_version;
private Database database;
private Board board;
@@ -189,12 +190,28 @@ public class Main extends JavaPlugin implements Listener {
}
private void updateVersion(){
- Matcher matcher = Pattern.compile("MC: \\d\\.(\\d+)").matcher(Bukkit.getVersion());
+ Matcher matcher = Pattern.compile("MC: \\d\\.(\\d+).(\\d+)").matcher(Bukkit.getVersion());
if (matcher.find()) {
version = Integer.parseInt(matcher.group(1));
- } else {
- throw new IllegalArgumentException("Failed to parse server version from: " + Bukkit.getVersion());
- }
+ sub_version = Integer.parseInt(matcher.group(2));
+
+ getLogger().info("Identified server version: " + version);
+ getLogger().info("Identified server sub version: " + sub_version);
+
+ return;
+ }
+
+ matcher = Pattern.compile("MC: \\d\\.(\\d+)").matcher(Bukkit.getVersion());
+ if (matcher.find()) {
+ version = Integer.parseInt(matcher.group(1));
+ sub_version = 0;
+
+ getLogger().info("Identified server version: " + version);
+
+ return;
+ }
+
+ throw new IllegalArgumentException("Failed to parse server version from: " + Bukkit.getVersion());
}
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
@@ -244,6 +261,10 @@ public class Main extends JavaPlugin implements Listener {
return version >= v;
}
+ public boolean supports(int v, int s){
+ return (version == v) ? sub_version >= s : version >= v;
+ }
+
public java.util.List getWorlds() {
java.util.List worlds = new ArrayList<>();
File[] containers = getWorldContainer().listFiles();
@@ -268,4 +289,4 @@ public class Main extends JavaPlugin implements Listener {
Bukkit.getServer().getScheduler().runTask(this, task);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
index 90615e5..79036b1 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
@@ -49,6 +49,7 @@ public class Status implements ICommand {
}
if (map.isBlockHuntEnabled() && map.getBlockHunt().isEmpty()) {
msg = msg + "\n" + message("SETUP_BLOCKHUNT");
+ count++;
}
if (count < 1) {
sender.sendMessage(messagePrefix + message("SETUP_COMPLETE"));
@@ -76,4 +77,4 @@ public class Status implements ICommand {
return null;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java
index 06e9c33..80e531e 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java
@@ -51,7 +51,7 @@ public class CommandGroup {
if (data == null) {
player.sendMessage(
- String.format("%s%sKenshin's Hide and Seek %s(%s1.7.2%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY, ChatColor.WHITE, ChatColor.GRAY) +
+ String.format("%s%sKenshin's Hide and Seek %s(%s1.7.3%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY, ChatColor.WHITE, ChatColor.GRAY) +
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
);
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java
index 1c56fe7..58c13cc 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java
@@ -1,21 +1,22 @@
package net.tylermurphy.hideAndSeek.database;
-import com.google.common.io.ByteStreams;
-import net.tylermurphy.hideAndSeek.Main;
-import net.tylermurphy.hideAndSeek.database.connections.DatabaseConnection;
-import net.tylermurphy.hideAndSeek.database.connections.MySQLConnection;
-import net.tylermurphy.hideAndSeek.database.connections.SQLiteConnection;
+import static net.tylermurphy.hideAndSeek.configuration.Config.databaseType;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.UUID;
-import static net.tylermurphy.hideAndSeek.configuration.Config.databasePort;
-import static net.tylermurphy.hideAndSeek.configuration.Config.databaseType;
+import com.google.common.io.ByteStreams;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.database.connections.DatabaseConnection;
+import net.tylermurphy.hideAndSeek.database.connections.MySQLConnection;
+import net.tylermurphy.hideAndSeek.database.connections.SQLiteConnection;
public class Database {
@@ -96,7 +97,7 @@ public class Database {
ByteBuffer buffer = ByteBuffer.allocate(16);
try {
buffer.put(ByteStreams.toByteArray(is));
- buffer.flip();
+ ((Buffer)buffer).flip();
return new UUID(buffer.getLong(), buffer.getLong());
} catch (IOException e) {
Main.getInstance().getLogger().severe("IO Error: " + e.getMessage());
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DisguiseHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DisguiseHandler.java
index 68eb26b..3f99d2e 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DisguiseHandler.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DisguiseHandler.java
@@ -9,6 +9,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction;
+import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.messages.ActionBar;
import net.tylermurphy.hideAndSeek.Main;
@@ -54,9 +55,9 @@ public class DisguiseHandler implements Listener {
PacketContainer packet = event.getPacket();
// only left click attacks
- WrappedEnumEntityUseAction action = packet.getEnumEntityUseActions().getValues().stream().findFirst().orElse(null);
+ EntityUseAction action = packet.getEntityUseActions().getValues().stream().findFirst().orElse(null);
if (action == null) return;
- if (action.getAction() != EnumWrappers.EntityUseAction.ATTACK) return;
+ if (action != EnumWrappers.EntityUseAction.ATTACK) return;
Player player = event.getPlayer();
int id = packet.getIntegers().read(0);
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityMetadataPacket.java b/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityMetadataPacket.java
index d77a227..051e4ae 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityMetadataPacket.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityMetadataPacket.java
@@ -4,6 +4,9 @@ import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.wrappers.WrappedDataValue;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
+
+import net.tylermurphy.hideAndSeek.Main;
+
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.NotNull;
@@ -36,12 +39,7 @@ public class EntityMetadataPacket extends AbstractPacket {
public void writeMetadata() {
- // thank you to
- // https://www.spigotmc.org/threads/unable-to-modify-entity-metadata-packet-using-protocollib-1-19-3.582442/
-
- try {
- // 1.19.3 And Up
- Class.forName("com.comphenix.protocol.wrappers.WrappedDataValue");
+ if (Main.getInstance().supports(19, 3)) {
final List wrappedDataValueList = new ArrayList<>();
@@ -60,11 +58,12 @@ public class EntityMetadataPacket extends AbstractPacket {
packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);
- } catch (ClassCastException | ClassNotFoundException ignored) {
- // 1.9 to 1.19.2 And Up
+ } else {
+
packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
+
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 38555db..7be1ed6 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
name: KenshinsHideAndSeek
main: net.tylermurphy.hideAndSeek.Main
-version: 1.7.2
+version: 1.7.3
author: KenshinEto
load: STARTUP
api-version: 1.13