mirror of
https://github.com/darverdevs/BossBarAPI.git
synced 2024-12-22 07:14:11 -08:00
started on ignoring endedragon wing packets
This commit is contained in:
parent
9b5eea48ce
commit
2060408700
|
@ -53,7 +53,6 @@ public class BossBar {
|
||||||
}
|
}
|
||||||
dragon = new SpawnFakeWither.FakeWither(p, ProtocolLibrary.getProtocolManager());
|
dragon = new SpawnFakeWither.FakeWither(p, ProtocolLibrary.getProtocolManager());
|
||||||
dragon.setCustomName(text);
|
dragon.setCustomName(text);
|
||||||
dragon.setVisible(false);
|
|
||||||
dragon.create();
|
dragon.create();
|
||||||
|
|
||||||
t = new TeleportScheduler(this);
|
t = new TeleportScheduler(this);
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package tech.nully.BossBarAPI;
|
package tech.nully.BossBarAPI;
|
||||||
|
|
||||||
|
import com.comphenix.packetwrapper.Packet3ENamedSoundEffect;
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import net.minecraft.server.v1_5_R3.Packet62NamedSoundEffect;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
@ -15,6 +22,13 @@ public class Main extends JavaPlugin {
|
||||||
instance = this;
|
instance = this;
|
||||||
System.out.println("BossBar is on");
|
System.out.println("BossBar is on");
|
||||||
getCommand("bossbar").setExecutor(new FakeWitherCommand());
|
getCommand("bossbar").setExecutor(new FakeWitherCommand());
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, PacketType.Play.Server.NAMED_SOUND_EFFECT) {
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
PacketContainer cont = new PacketContainer(event.getPacketType());
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overrides onDisable
|
// Overrides onDisable
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.comphenix.packetwrapper.Packet18SpawnMob;
|
||||||
import com.comphenix.packetwrapper.Packet1DDestroyEntity;
|
import com.comphenix.packetwrapper.Packet1DDestroyEntity;
|
||||||
import com.comphenix.packetwrapper.Packet28EntityMetadata;
|
import com.comphenix.packetwrapper.Packet28EntityMetadata;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -21,8 +20,6 @@ public class SpawnFakeWither extends JavaPlugin {
|
||||||
// You could also use a full-fledged API like RemoteEntities
|
// You could also use a full-fledged API like RemoteEntities
|
||||||
public static class FakeWither {
|
public static class FakeWither {
|
||||||
public static final byte INVISIBLE = 0x20;
|
public static final byte INVISIBLE = 0x20;
|
||||||
// Just a guess
|
|
||||||
public static final int HEALTH_RANGE = 80 * 80;
|
|
||||||
// Next entity ID
|
// Next entity ID
|
||||||
public static int NEXT_ID = 6000;
|
public static int NEXT_ID = 6000;
|
||||||
|
|
||||||
|
@ -37,8 +34,6 @@ public class SpawnFakeWither extends JavaPlugin {
|
||||||
public int id = NEXT_ID++;
|
public int id = NEXT_ID++;
|
||||||
// Default health
|
// Default health
|
||||||
public int health = 300;
|
public int health = 300;
|
||||||
|
|
||||||
public boolean visible;
|
|
||||||
public String customName;
|
public String customName;
|
||||||
public boolean created;
|
public boolean created;
|
||||||
|
|
||||||
|
@ -67,17 +62,6 @@ public class SpawnFakeWither extends JavaPlugin {
|
||||||
this.health = health;
|
this.health = health;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisible(boolean visible) {
|
|
||||||
// Make visible or invisible
|
|
||||||
if (created) {
|
|
||||||
WrappedDataWatcher watcher = new WrappedDataWatcher();
|
|
||||||
|
|
||||||
watcher.setObject(METADATA_FLAGS, visible ? (byte) 0 : INVISIBLE);
|
|
||||||
sendMetadata(watcher);
|
|
||||||
}
|
|
||||||
this.visible = visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomName(String name) {
|
public void setCustomName(String name) {
|
||||||
if (created) {
|
if (created) {
|
||||||
WrappedDataWatcher watcher = new WrappedDataWatcher();
|
WrappedDataWatcher watcher = new WrappedDataWatcher();
|
||||||
|
@ -116,9 +100,10 @@ public class SpawnFakeWither extends JavaPlugin {
|
||||||
Packet18SpawnMob spawnMob = new Packet18SpawnMob();
|
Packet18SpawnMob spawnMob = new Packet18SpawnMob();
|
||||||
WrappedDataWatcher watcher = new WrappedDataWatcher();
|
WrappedDataWatcher watcher = new WrappedDataWatcher();
|
||||||
|
|
||||||
watcher.setObject(METADATA_FLAGS, visible ? (byte) 0 : INVISIBLE);
|
watcher.setObject(METADATA_FLAGS, INVISIBLE);
|
||||||
watcher.setObject(METADATA_WITHER_HEALTH, (int) health); // 1.5.2 -> Change to (int)
|
watcher.setObject(METADATA_WITHER_HEALTH, (int) health); // 1.5.2 -> Change to (int)
|
||||||
|
|
||||||
|
|
||||||
if (customName != null) {
|
if (customName != null) {
|
||||||
watcher.setObject(METADATA_NAME, customName);
|
watcher.setObject(METADATA_NAME, customName);
|
||||||
watcher.setObject(METADATA_SHOW_NAME, (byte) 1);
|
watcher.setObject(METADATA_SHOW_NAME, (byte) 1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user