1.7.3 rc-1

This commit is contained in:
Murphy 2023-05-24 14:10:47 -04:00
parent b69ee074b5
commit 3da7a74908
9 changed files with 61 additions and 39 deletions

Binary file not shown.

23
pom.xml
View file

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion>
<groupId>net.tylermurphy</groupId> <groupId>net.tylermurphy</groupId>
<artifactId>KenshinsHideAndSeek</artifactId> <artifactId>KenshinsHideAndSeek</artifactId>
<version>1.7.2</version> <version>1.7.3</version>
<name>Hide and Seek Plugin</name> <name>Hide and Seek Plugin</name>
<properties> <properties>
@ -15,7 +15,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version> <version>3.4.1</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -62,7 +62,7 @@
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>3.11.0</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
@ -78,10 +78,10 @@
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/public/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/public/</url>
</repository> </repository>
<!-- <repository>--> <repository>
<!-- <id>dmulloy2-repo</id>--> <id>dmulloy2-repo</id>
<!-- <url>https://repo.dmulloy2.net/repository/public/</url>--> <url>https://repo.dmulloy2.net/repository/public/</url>
<!-- </repository>--> </repository>
<repository> <repository>
<id>placeholderapi</id> <id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url> <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@ -104,9 +104,8 @@
<dependency> <dependency>
<groupId>com.comphenix.protocol</groupId> <groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<version>4.8.0</version> <version>5.0.0</version>
<scope>system</scope> <scope>provided</scope>
<systemPath>${project.basedir}/lib/ProtocolLib.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.xerial</groupId> <groupId>org.xerial</groupId>
@ -121,7 +120,7 @@
<dependency> <dependency>
<groupId>com.github.cryptomorin</groupId> <groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId> <artifactId>XSeries</artifactId>
<version>9.2.0</version> <version>9.3.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.clip</groupId> <groupId>me.clip</groupId>
@ -140,4 +139,4 @@
<version>3.1.2</version> <version>3.1.2</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View file

@ -34,6 +34,7 @@ public class Main extends JavaPlugin implements Listener {
private static Main instance; private static Main instance;
private static int version; private static int version;
private static int sub_version;
private Database database; private Database database;
private Board board; private Board board;
@ -189,12 +190,28 @@ public class Main extends JavaPlugin implements Listener {
} }
private void updateVersion(){ 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()) { if (matcher.find()) {
version = Integer.parseInt(matcher.group(1)); version = Integer.parseInt(matcher.group(1));
} else { sub_version = Integer.parseInt(matcher.group(2));
throw new IllegalArgumentException("Failed to parse server version from: " + Bukkit.getVersion());
} 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) { 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; return version >= v;
} }
public boolean supports(int v, int s){
return (version == v) ? sub_version >= s : version >= v;
}
public java.util.List<String> getWorlds() { public java.util.List<String> getWorlds() {
java.util.List<String> worlds = new ArrayList<>(); java.util.List<String> worlds = new ArrayList<>();
File[] containers = getWorldContainer().listFiles(); File[] containers = getWorldContainer().listFiles();
@ -268,4 +289,4 @@ public class Main extends JavaPlugin implements Listener {
Bukkit.getServer().getScheduler().runTask(this, task); Bukkit.getServer().getScheduler().runTask(this, task);
} }
} }

View file

@ -49,6 +49,7 @@ public class Status implements ICommand {
} }
if (map.isBlockHuntEnabled() && map.getBlockHunt().isEmpty()) { if (map.isBlockHuntEnabled() && map.getBlockHunt().isEmpty()) {
msg = msg + "\n" + message("SETUP_BLOCKHUNT"); msg = msg + "\n" + message("SETUP_BLOCKHUNT");
count++;
} }
if (count < 1) { if (count < 1) {
sender.sendMessage(messagePrefix + message("SETUP_COMPLETE")); sender.sendMessage(messagePrefix + message("SETUP_COMPLETE"));
@ -76,4 +77,4 @@ public class Status implements ICommand {
return null; return null;
} }
} }

View file

@ -51,7 +51,7 @@ public class CommandGroup {
if (data == null) { if (data == null) {
player.sendMessage( 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("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE) String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
); );

View file

@ -1,21 +1,22 @@
package net.tylermurphy.hideAndSeek.database; package net.tylermurphy.hideAndSeek.database;
import com.google.common.io.ByteStreams; import static net.tylermurphy.hideAndSeek.configuration.Config.databaseType;
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 java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.UUID; import java.util.UUID;
import static net.tylermurphy.hideAndSeek.configuration.Config.databasePort; import com.google.common.io.ByteStreams;
import static net.tylermurphy.hideAndSeek.configuration.Config.databaseType;
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 { public class Database {
@ -96,7 +97,7 @@ public class Database {
ByteBuffer buffer = ByteBuffer.allocate(16); ByteBuffer buffer = ByteBuffer.allocate(16);
try { try {
buffer.put(ByteStreams.toByteArray(is)); buffer.put(ByteStreams.toByteArray(is));
buffer.flip(); ((Buffer)buffer).flip();
return new UUID(buffer.getLong(), buffer.getLong()); return new UUID(buffer.getLong(), buffer.getLong());
} catch (IOException e) { } catch (IOException e) {
Main.getInstance().getLogger().severe("IO Error: " + e.getMessage()); Main.getInstance().getLogger().severe("IO Error: " + e.getMessage());

View file

@ -9,6 +9,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers; import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction; import com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction;
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
import com.cryptomorin.xseries.XSound; import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.messages.ActionBar; import com.cryptomorin.xseries.messages.ActionBar;
import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.Main;
@ -54,9 +55,9 @@ public class DisguiseHandler implements Listener {
PacketContainer packet = event.getPacket(); PacketContainer packet = event.getPacket();
// only left click attacks // 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 == null) return;
if (action.getAction() != EnumWrappers.EntityUseAction.ATTACK) return; if (action != EnumWrappers.EntityUseAction.ATTACK) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
int id = packet.getIntegers().read(0); int id = packet.getIntegers().read(0);

View file

@ -4,6 +4,9 @@ import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.wrappers.WrappedDataValue; import com.comphenix.protocol.wrappers.WrappedDataValue;
import com.comphenix.protocol.wrappers.WrappedDataWatcher; import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedWatchableObject; import com.comphenix.protocol.wrappers.WrappedWatchableObject;
import net.tylermurphy.hideAndSeek.Main;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -36,12 +39,7 @@ public class EntityMetadataPacket extends AbstractPacket {
public void writeMetadata() { public void writeMetadata() {
// thank you to if (Main.getInstance().supports(19, 3)) {
// 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");
final List<WrappedDataValue> wrappedDataValueList = new ArrayList<>(); final List<WrappedDataValue> wrappedDataValueList = new ArrayList<>();
@ -60,11 +58,12 @@ public class EntityMetadataPacket extends AbstractPacket {
packet.getDataValueCollectionModifier().write(0, wrappedDataValueList); packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);
} catch (ClassCastException | ClassNotFoundException ignored) { } else {
// 1.9 to 1.19.2 And Up
packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects()); packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
} }
} }
} }

View file

@ -1,6 +1,6 @@
name: KenshinsHideAndSeek name: KenshinsHideAndSeek
main: net.tylermurphy.hideAndSeek.Main main: net.tylermurphy.hideAndSeek.Main
version: 1.7.2 version: 1.7.3
author: KenshinEto author: KenshinEto
load: STARTUP load: STARTUP
api-version: 1.13 api-version: 1.13