npcs + miners 1.19.3
This commit is contained in:
parent
42fbf357c7
commit
69c965d807
2 changed files with 17 additions and 16 deletions
|
@ -6,18 +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.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import net.minecraft.server.level.WorldServer;
|
||||
import net.minecraft.server.network.PlayerConnection;
|
||||
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_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||
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.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -137,11 +138,11 @@ public class CryptoMiner {
|
|||
String[] skin = Skin.getSkin("Shiba_");
|
||||
gameProfile.getProperties().put("textures", new Property("textures", skin[0], skin[1]));
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
WorldServer w = ((CraftWorld) player.getLocation().getWorld()).getHandle();
|
||||
EntityPlayer miner = new EntityPlayer(server, w, gameProfile, null);
|
||||
// TODO: how to make a armor stand turn
|
||||
PlayerConnection pc = ((org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer) player).getHandle().b;
|
||||
pc.a(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a, miner));
|
||||
ServerLevel w = ((CraftWorld) player.getLocation().getWorld()).getHandle();
|
||||
ServerPlayer miner = new ServerPlayer(server, w, gameProfile);
|
||||
// TODO: fixing could not add to tab list
|
||||
ServerGamePacketListenerImpl pc = ((CraftPlayer) player).getHandle().connection;
|
||||
pc.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.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++) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package me.night.nullvalkyrie.events.custom;
|
||||
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
|
@ -9,17 +9,17 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class RightClickNPCEvent extends Event implements Cancellable {
|
||||
private final Player player;
|
||||
private final EntityPlayer npc;
|
||||
private final ServerPlayer npc;
|
||||
private boolean isCancelled;
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
public RightClickNPCEvent(Player player, EntityPlayer npc) {
|
||||
public RightClickNPCEvent(Player player, ServerPlayer npc) {
|
||||
this.player = player;
|
||||
this.npc = npc;
|
||||
}
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
public EntityPlayer getNPC() {
|
||||
public ServerPlayer getNPC() {
|
||||
return npc;
|
||||
}
|
||||
@Override
|
||||
|
@ -37,6 +37,6 @@ public class RightClickNPCEvent extends Event implements Cancellable {
|
|||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static HandlerList getHandlerList() { return HANDLERS; }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue