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>
|
||||
<id>remap-obf</id>
|
||||
<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>
|
||||
<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>
|
||||
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
||||
</configuration>
|
||||
|
@ -82,8 +82,8 @@
|
|||
<id>remap-spigot</id>
|
||||
<configuration>
|
||||
<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>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
||||
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
@ -115,7 +115,7 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||
<classifier>remapped-mojang</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -13,8 +13,7 @@ import org.bukkit.*;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public final class NullValkyrie extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
EnchantmentManager.register();
|
|
@ -1,10 +1,9 @@
|
|||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import me.night.nullvalkyrie.entities.npcs.NPCManager;
|
||||
import me.night.nullvalkyrie.entities.pets.ZombiePet;
|
||||
import org.bukkit.Material;
|
||||
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.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
@ -34,7 +33,6 @@ public class BetaCommand extends Command {
|
|||
itemMeta2.setCustomModelData(1010101);
|
||||
item2.setItemMeta(itemMeta2);
|
||||
player.getInventory().addItem(item2);
|
||||
NPCManager.createNPC(player, args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.NullValkyrie;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -23,13 +23,13 @@ public class VanishCommand extends Command {
|
|||
if (vanished.contains(player.getUniqueId())) {
|
||||
vanished.remove(player.getUniqueId());
|
||||
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");
|
||||
} else {
|
||||
vanished.add(player.getUniqueId());
|
||||
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");
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;
|
|||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
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 java.util.Optional;
|
||||
|
@ -29,6 +29,6 @@ public class PerPlayerHologram {
|
|||
SynchedEntityData watcher = stand.getEntityData();
|
||||
watcher.set(new EntityDataAccessor<>(2, EntityDataSerializers.OPTIONAL_COMPONENT), Optional.of(Component.nullToEmpty(line)));
|
||||
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;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.NullValkyrie;
|
||||
import me.night.nullvalkyrie.database.CustomWeaponsDataManager;
|
||||
import me.night.nullvalkyrie.enums.Rarity;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
|
@ -84,7 +84,7 @@ public class CustomItemManager {
|
|||
HashMap<String, Object> pdcdata = (HashMap<String, Object>) weapon.get("PDC");
|
||||
for (String key : pdcdata.keySet()) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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');
|
||||
|
|
|
@ -6,16 +6,19 @@ import com.mojang.authlib.properties.Property;
|
|||
import me.night.nullvalkyrie.enums.MinerType;
|
||||
import me.night.nullvalkyrie.util.Skin;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
||||
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.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -136,7 +139,9 @@ public class CryptoMiner {
|
|||
gameProfile.getProperties().put("textures", new Property("textures", skin[0], skin[1]));
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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();
|
||||
List<Location> locs = new ArrayList<>();
|
||||
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.properties.Property;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import me.night.nullvalkyrie.NullValkyrie;
|
||||
import me.night.nullvalkyrie.database.NPCDataManager;
|
||||
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutEntityMetadata;
|
||||
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutSpawnEntity;
|
||||
import me.night.nullvalkyrie.util.*;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.*;
|
||||
|
@ -17,10 +17,10 @@ import net.minecraft.world.entity.EquipmentSlot;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class NPCManager {
|
|||
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), Util.color(name));
|
||||
String[] skin = Skin.getSkin(player);
|
||||
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();
|
||||
npc.setPos(location.getX(), location.getY(), location.getZ());
|
||||
addNPCPacket(npc);
|
||||
|
@ -53,11 +53,13 @@ public class NPCManager {
|
|||
public static void addNPCPacket(ServerPlayer npc) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
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)));
|
||||
SynchedEntityData watcher = npc.getEntityData();
|
||||
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 anotherAxe = new ItemStack(Material.NETHERITE_INGOT);
|
||||
List<Pair<EquipmentSlot, net.minecraft.world.item.ItemStack>> itemList = new ArrayList<>();
|
||||
|
@ -70,11 +72,13 @@ public class NPCManager {
|
|||
public static void addJoinPacket(Player player) {
|
||||
for (ServerPlayer npc : NPCs) {
|
||||
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)));
|
||||
SynchedEntityData watcher = npc.getEntityData();
|
||||
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 anotherAxe = new ItemStack(Material.NETHERITE_INGOT);
|
||||
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")));
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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
|
||||
addNPCPacket(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.monster.Zombie;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
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.Pickaxe;
|
||||
import me.night.nullvalkyrie.enums.Rarity;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.NullValkyrie;
|
||||
import me.night.nullvalkyrie.packets.protocol.PacketPlayOutBlockBreakAnimation;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
@ -245,7 +245,7 @@ public class CustomItemEvents implements Listener {
|
|||
// player.setHealth(20);
|
||||
// player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
|
||||
// }
|
||||
// }.runTaskLater(Main.getPlugin(Main.class), 100L);
|
||||
// }.runTaskLater(NullValkyrie.getPlugin(NullValkyrie.class), 100L);
|
||||
// countDown(player, new int[]{5});
|
||||
// }
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ public class CustomItemEvents implements Listener {
|
|||
private int taskID;
|
||||
|
||||
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);
|
||||
a[0]--;
|
||||
if (a[0] == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package me.night.nullvalkyrie.events.listeners;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.NullValkyrie;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -60,7 +60,7 @@ public class DamageEffectEvents implements Listener {
|
|||
}
|
||||
removal.forEach(stands::remove);
|
||||
}
|
||||
}.runTaskTimer(Main.getPlugin(Main.class), 0L, 1L);
|
||||
}.runTaskTimer(NullValkyrie.getPlugin(NullValkyrie.class), 0L, 1L);
|
||||
}
|
||||
|
||||
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.server.network.ServerGamePacketListenerImpl;
|
||||
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.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
|
|
@ -3,18 +3,26 @@ package me.night.nullvalkyrie.packets.handle;
|
|||
import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
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.events.custom.InteractHologramEvent;
|
||||
import me.night.nullvalkyrie.events.custom.RightClickNPCEvent;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||
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 org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class PacketHandler extends ChannelDuplexHandler {
|
||||
private final Player player;
|
||||
|
@ -25,6 +33,29 @@ public class PacketHandler extends ChannelDuplexHandler {
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -34,7 +65,7 @@ public class PacketHandler extends ChannelDuplexHandler {
|
|||
ServerboundInteractPacket pk = (ServerboundInteractPacket) packet;
|
||||
int entityID = (int) Util.getFieldValue(packet, "a");
|
||||
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()) {
|
||||
if (entity.getEntityId() == entityID && entity.getType() == EntityType.ARMOR_STAND) {
|
||||
Bukkit.getPluginManager().callEvent(new InteractHologramEvent(player, (ArmorStand) entity));
|
||||
|
@ -50,7 +81,7 @@ public class PacketHandler extends ChannelDuplexHandler {
|
|||
//Right Click
|
||||
for (ServerPlayer npcs : NPCManager.getNPCs()) {
|
||||
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;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Channel {
|
||||
|
|
|
@ -3,7 +3,7 @@ package me.night.nullvalkyrie.packets.protocol;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockDestructionPacket;
|
||||
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;
|
||||
|
||||
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.syncher.SynchedEntityData;
|
||||
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 java.util.List;
|
||||
|
||||
public class PacketPlayOutEntityMetadata implements Packet {
|
||||
public PacketPlayOutEntityMetadata(Player player, Entity entity, List<SynchedEntityData.DataValue<?>> list) {
|
||||
((CraftPlayer) player).getHandle().connection.send(new ClientboundSetEntityDataPacket(entity.getBukkitEntity().getEntityId(), list));
|
||||
public PacketPlayOutEntityMetadata(Player player, Entity entity, SynchedEntityData entityData) {
|
||||
((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.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;
|
||||
|
||||
public class PacketPlayOutSpawnEntity implements Packet {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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.enums.Items;
|
||||
import me.night.nullvalkyrie.util.RandomCollection;
|
||||
|
@ -142,7 +142,7 @@ public class InventoryListener implements Listener {
|
|||
ii++;
|
||||
time++;
|
||||
}
|
||||
}.runTaskTimer(Main.getPlugin(Main.class), 1L, 5L);
|
||||
}.runTaskTimer(NullValkyrie.getPlugin(NullValkyrie.class), 1L, 5L);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -184,7 +184,7 @@ public class InventoryListener implements Listener {
|
|||
player.getInventory().addItem(item);
|
||||
} 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;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.NullValkyrie;
|
||||
import me.night.nullvalkyrie.database.UserDataManager;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -50,7 +50,7 @@ public class SideBarManager {
|
|||
|
||||
public void start(Player player) {
|
||||
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;
|
||||
|
||||
public void animate(String str) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.google.gson.JsonObject;
|
|||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
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 java.io.InputStreamReader;
|
||||
|
|
Loading…
Reference in a new issue