moving back to 1.19.2 as 1.19.3 is not needed
This commit is contained in:
parent
ddd2786606
commit
85ccd11904
21 changed files with 92 additions and 57 deletions
10
pom.xml
10
pom.xml
|
@ -67,9 +67,9 @@
|
||||||
</goals>
|
</goals>
|
||||||
<id>remap-obf</id>
|
<id>remap-obf</id>
|
||||||
<configuration>
|
<configuration>
|
||||||
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
|
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
|
||||||
<reverse>true</reverse>
|
<reverse>true</reverse>
|
||||||
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
|
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
|
||||||
<remappedArtifactAttached>true</remappedArtifactAttached>
|
<remappedArtifactAttached>true</remappedArtifactAttached>
|
||||||
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -82,8 +82,8 @@
|
||||||
<id>remap-spigot</id>
|
<id>remap-spigot</id>
|
||||||
<configuration>
|
<configuration>
|
||||||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
||||||
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
||||||
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||||
<classifier>remapped-mojang</classifier>
|
<classifier>remapped-mojang</classifier>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -13,8 +13,7 @@ import org.bukkit.*;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
|
||||||
public final class Main extends JavaPlugin {
|
public final class NullValkyrie extends JavaPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
EnchantmentManager.register();
|
EnchantmentManager.register();
|
|
@ -1,10 +1,9 @@
|
||||||
package me.night.nullvalkyrie.commands;
|
package me.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.entities.npcs.NPCManager;
|
|
||||||
import me.night.nullvalkyrie.entities.pets.ZombiePet;
|
import me.night.nullvalkyrie.entities.pets.ZombiePet;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
@ -34,7 +33,6 @@ public class BetaCommand extends Command {
|
||||||
itemMeta2.setCustomModelData(1010101);
|
itemMeta2.setCustomModelData(1010101);
|
||||||
item2.setItemMeta(itemMeta2);
|
item2.setItemMeta(itemMeta2);
|
||||||
player.getInventory().addItem(item2);
|
player.getInventory().addItem(item2);
|
||||||
NPCManager.createNPC(player, args[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.night.nullvalkyrie.commands;
|
package me.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -23,13 +23,13 @@ public class VanishCommand extends Command {
|
||||||
if (vanished.contains(player.getUniqueId())) {
|
if (vanished.contains(player.getUniqueId())) {
|
||||||
vanished.remove(player.getUniqueId());
|
vanished.remove(player.getUniqueId());
|
||||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||||
target.showPlayer(Main.getPlugin(Main.class), player);
|
target.showPlayer(NullValkyrie.getPlugin(NullValkyrie.class), player);
|
||||||
}
|
}
|
||||||
player.sendMessage(ChatColor.GREEN + "You are now seen by people");
|
player.sendMessage(ChatColor.GREEN + "You are now seen by people");
|
||||||
} else {
|
} else {
|
||||||
vanished.add(player.getUniqueId());
|
vanished.add(player.getUniqueId());
|
||||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||||
target.hidePlayer(Main.getPlugin(Main.class), player);
|
target.hidePlayer(NullValkyrie.getPlugin(NullValkyrie.class), player);
|
||||||
}
|
}
|
||||||
player.sendMessage(ChatColor.GREEN + "You are now vanished");
|
player.sendMessage(ChatColor.GREEN + "You are now vanished");
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
import net.minecraft.network.syncher.SynchedEntityData;
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -29,6 +29,6 @@ public class PerPlayerHologram {
|
||||||
SynchedEntityData watcher = stand.getEntityData();
|
SynchedEntityData watcher = stand.getEntityData();
|
||||||
watcher.set(new EntityDataAccessor<>(2, EntityDataSerializers.OPTIONAL_COMPONENT), Optional.of(Component.nullToEmpty(line)));
|
watcher.set(new EntityDataAccessor<>(2, EntityDataSerializers.OPTIONAL_COMPONENT), Optional.of(Component.nullToEmpty(line)));
|
||||||
watcher.set(new EntityDataAccessor<>(3, EntityDataSerializers.BOOLEAN), true);
|
watcher.set(new EntityDataAccessor<>(3, EntityDataSerializers.BOOLEAN), true);
|
||||||
new PacketPlayOutEntityMetadata(player, stand, watcher.getNonDefaultValues());
|
new PacketPlayOutEntityMetadata(player, stand, watcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.night.nullvalkyrie.entities.items;
|
package me.night.nullvalkyrie.entities.items;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import me.night.nullvalkyrie.database.CustomWeaponsDataManager;
|
import me.night.nullvalkyrie.database.CustomWeaponsDataManager;
|
||||||
import me.night.nullvalkyrie.enums.Rarity;
|
import me.night.nullvalkyrie.enums.Rarity;
|
||||||
import me.night.nullvalkyrie.util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
|
@ -84,7 +84,7 @@ public class CustomItemManager {
|
||||||
HashMap<String, Object> pdcdata = (HashMap<String, Object>) weapon.get("PDC");
|
HashMap<String, Object> pdcdata = (HashMap<String, Object>) weapon.get("PDC");
|
||||||
for (String key : pdcdata.keySet()) {
|
for (String key : pdcdata.keySet()) {
|
||||||
PersistentDataContainer container = itemMeta.getPersistentDataContainer();
|
PersistentDataContainer container = itemMeta.getPersistentDataContainer();
|
||||||
NamespacedKey key1 = new NamespacedKey(Main.getPlugin(Main.class), key);
|
NamespacedKey key1 = new NamespacedKey(NullValkyrie.getPlugin(NullValkyrie.class), key);
|
||||||
keys.put(Rarity.getRarity((String) weapon.get("Rarity")).getColor() + weapon.get("Name") + "." + key, key1);
|
keys.put(Rarity.getRarity((String) weapon.get("Rarity")).getColor() + weapon.get("Name") + "." + key, key1);
|
||||||
container.set(key1, PersistentDataType.INTEGER, (int) pdcdata.get(key));
|
container.set(key1, PersistentDataType.INTEGER, (int) pdcdata.get(key));
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class CustomItemManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setItemRecipe(String key, ItemStack i, List<String> shapes, HashMap<Character, Material> ingredients, int amount) {
|
public static void setItemRecipe(String key, ItemStack i, List<String> shapes, HashMap<Character, Material> ingredients, int amount) {
|
||||||
NamespacedKey nsk = new NamespacedKey(Main.getPlugin(Main.class), key.replaceAll("\\s", ""));
|
NamespacedKey nsk = new NamespacedKey(NullValkyrie.getPlugin(NullValkyrie.class), key.replaceAll("\\s", ""));
|
||||||
ShapedRecipe recipe = new ShapedRecipe(nsk, i);
|
ShapedRecipe recipe = new ShapedRecipe(nsk, i);
|
||||||
recipe.shape(shapes.get(0), shapes.get(1), shapes.get(2));
|
recipe.shape(shapes.get(0), shapes.get(1), shapes.get(2));
|
||||||
List<Character> abcs = List.of('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I');
|
List<Character> abcs = List.of('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I');
|
||||||
|
|
|
@ -6,16 +6,19 @@ import com.mojang.authlib.properties.Property;
|
||||||
import me.night.nullvalkyrie.enums.MinerType;
|
import me.night.nullvalkyrie.enums.MinerType;
|
||||||
import me.night.nullvalkyrie.util.Skin;
|
import me.night.nullvalkyrie.util.Skin;
|
||||||
import me.night.nullvalkyrie.util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
|
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -136,7 +139,9 @@ public class CryptoMiner {
|
||||||
gameProfile.getProperties().put("textures", new Property("textures", skin[0], skin[1]));
|
gameProfile.getProperties().put("textures", new Property("textures", skin[0], skin[1]));
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
ServerLevel w = ((CraftWorld) player.getLocation().getWorld()).getHandle();
|
ServerLevel w = ((CraftWorld) player.getLocation().getWorld()).getHandle();
|
||||||
ServerPlayer miner = new ServerPlayer(server, w, gameProfile);
|
ServerPlayer miner = new ServerPlayer(server, w, gameProfile, null);
|
||||||
|
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
||||||
|
pc.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, miner));
|
||||||
World world = miner.getBukkitEntity().getWorld();
|
World world = miner.getBukkitEntity().getWorld();
|
||||||
List<Location> locs = new ArrayList<>();
|
List<Location> locs = new ArrayList<>();
|
||||||
for (int x = (int) stand.getLocation().getX() - 3; x <= stand.getLocation().getX() + 2; x++) {
|
for (int x = (int) stand.getLocation().getX() - 3; x <= stand.getLocation().getX() + 2; x++) {
|
||||||
|
|
|
@ -3,9 +3,9 @@ package me.night.nullvalkyrie.entities.npcs;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import me.night.nullvalkyrie.database.NPCDataManager;
|
import me.night.nullvalkyrie.database.NPCDataManager;
|
||||||
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutEntityMetadata;
|
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutEntityMetadata;
|
||||||
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutSpawnEntity;
|
|
||||||
import me.night.nullvalkyrie.util.*;
|
import me.night.nullvalkyrie.util.*;
|
||||||
import net.minecraft.network.protocol.game.*;
|
import net.minecraft.network.protocol.game.*;
|
||||||
import net.minecraft.network.syncher.*;
|
import net.minecraft.network.syncher.*;
|
||||||
|
@ -17,10 +17,10 @@ import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
|
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class NPCManager {
|
||||||
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), Util.color(name));
|
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), Util.color(name));
|
||||||
String[] skin = Skin.getSkin(player);
|
String[] skin = Skin.getSkin(player);
|
||||||
gameProfile.getProperties().put("textures", new Property("textures", skin[0], skin[1]));
|
gameProfile.getProperties().put("textures", new Property("textures", skin[0], skin[1]));
|
||||||
ServerPlayer npc = new ServerPlayer(server, level, gameProfile);
|
ServerPlayer npc = new ServerPlayer(server, level, gameProfile, null);
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
npc.setPos(location.getX(), location.getY(), location.getZ());
|
npc.setPos(location.getX(), location.getY(), location.getZ());
|
||||||
addNPCPacket(npc);
|
addNPCPacket(npc);
|
||||||
|
@ -53,11 +53,13 @@ public class NPCManager {
|
||||||
public static void addNPCPacket(ServerPlayer npc) {
|
public static void addNPCPacket(ServerPlayer npc) {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
||||||
new PacketPlayOutSpawnEntity(player, npc);
|
pc.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc));
|
||||||
|
pc.send(new ClientboundAddPlayerPacket(npc));
|
||||||
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
||||||
SynchedEntityData watcher = npc.getEntityData();
|
SynchedEntityData watcher = npc.getEntityData();
|
||||||
watcher.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 127);
|
watcher.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 127);
|
||||||
new PacketPlayOutEntityMetadata(player, npc, watcher.getNonDefaultValues());
|
new PacketPlayOutEntityMetadata(player, npc, watcher);
|
||||||
|
Bukkit.getScheduler().runTaskLaterAsynchronously(NullValkyrie.getPlugin(NullValkyrie.class), () -> pc.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, npc)), 50);
|
||||||
ItemStack netheriteAxe = new ItemStack(Material.NETHERITE_AXE);
|
ItemStack netheriteAxe = new ItemStack(Material.NETHERITE_AXE);
|
||||||
ItemStack anotherAxe = new ItemStack(Material.NETHERITE_INGOT);
|
ItemStack anotherAxe = new ItemStack(Material.NETHERITE_INGOT);
|
||||||
List<Pair<EquipmentSlot, net.minecraft.world.item.ItemStack>> itemList = new ArrayList<>();
|
List<Pair<EquipmentSlot, net.minecraft.world.item.ItemStack>> itemList = new ArrayList<>();
|
||||||
|
@ -70,11 +72,13 @@ public class NPCManager {
|
||||||
public static void addJoinPacket(Player player) {
|
public static void addJoinPacket(Player player) {
|
||||||
for (ServerPlayer npc : NPCs) {
|
for (ServerPlayer npc : NPCs) {
|
||||||
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
||||||
new PacketPlayOutSpawnEntity(player, npc);
|
pc.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc));
|
||||||
|
pc.send(new ClientboundAddPlayerPacket(npc));
|
||||||
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
pc.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * 256 / 360)));
|
||||||
SynchedEntityData watcher = npc.getEntityData();
|
SynchedEntityData watcher = npc.getEntityData();
|
||||||
watcher.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 127);
|
watcher.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 127);
|
||||||
new PacketPlayOutEntityMetadata(player, npc, watcher.getNonDefaultValues());
|
new PacketPlayOutEntityMetadata(player, npc, watcher);
|
||||||
|
Bukkit.getScheduler().runTaskLaterAsynchronously(NullValkyrie.getPlugin(NullValkyrie.class), () -> pc.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, npc)), 50);
|
||||||
ItemStack netheriteAxe = new ItemStack(Material.NETHERITE_AXE);
|
ItemStack netheriteAxe = new ItemStack(Material.NETHERITE_AXE);
|
||||||
ItemStack anotherAxe = new ItemStack(Material.NETHERITE_INGOT);
|
ItemStack anotherAxe = new ItemStack(Material.NETHERITE_INGOT);
|
||||||
List<Pair<EquipmentSlot, net.minecraft.world.item.ItemStack>> itemList = new ArrayList<>();
|
List<Pair<EquipmentSlot, net.minecraft.world.item.ItemStack>> itemList = new ArrayList<>();
|
||||||
|
@ -90,7 +94,7 @@ public class NPCManager {
|
||||||
gameProfile.getProperties().put("textures", new Property("textures", (String) npc.get("texture"), (String) npc.get("signature")));
|
gameProfile.getProperties().put("textures", new Property("textures", (String) npc.get("texture"), (String) npc.get("signature")));
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
ServerLevel w = ((CraftWorld) location.getWorld()).getHandle();
|
ServerLevel w = ((CraftWorld) location.getWorld()).getHandle();
|
||||||
ServerPlayer ep = new ServerPlayer(server, w, gameProfile);
|
ServerPlayer ep = new ServerPlayer(server, w, gameProfile, null);
|
||||||
ep.setPos(location.getX(), location.getY(), location.getZ()); // NMS: 1.19.2 https://nms.screamingsandals.org/1.19.2/net/minecraft/world/entity/Entity.html absMoveTo
|
ep.setPos(location.getX(), location.getY(), location.getZ()); // NMS: 1.19.2 https://nms.screamingsandals.org/1.19.2/net/minecraft/world/entity/Entity.html absMoveTo
|
||||||
addNPCPacket(ep);
|
addNPCPacket(ep);
|
||||||
NPCs.add(ep);
|
NPCs.add(ep);
|
||||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.world.entity.ai.goal.FloatGoal;
|
||||||
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
|
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
|
||||||
import net.minecraft.world.entity.monster.Zombie;
|
import net.minecraft.world.entity.monster.Zombie;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package me.night.nullvalkyrie.events.listeners;
|
||||||
import me.night.nullvalkyrie.entities.items.CustomItemManager;
|
import me.night.nullvalkyrie.entities.items.CustomItemManager;
|
||||||
import me.night.nullvalkyrie.entities.items.Pickaxe;
|
import me.night.nullvalkyrie.entities.items.Pickaxe;
|
||||||
import me.night.nullvalkyrie.enums.Rarity;
|
import me.night.nullvalkyrie.enums.Rarity;
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutBlockBreakAnimation;
|
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutBlockBreakAnimation;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
@ -245,7 +245,7 @@ public class CustomItemEvents implements Listener {
|
||||||
// player.setHealth(20);
|
// player.setHealth(20);
|
||||||
// player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
|
// player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
|
||||||
// }
|
// }
|
||||||
// }.runTaskLater(Main.getPlugin(Main.class), 100L);
|
// }.runTaskLater(NullValkyrie.getPlugin(NullValkyrie.class), 100L);
|
||||||
// countDown(player, new int[]{5});
|
// countDown(player, new int[]{5});
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ public class CustomItemEvents implements Listener {
|
||||||
private int taskID;
|
private int taskID;
|
||||||
|
|
||||||
public void countDown(Player player, int[] a) {
|
public void countDown(Player player, int[] a) {
|
||||||
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(Main.class), () -> {
|
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(NullValkyrie.getPlugin(NullValkyrie.class), () -> {
|
||||||
player.sendTitle(ChatColor.RED + "YOU DIED!", ChatColor.GREEN + "You will revive in " + a[0] + " seconds", 0, 20, 0);
|
player.sendTitle(ChatColor.RED + "YOU DIED!", ChatColor.GREEN + "You will revive in " + a[0] + " seconds", 0, 20, 0);
|
||||||
a[0]--;
|
a[0]--;
|
||||||
if (a[0] == 0) {
|
if (a[0] == 0) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.night.nullvalkyrie.events.listeners;
|
package me.night.nullvalkyrie.events.listeners;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import me.night.nullvalkyrie.util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -60,7 +60,7 @@ public class DamageEffectEvents implements Listener {
|
||||||
}
|
}
|
||||||
removal.forEach(stands::remove);
|
removal.forEach(stands::remove);
|
||||||
}
|
}
|
||||||
}.runTaskTimer(Main.getPlugin(Main.class), 0L, 1L);
|
}.runTaskTimer(NullValkyrie.getPlugin(NullValkyrie.class), 0L, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSpawnable(Location loc) {
|
public boolean isSpawnable(Location loc) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
|
||||||
import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket;
|
import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket;
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
|
@ -3,18 +3,26 @@ package me.night.nullvalkyrie.packets.handle;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import me.night.nullvalkyrie.entities.npcs.NPCManager;
|
import me.night.nullvalkyrie.entities.npcs.NPCManager;
|
||||||
import me.night.nullvalkyrie.events.custom.InteractHologramEvent;
|
import me.night.nullvalkyrie.events.custom.InteractHologramEvent;
|
||||||
import me.night.nullvalkyrie.events.custom.RightClickNPCEvent;
|
import me.night.nullvalkyrie.events.custom.RightClickNPCEvent;
|
||||||
import me.night.nullvalkyrie.util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||||
import net.minecraft.network.protocol.game.ServerboundInteractPacket;
|
import net.minecraft.network.protocol.game.ServerboundInteractPacket;
|
||||||
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class PacketHandler extends ChannelDuplexHandler {
|
public class PacketHandler extends ChannelDuplexHandler {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
@ -25,6 +33,29 @@ public class PacketHandler extends ChannelDuplexHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promise) throws Exception {
|
public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promise) throws Exception {
|
||||||
|
if (packet.getClass().getSimpleName().equalsIgnoreCase("PacketPlayOutEntityMetadat")) {
|
||||||
|
ClientboundSetEntityDataPacket pk = (ClientboundSetEntityDataPacket) packet;
|
||||||
|
int entityID = pk.getId();
|
||||||
|
final Entity[] entity = {null};
|
||||||
|
// get entity from id
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (Entity e : Bukkit.getWorld("world").getEntities()) {
|
||||||
|
if (e.getEntityId() == entityID && e.getType() == EntityType.PLAYER) {
|
||||||
|
entity[0] = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskLater(NullValkyrie.getPlugin(NullValkyrie.class), 0);
|
||||||
|
if (entity[0] == null) return;
|
||||||
|
List<SynchedEntityData.DataItem<?>> list = pk.getUnpackedData();
|
||||||
|
SynchedEntityData.DataItem<Float> value = (SynchedEntityData.DataItem<Float>) list.get(9);
|
||||||
|
System.out.println(value.getAccessor());
|
||||||
|
ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||||
|
float health = random.nextFloat(5F,20F);
|
||||||
|
list.set(9, new SynchedEntityData.DataItem<>(new EntityDataAccessor<>(value.getAccessor().getId(), EntityDataSerializers.FLOAT), health));
|
||||||
|
}
|
||||||
super.write(ctx, packet, promise);
|
super.write(ctx, packet, promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +65,7 @@ public class PacketHandler extends ChannelDuplexHandler {
|
||||||
ServerboundInteractPacket pk = (ServerboundInteractPacket) packet;
|
ServerboundInteractPacket pk = (ServerboundInteractPacket) packet;
|
||||||
int entityID = (int) Util.getFieldValue(packet, "a");
|
int entityID = (int) Util.getFieldValue(packet, "a");
|
||||||
boolean sneak = (boolean) Util.getFieldValue(packet, "c");
|
boolean sneak = (boolean) Util.getFieldValue(packet, "c");
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getPlugin(Main.class), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(NullValkyrie.getPlugin(NullValkyrie.class), () -> {
|
||||||
for (Entity entity : Bukkit.getWorld("world").getEntities()) {
|
for (Entity entity : Bukkit.getWorld("world").getEntities()) {
|
||||||
if (entity.getEntityId() == entityID && entity.getType() == EntityType.ARMOR_STAND) {
|
if (entity.getEntityId() == entityID && entity.getType() == EntityType.ARMOR_STAND) {
|
||||||
Bukkit.getPluginManager().callEvent(new InteractHologramEvent(player, (ArmorStand) entity));
|
Bukkit.getPluginManager().callEvent(new InteractHologramEvent(player, (ArmorStand) entity));
|
||||||
|
@ -50,7 +81,7 @@ public class PacketHandler extends ChannelDuplexHandler {
|
||||||
//Right Click
|
//Right Click
|
||||||
for (ServerPlayer npcs : NPCManager.getNPCs()) {
|
for (ServerPlayer npcs : NPCManager.getNPCs()) {
|
||||||
if (npcs.getBukkitEntity().getEntityId() == entityID && sneak) {
|
if (npcs.getBukkitEntity().getEntityId() == entityID && sneak) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getPlugin(Main.class), () -> Bukkit.getPluginManager().callEvent(new RightClickNPCEvent(player, npcs)), 0);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(NullValkyrie.getPlugin(NullValkyrie.class), () -> Bukkit.getPluginManager().callEvent(new RightClickNPCEvent(player, npcs)), 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.night.nullvalkyrie.packets.protocol;
|
package me.night.nullvalkyrie.packets.protocol;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Channel {
|
public class Channel {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package me.night.nullvalkyrie.packets.protocol;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.protocol.game.ClientboundBlockDestructionPacket;
|
import net.minecraft.network.protocol.game.ClientboundBlockDestructionPacket;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PacketPlayOutBlockBreakAnimation implements Packet {
|
public class PacketPlayOutBlockBreakAnimation implements Packet {
|
||||||
|
|
|
@ -3,13 +3,11 @@ package me.night.nullvalkyrie.packets.protocol;
|
||||||
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||||
import net.minecraft.network.syncher.SynchedEntityData;
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PacketPlayOutEntityMetadata implements Packet {
|
public class PacketPlayOutEntityMetadata implements Packet {
|
||||||
public PacketPlayOutEntityMetadata(Player player, Entity entity, List<SynchedEntityData.DataValue<?>> list) {
|
public PacketPlayOutEntityMetadata(Player player, Entity entity, SynchedEntityData entityData) {
|
||||||
((CraftPlayer) player).getHandle().connection.send(new ClientboundSetEntityDataPacket(entity.getBukkitEntity().getEntityId(), list));
|
((CraftPlayer) player).getHandle().connection.send(new ClientboundSetEntityDataPacket(entity.getBukkitEntity().getEntityId(), entityData, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package me.night.nullvalkyrie.packets.protocol;
|
||||||
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PacketPlayOutSpawnEntity implements Packet {
|
public class PacketPlayOutSpawnEntity implements Packet {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.night.nullvalkyrie.ui.inventory;
|
package me.night.nullvalkyrie.ui.inventory;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import me.night.nullvalkyrie.database.UserDataManager;
|
import me.night.nullvalkyrie.database.UserDataManager;
|
||||||
import me.night.nullvalkyrie.enums.Items;
|
import me.night.nullvalkyrie.enums.Items;
|
||||||
import me.night.nullvalkyrie.util.RandomCollection;
|
import me.night.nullvalkyrie.util.RandomCollection;
|
||||||
|
@ -142,7 +142,7 @@ public class InventoryListener implements Listener {
|
||||||
ii++;
|
ii++;
|
||||||
time++;
|
time++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(Main.getPlugin(Main.class), 1L, 5L);
|
}.runTaskTimer(NullValkyrie.getPlugin(NullValkyrie.class), 1L, 5L);
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -184,7 +184,7 @@ public class InventoryListener implements Listener {
|
||||||
player.getInventory().addItem(item);
|
player.getInventory().addItem(item);
|
||||||
} else player.closeInventory();
|
} else player.closeInventory();
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(Main.class), 5L * 20L);
|
}.runTaskLater(NullValkyrie.getPlugin(NullValkyrie.class), 5L * 20L);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package me.night.nullvalkyrie.ui.player;
|
package me.night.nullvalkyrie.ui.player;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.NullValkyrie;
|
||||||
import me.night.nullvalkyrie.database.UserDataManager;
|
import me.night.nullvalkyrie.database.UserDataManager;
|
||||||
import me.night.nullvalkyrie.util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -50,7 +50,7 @@ public class SideBarManager {
|
||||||
|
|
||||||
public void start(Player player) {
|
public void start(Player player) {
|
||||||
board = new AnimatedSideBar(player.getUniqueId());
|
board = new AnimatedSideBar(player.getUniqueId());
|
||||||
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(Main.class), new Runnable() {
|
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(NullValkyrie.getPlugin(NullValkyrie.class), new Runnable() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
public void animate(String str) {
|
public void animate(String str) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
Loading…
Reference in a new issue