diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..e673c30
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..4b71c21
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+
+
+ LoupGarou
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2cb5633
--- /dev/null
+++ b/README.md
@@ -0,0 +1,60 @@
+## Table des matières
+
+- [À propos](#à-propos)
+- [Installation](#installation)
+ - [Dépendances requises](#dépendances-requises)
+- [Commandes](#commandes)
+- [Crédits](#crédits)
+- [Aide](#aide)
+ - [Questions fréquentes](#questions-fréquentes)
+
+## À propos
+
+Le mode Loup-Garou est un mode inspiré du jeu de société [Les Loups-Garous de Thiercelieux](https://fr.wikipedia.org/wiki/Les_Loups-garous_de_Thiercelieux) reprenant son fonctionnement ainsi que sa manière d'être joué, à la seule différence qu'aucun maître du jeu n'est requis, le déroulement de chaque partie étant entièrement automatisé :
+
+- Déroulement de la partie automatisé
+- Rôles du jeu de base, et nouveaux rôles
+- Utilisable sur n'importe quelle map
+
+## Installation
+
+**Minecraft 1.15.1 est requis.**
+Déplacez simplement le plugin compilé [LoupGarou.jar](https://github.com/leomelki/LoupGarou/releases) dans le dossier `plugins` de votre serveur avant de le redémarrer.
+
+### Dépendances requises
+
+- [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/)
+
+## Commandes
+
+`/lg roles` : Retourne la liste des rôles dans la partie
+`/lg roles set ` : Définit le nombre de joueurs pour un certain rôle
+`/lg addSpawn` : Ajoute un point de spawn (emplacement de joueur)
+`/lg start ` : Lance la partie
+`/lg end ` : Arrête une partie
+`/lg reloadConfig` : Recharge la configuration
+`/lg joinAll` : À utiliser après avoir changé les rôles
+
+## Crédits
+
+- Chef de Projet : [Shytoos](https://twitter.com/shytoos_)
+- Développement : [Leomelki](https://twitter.com/leomelki)
+- Mapping : [Cosii](https://www.youtube.com/channel/UCwyOcA41QSk590fl9L0ys8A)
+
+## Aide
+
+Par soucis de temps, nous ne pouvons pas faire de support au cas par cas, mais vous pouvez rejoindre notre serveur [Discord](https://discord.gg/Squeezie) pour trouver de l'aide auprès de la communauté.
+
+### Questions fréquentes
+
+- Que faire en cas de problème d'affichage (votes bloqués au dessus des têtes, etc...) ?
+
+Cela arrive après avoir `reload` au cours d'une partie, tous les joueurs qui ont ce problème doivent se déconnecter et se reconnecter.
+
+- Pourquoi la partie ne se lance pas ?
+
+Il faut taper la commande `/lg start ` en mettant le pseudo d'un des joueurs qui sera présent dans la partie. Si cela ne fonctionne toujours pas, c'est parce qu'il n'y a pas suffisamment de rôles pour le nombre de joueurs, il doit y avoir le même nombre de rôles qu'il y aura de joueurs dans la partie. N'oubliez pas de taper `/lg joinAll` après avoir modifié la liste des rôles.
+
+- J'ai mal placés mes spawns ou je veux utiliser une nouvelle map, comment faire ?
+
+Il suffit d'ouvrir le fichier `plugins\LoupGarou\config.yml` et de supprimer les points de spawn.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..2b7d444
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,90 @@
+
+ 4.0.0
+ fr.leomelki
+ LoupGarou
+ 0.0.1-SNAPSHOT
+
+ UTF-8
+ UTF-8
+
+
+ src
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ 1.8
+
+
+
+ maven-assembly-plugin
+
+
+ ${project.java.version}
+ ${project.build.sourceEncoding}
+
+ jar-with-dependencies
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.0.2
+
+ ${project.build.sourceEncoding}
+
+
+
+
+
+ src/main/java
+
+ plugin.yml
+
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ dmulloy2-repo
+ http://repo.dmulloy2.net/nexus/repository/public/
+
+
+
+
+ bungeecord-repo
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+
+
+ org.spigotmc
+ spigot
+ 1.15.1-R0.1-SNAPSHOT
+ provided
+
+
+ org.json
+ json
+ 20180813
+
+
+ com.comphenix.protocol
+ ProtocolLib
+ 4.4.0
+
+
+ org.projectlombok
+ lombok
+ 1.18.10
+ provided
+
+
+
\ No newline at end of file
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/AbstractPacket.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/AbstractPacket.java
new file mode 100644
index 0000000..e81d3c2
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/AbstractPacket.java
@@ -0,0 +1,116 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.bukkit.entity.Player;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.ProtocolLibrary;
+import com.comphenix.protocol.events.PacketContainer;
+import com.google.common.base.Objects;
+
+public abstract class AbstractPacket {
+ // The packet we will be modifying
+ protected PacketContainer handle;
+
+ /**
+ * Constructs a new strongly typed wrapper for the given packet.
+ *
+ * @param handle - handle to the raw packet data.
+ * @param type - the packet type.
+ */
+ protected AbstractPacket(PacketContainer handle, PacketType type) {
+ // Make sure we're given a valid packet
+ if (handle == null)
+ throw new IllegalArgumentException("Packet handle cannot be NULL.");
+ if (!Objects.equal(handle.getType(), type))
+ throw new IllegalArgumentException(handle.getHandle()
+ + " is not a packet of type " + type);
+
+ this.handle = handle;
+ }
+
+ /**
+ * Retrieve a handle to the raw packet data.
+ *
+ * @return Raw packet data.
+ */
+ public PacketContainer getHandle() {
+ return handle;
+ }
+
+ /**
+ * Send the current packet to the given receiver.
+ *
+ * @param receiver - the receiver.
+ * @throws RuntimeException If the packet cannot be sent.
+ */
+ public void sendPacket(Player receiver) {
+ if(receiver == null)
+ return;
+ try {
+ ProtocolLibrary.getProtocolManager().sendServerPacket(receiver,
+ getHandle());
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException("Cannot send packet.", e);
+ }
+ }
+
+ /**
+ * Send the current packet to all online players.
+ */
+ public void broadcastPacket() {
+ ProtocolLibrary.getProtocolManager().broadcastServerPacket(getHandle());
+ }
+
+ /**
+ * Simulate receiving the current packet from the given sender.
+ *
+ * @param sender - the sender.
+ * @throws RuntimeException If the packet cannot be received.
+ * @deprecated Misspelled. recieve to receive
+ * @see #receivePacket(Player)
+ */
+ @Deprecated
+ public void recievePacket(Player sender) {
+ try {
+ ProtocolLibrary.getProtocolManager().recieveClientPacket(sender,
+ getHandle());
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot recieve packet.", e);
+ }
+ }
+
+ /**
+ * Simulate receiving the current packet from the given sender.
+ *
+ * @param sender - the sender.
+ * @throws RuntimeException if the packet cannot be received.
+ */
+ public void receivePacket(Player sender) {
+ try {
+ ProtocolLibrary.getProtocolManager().recieveClientPacket(sender,
+ getHandle());
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot receive packet.", e);
+ }
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/PacketWrapper.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/PacketWrapper.java
new file mode 100644
index 0000000..27f1052
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/PacketWrapper.java
@@ -0,0 +1,28 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import org.bukkit.plugin.java.JavaPlugin;
+
+public class PacketWrapper extends JavaPlugin {
+ @Override
+ public void onEnable() {
+ // We don't really do much ...
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerChat.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerChat.java
new file mode 100644
index 0000000..e335ed0
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerChat.java
@@ -0,0 +1,104 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.Arrays;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers;
+import com.comphenix.protocol.wrappers.EnumWrappers.ChatType;
+import com.comphenix.protocol.wrappers.WrappedChatComponent;
+
+public class WrapperPlayServerChat extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.CHAT;
+
+ public WrapperPlayServerChat() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerChat(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve the chat message.
+ *
+ * Limited to 32767 bytes
+ *
+ * @return The current message
+ */
+ public WrappedChatComponent getMessage() {
+ return handle.getChatComponents().read(0);
+ }
+
+ /**
+ * Set the message.
+ *
+ * @param value - new value.
+ */
+ public void setMessage(WrappedChatComponent value) {
+ handle.getChatComponents().write(0, value);
+ }
+
+ public ChatType getChatType() {
+ return handle.getChatTypes().read(0);
+ }
+
+ public void setChatType(ChatType type) {
+ handle.getChatTypes().write(0, type);
+ }
+
+ /**
+ * Retrieve Position.
+ *
+ * Notes: 0 - Chat (chat box) ,1 - System Message (chat box), 2 - Above
+ * action bar
+ *
+ * @return The current Position
+ * @deprecated Magic values replaced by enum
+ */
+ @Deprecated
+ public byte getPosition() {
+ Byte position = handle.getBytes().readSafely(0);
+ if (position != null) {
+ return position;
+ } else {
+ return getChatType().getId();
+ }
+ }
+
+ /**
+ * Set Position.
+ *
+ * @param value - new value.
+ * @deprecated Magic values replaced by enum
+ */
+ @Deprecated
+ public void setPosition(byte value) {
+ handle.getBytes().writeSafely(0, value);
+
+ if (EnumWrappers.getChatTypeClass() != null)
+ {
+ Arrays.stream(ChatType.values()).filter(t -> t.getId() == value).findAny()
+ .ifPresent(t -> handle.getChatTypes().writeSafely(0, t));
+ }
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerCustomSoundEffect.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerCustomSoundEffect.java
new file mode 100644
index 0000000..2cc79e6
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerCustomSoundEffect.java
@@ -0,0 +1,183 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers.SoundCategory;
+import com.comphenix.protocol.wrappers.MinecraftKey;
+
+public class WrapperPlayServerCustomSoundEffect extends AbstractPacket {
+
+ public static final PacketType TYPE =
+ PacketType.Play.Server.CUSTOM_SOUND_EFFECT;
+
+ public WrapperPlayServerCustomSoundEffect() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerCustomSoundEffect(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Sound Name.
+ *
+ * Notes: all known sound effect names can be seen here.
+ *
+ * @return The current Sound Name
+ */
+ public MinecraftKey getSoundName() {
+ return handle.getMinecraftKeys().read(0);
+ }
+
+ /**
+ * Set Sound Name.
+ *
+ * @param value - new value.
+ */
+ public void setSoundName(MinecraftKey value) {
+ handle.getMinecraftKeys().write(0, value);
+ }
+
+ /**
+ * Retrieve Sound Category.
+ *
+ * Notes: the category that this sound will be played from (current
+ * categories)
+ *
+ * @return The current Sound Category
+ */
+ public SoundCategory getSoundCategory() {
+ return handle.getSoundCategories().read(0);
+ }
+
+ /**
+ * Set Sound Category.
+ *
+ * @param value - new value.
+ */
+ public void setSoundCategory(SoundCategory value) {
+ handle.getSoundCategories().write(0, value);
+ }
+
+ /**
+ * Retrieve Effect Position X.
+ *
+ * Notes: effect X multiplied by 8 (fixed-point number with only 3 bits
+ * dedicated to the fractional part)
+ *
+ * @return The current Effect Position X
+ */
+ public int getX() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Effect Position X.
+ *
+ * @param value - new value.
+ */
+ public void setX(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve Effect Position Y.
+ *
+ * Notes: effect Y multiplied by 8 (fixed-point number with only 3 bits
+ * dedicated to the fractional part)
+ *
+ * @return The current Effect Position Y
+ */
+ public int getY() {
+ return handle.getIntegers().read(1);
+ }
+
+ /**
+ * Set Effect Position Y.
+ *
+ * @param value - new value.
+ */
+ public void setY(int value) {
+ handle.getIntegers().write(1, value);
+ }
+
+ /**
+ * Retrieve Effect Position Z.
+ *
+ * Notes: effect Z multiplied by 8 (fixed-point number with only 3 bits
+ * dedicated to the fractional part)
+ *
+ * @return The current Effect Position Z
+ */
+ public int getZ() {
+ return handle.getIntegers().read(2);
+ }
+
+ /**
+ * Set Effect Position Z.
+ *
+ * @param value - new value.
+ */
+ public void setZ(int value) {
+ handle.getIntegers().write(2, value);
+ }
+
+ /**
+ * Retrieve Volume.
+ *
+ * Notes: 1 is 100%, can be more
+ *
+ * @return The current Volume
+ */
+ public float getVolume() {
+ return handle.getFloat().read(0);
+ }
+
+ /**
+ * Set Volume.
+ *
+ * @param value - new value.
+ */
+ public void setVolume(float value) {
+ handle.getFloat().write(0, value);
+ }
+
+ /**
+ * Retrieve Pitch.
+ *
+ * Notes: 63 is 100%, can be more
+ *
+ * @return The current Pitch
+ */
+ public float getPitch() {
+ return handle.getFloat().read(1);
+ }
+
+ /**
+ * Set Pitch.
+ *
+ * @param value - new value.
+ */
+ public void setPitch(float value) {
+ handle.getFloat().write(1, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntity.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntity.java
new file mode 100644
index 0000000..6070a9d
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntity.java
@@ -0,0 +1,79 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+
+public class WrapperPlayServerEntity extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.ENTITY;
+
+ public WrapperPlayServerEntity() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerEntity(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Entity ID.
+ *
+ * Notes: entity's ID
+ *
+ * @return The current Entity ID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Entity ID.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param world - the current world of the entity.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param event - the packet event.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityDestroy.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityDestroy.java
new file mode 100644
index 0000000..89523f7
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityDestroy.java
@@ -0,0 +1,67 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+
+public class WrapperPlayServerEntityDestroy extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.ENTITY_DESTROY;
+
+ public WrapperPlayServerEntityDestroy() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerEntityDestroy(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Count.
+ *
+ * Notes: length of following array
+ *
+ * @return The current Count
+ */
+ public int getCount() {
+ return handle.getIntegerArrays().read(0).length;
+ }
+
+ /**
+ * Retrieve Entity IDs.
+ *
+ * Notes: the list of entities of destroy
+ *
+ * @return The current Entity IDs
+ */
+ public int[] getEntityIDs() {
+ return handle.getIntegerArrays().read(0);
+ }
+
+ /**
+ * Set Entity IDs.
+ *
+ * @param value - new value.
+ */
+ public void setEntityIds(int[] value) {
+ handle.getIntegerArrays().write(0, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityEquipment.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityEquipment.java
new file mode 100644
index 0000000..6b07fe1
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityEquipment.java
@@ -0,0 +1,110 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.inventory.ItemStack;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
+
+public class WrapperPlayServerEntityEquipment extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.ENTITY_EQUIPMENT;
+
+ public WrapperPlayServerEntityEquipment() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerEntityEquipment(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Entity ID.
+ *
+ * Notes: entity's ID
+ *
+ * @return The current Entity ID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Entity ID.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param world - the current world of the entity.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param event - the packet event.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+
+ public ItemSlot getSlot() {
+ return handle.getItemSlots().read(0);
+ }
+
+ public void setSlot(ItemSlot value) {
+ handle.getItemSlots().write(0, value);
+ }
+
+ /**
+ * Retrieve Item.
+ *
+ * Notes: item in slot format
+ *
+ * @return The current Item
+ */
+ public ItemStack getItem() {
+ return handle.getItemModifier().read(0);
+ }
+
+ /**
+ * Set Item.
+ *
+ * @param value - new value.
+ */
+ public void setItem(ItemStack value) {
+ handle.getItemModifier().write(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityLook.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityLook.java
new file mode 100644
index 0000000..2445f3d
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityLook.java
@@ -0,0 +1,133 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+
+public class WrapperPlayServerEntityLook extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.ENTITY_LOOK;
+
+ public WrapperPlayServerEntityLook() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerEntityLook(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Entity ID.
+ *
+ * Notes: entity's ID
+ *
+ * @return The current Entity ID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Entity ID.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param world - the current world of the entity.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param event - the packet event.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+
+ /**
+ * Retrieve the yaw of the current entity.
+ *
+ * @return The current Yaw
+ */
+ public float getYaw() {
+ return (handle.getBytes().read(0) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the yaw of the current entity.
+ *
+ * @param value - new yaw.
+ */
+ public void setYaw(float value) {
+ handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the pitch of the current entity.
+ *
+ * @return The current pitch
+ */
+ public float getPitch() {
+ return (handle.getBytes().read(1) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the pitch of the current entity.
+ *
+ * @param value - new pitch.
+ */
+ public void setPitch(float value) {
+ handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve On Ground.
+ *
+ * @return The current On Ground
+ */
+ public boolean getOnGround() {
+ return handle.getBooleans().read(0);
+ }
+
+ /**
+ * Set On Ground.
+ *
+ * @param value - new value.
+ */
+ public void setOnGround(boolean value) {
+ handle.getBooleans().write(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityMetadata.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityMetadata.java
new file mode 100644
index 0000000..0a6f57a
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityMetadata.java
@@ -0,0 +1,101 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.List;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+import com.comphenix.protocol.wrappers.WrappedWatchableObject;
+
+public class WrapperPlayServerEntityMetadata extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.ENTITY_METADATA;
+
+ public WrapperPlayServerEntityMetadata() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerEntityMetadata(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Entity ID.
+ *
+ * Notes: entity's ID
+ *
+ * @return The current Entity ID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Entity ID.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param world - the current world of the entity.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param event - the packet event.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+
+ /**
+ * Retrieve Metadata.
+ *
+ * @return The current Metadata
+ */
+ public List getMetadata() {
+ return handle.getWatchableCollectionModifier().read(0);
+ }
+
+ /**
+ * Set Metadata.
+ *
+ * @param value - new value.
+ */
+ public void setMetadata(List value) {
+ handle.getWatchableCollectionModifier().write(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityTeleport.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityTeleport.java
new file mode 100644
index 0000000..49f9f96
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerEntityTeleport.java
@@ -0,0 +1,146 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+
+public class WrapperPlayServerEntityTeleport extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.ENTITY_TELEPORT;
+
+ public WrapperPlayServerEntityTeleport() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerEntityTeleport(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve entity ID.
+ *
+ * @return The current EID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set entity ID.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve the entity.
+ *
+ * @param world - the current world of the entity.
+ * @return The entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity.
+ *
+ * @param event - the packet event.
+ * @return The entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+
+ public double getX() {
+ return handle.getDoubles().read(0);
+ }
+
+ public void setX(double value) {
+ handle.getDoubles().write(0, value);
+ }
+
+ public double getY() {
+ return handle.getDoubles().read(1);
+ }
+
+ public void setY(double value) {
+ handle.getDoubles().write(1, value);
+ }
+
+ public double getZ() {
+ return handle.getDoubles().read(2);
+ }
+
+ public void setZ(double value) {
+ handle.getDoubles().write(2, value);
+ }
+
+ /**
+ * Retrieve the yaw of the current entity.
+ *
+ * @return The current Yaw
+ */
+ public float getYaw() {
+ return (handle.getBytes().read(0) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the yaw of the current entity.
+ *
+ * @param value - new yaw.
+ */
+ public void setYaw(float value) {
+ handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the pitch of the current entity.
+ *
+ * @return The current pitch
+ */
+ public float getPitch() {
+ return (handle.getBytes().read(1) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the pitch of the current entity.
+ *
+ * @param value - new pitch.
+ */
+ public void setPitch(float value) {
+ handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
+ }
+
+ public boolean getOnGround() {
+ return handle.getBooleans().read(0);
+ }
+
+ public void setOnGround(boolean value) {
+ handle.getBooleans().write(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerExperience.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerExperience.java
new file mode 100644
index 0000000..8526374
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerExperience.java
@@ -0,0 +1,92 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+
+public class WrapperPlayServerExperience extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.EXPERIENCE;
+
+ public WrapperPlayServerExperience() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerExperience(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Experience bar.
+ *
+ * Notes: between 0 and 1
+ *
+ * @return The current Experience bar
+ */
+ public float getExperienceBar() {
+ return handle.getFloat().read(0);
+ }
+
+ /**
+ * Set Experience bar.
+ *
+ * @param value - new value.
+ */
+ public void setExperienceBar(float value) {
+ handle.getFloat().write(0, value);
+ }
+
+ /**
+ * Retrieve Level.
+ *
+ * @return The current Level
+ */
+ public int getLevel() {
+ return handle.getIntegers().read(1);
+ }
+
+ /**
+ * Set Level.
+ *
+ * @param value - new value.
+ */
+ public void setLevel(int value) {
+ handle.getIntegers().write(1, value);
+ }
+
+ /**
+ * Retrieve Total Experience.
+ *
+ * @return The current Total Experience
+ */
+ public int getTotalExperience() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Total Experience.
+ *
+ * @param value - new value.
+ */
+ public void setTotalExperience(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerHeldItemSlot.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerHeldItemSlot.java
new file mode 100644
index 0000000..e56fb02
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerHeldItemSlot.java
@@ -0,0 +1,56 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+
+public class WrapperPlayServerHeldItemSlot extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.HELD_ITEM_SLOT;
+
+ public WrapperPlayServerHeldItemSlot() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerHeldItemSlot(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Slot.
+ *
+ * Notes: the slot which the player has selected (0-8)
+ *
+ * @return The current Slot
+ */
+ public int getSlot() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Slot.
+ *
+ * @param value - new value.
+ */
+ public void setSlot(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerNamedEntitySpawn.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerNamedEntitySpawn.java
new file mode 100644
index 0000000..2c20ffb
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerNamedEntitySpawn.java
@@ -0,0 +1,204 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.UUID;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.util.Vector;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+import com.comphenix.protocol.wrappers.WrappedDataWatcher;
+
+public class WrapperPlayServerNamedEntitySpawn extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.NAMED_ENTITY_SPAWN;
+
+ public WrapperPlayServerNamedEntitySpawn() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerNamedEntitySpawn(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Entity ID.
+ *
+ * Notes: entity's ID
+ *
+ * @return The current Entity ID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Entity ID.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param world - the current world of the entity.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity of the painting that will be spawned.
+ *
+ * @param event - the packet event.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+
+ /**
+ * Retrieve Player UUID.
+ *
+ * Notes: player's UUID
+ *
+ * @return The current Player UUID
+ */
+ public UUID getPlayerUUID() {
+ return handle.getUUIDs().read(0);
+ }
+
+ /**
+ * Set Player UUID.
+ *
+ * @param value - new value.
+ */
+ public void setPlayerUUID(UUID value) {
+ handle.getUUIDs().write(0, value);
+ }
+
+ /**
+ * Retrieve the position of the spawned entity as a vector.
+ *
+ * @return The position as a vector.
+ */
+ public Vector getPosition() {
+ return new Vector(getX(), getY(), getZ());
+ }
+
+ /**
+ * Set the position of the spawned entity using a vector.
+ *
+ * @param position - the new position.
+ */
+ public void setPosition(Vector position) {
+ setX(position.getX());
+ setY(position.getY());
+ setZ(position.getZ());
+ }
+
+ public double getX() {
+ return handle.getDoubles().read(0);
+ }
+
+ public void setX(double value) {
+ handle.getDoubles().write(0, value);
+ }
+
+ public double getY() {
+ return handle.getDoubles().read(1);
+ }
+
+ public void setY(double value) {
+ handle.getDoubles().write(1, value);
+ }
+
+ public double getZ() {
+ return handle.getDoubles().read(2);
+ }
+
+ public void setZ(double value) {
+ handle.getDoubles().write(2, value);
+ }
+
+ /**
+ * Retrieve the yaw of the spawned entity.
+ *
+ * @return The current Yaw
+ */
+ public float getYaw() {
+ return (handle.getBytes().read(0) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the yaw of the spawned entity.
+ *
+ * @param value - new yaw.
+ */
+ public void setYaw(float value) {
+ handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the pitch of the spawned entity.
+ *
+ * @return The current pitch
+ */
+ public float getPitch() {
+ return (handle.getBytes().read(1) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the pitch of the spawned entity.
+ *
+ * @param value - new pitch.
+ */
+ public void setPitch(float value) {
+ handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve Metadata.
+ *
+ * Notes: the client will crash if no metadata is sent
+ *
+ * @return The current Metadata
+ */
+ public WrappedDataWatcher getMetadata() {
+ return handle.getDataWatcherModifier().read(0);
+ }
+
+ /**
+ * Set Metadata.
+ *
+ * @param value - new value.
+ */
+ public void setMetadata(WrappedDataWatcher value) {
+ handle.getDataWatcherModifier().write(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerNamedSoundEffect.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerNamedSoundEffect.java
new file mode 100644
index 0000000..c124ee2
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerNamedSoundEffect.java
@@ -0,0 +1,156 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import org.bukkit.Sound;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers.SoundCategory;
+
+public class WrapperPlayServerNamedSoundEffect extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.NAMED_SOUND_EFFECT;
+
+ public WrapperPlayServerNamedSoundEffect() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerNamedSoundEffect(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ public Sound getSoundEffect() {
+ return handle.getSoundEffects().read(0);
+ }
+
+ public void setSoundEffect(Sound value) {
+ handle.getSoundEffects().write(0, value);
+ }
+
+ public SoundCategory getSoundCategory() {
+ return handle.getSoundCategories().read(0);
+ }
+
+ public void setSoundCategory(SoundCategory value) {
+ handle.getSoundCategories().write(0, value);
+ }
+
+ /**
+ * Retrieve Effect position X.
+ *
+ * Notes: effect X multiplied by 8
+ *
+ * @return The current Effect position X
+ */
+ public int getEffectPositionX() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Effect position X.
+ *
+ * @param value - new value.
+ */
+ public void setEffectPositionX(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve Effect position Y.
+ *
+ * Notes: effect Y multiplied by 8
+ *
+ * @return The current Effect position Y
+ */
+ public int getEffectPositionY() {
+ return handle.getIntegers().read(1);
+ }
+
+ /**
+ * Set Effect position Y.
+ *
+ * @param value - new value.
+ */
+ public void setEffectPositionY(int value) {
+ handle.getIntegers().write(1, value);
+ }
+
+ /**
+ * Retrieve Effect position Z.
+ *
+ * Notes: effect Z multiplied by 8
+ *
+ * @return The current Effect position Z
+ */
+ public int getEffectPositionZ() {
+ return handle.getIntegers().read(2);
+ }
+
+ /**
+ * Set Effect position Z.
+ *
+ * @param value - new value.
+ */
+ public void setEffectPositionZ(int value) {
+ handle.getIntegers().write(2, value);
+ }
+
+ /**
+ * Retrieve Volume.
+ *
+ * Notes: 1 is 100%, can be more
+ *
+ * @return The current Volume
+ */
+ public float getVolume() {
+ return handle.getFloat().read(0);
+ }
+
+ /**
+ * Set Volume.
+ *
+ * @param value - new value.
+ */
+ public void setVolume(float value) {
+ handle.getFloat().write(0, value);
+ }
+
+ /**
+ * Retrieve Pitch.
+ *
+ * Notes: 63 is 100%, can be more
+ *
+ * @return The current Pitch
+ */
+ public float getPitch() {
+ return handle.getFloat().read(1);
+ }
+
+ /**
+ * Set Pitch.
+ *
+ * @param value - new value.
+ */
+ public void setPitch(float value) {
+ handle.getFloat().write(1, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerPlayerInfo.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerPlayerInfo.java
new file mode 100644
index 0000000..7d51070
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerPlayerInfo.java
@@ -0,0 +1,55 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.List;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
+import com.comphenix.protocol.wrappers.PlayerInfoData;
+
+public class WrapperPlayServerPlayerInfo extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.PLAYER_INFO;
+
+ public WrapperPlayServerPlayerInfo() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerPlayerInfo(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ public PlayerInfoAction getAction() {
+ return handle.getPlayerInfoAction().read(0);
+ }
+
+ public void setAction(PlayerInfoAction value) {
+ handle.getPlayerInfoAction().write(0, value);
+ }
+
+ public List getData() {
+ return handle.getPlayerInfoDataLists().read(0);
+ }
+
+ public void setData(List value) {
+ handle.getPlayerInfoDataLists().write(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerPosition.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerPosition.java
new file mode 100644
index 0000000..0f05436
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerPosition.java
@@ -0,0 +1,161 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.Set;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.reflect.StructureModifier;
+import com.comphenix.protocol.utility.MinecraftReflection;
+import com.comphenix.protocol.wrappers.EnumWrappers;
+
+public class WrapperPlayServerPosition extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.POSITION;
+
+ public WrapperPlayServerPosition() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerPosition(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve X.
+ *
+ * Notes: absolute/Relative position
+ *
+ * @return The current X
+ */
+ public double getX() {
+ return handle.getDoubles().read(0);
+ }
+
+ /**
+ * Set X.
+ *
+ * @param value - new value.
+ */
+ public void setX(double value) {
+ handle.getDoubles().write(0, value);
+ }
+
+ /**
+ * Retrieve Y.
+ *
+ * Notes: absolute/Relative position
+ *
+ * @return The current Y
+ */
+ public double getY() {
+ return handle.getDoubles().read(1);
+ }
+
+ /**
+ * Set Y.
+ *
+ * @param value - new value.
+ */
+ public void setY(double value) {
+ handle.getDoubles().write(1, value);
+ }
+
+ /**
+ * Retrieve Z.
+ *
+ * Notes: absolute/Relative position
+ *
+ * @return The current Z
+ */
+ public double getZ() {
+ return handle.getDoubles().read(2);
+ }
+
+ /**
+ * Set Z.
+ *
+ * @param value - new value.
+ */
+ public void setZ(double value) {
+ handle.getDoubles().write(2, value);
+ }
+
+ /**
+ * Retrieve Yaw.
+ *
+ * Notes: absolute/Relative rotation on the X Axis, in degrees
+ *
+ * @return The current Yaw
+ */
+ public float getYaw() {
+ return handle.getFloat().read(0);
+ }
+
+ /**
+ * Set Yaw.
+ *
+ * @param value - new value.
+ */
+ public void setYaw(float value) {
+ handle.getFloat().write(0, value);
+ }
+
+ /**
+ * Retrieve Pitch.
+ *
+ * Notes: absolute/Relative rotation on the Y Axis, in degrees
+ *
+ * @return The current Pitch
+ */
+ public float getPitch() {
+ return handle.getFloat().read(1);
+ }
+
+ /**
+ * Set Pitch.
+ *
+ * @param value - new value.
+ */
+ public void setPitch(float value) {
+ handle.getFloat().write(1, value);
+ }
+
+ private static final Class> FLAGS_CLASS = MinecraftReflection
+ .getMinecraftClass("EnumPlayerTeleportFlags",
+ "PacketPlayOutPosition$EnumPlayerTeleportFlags");
+
+ public enum PlayerTeleportFlag {
+ X, Y, Z, Y_ROT, X_ROT
+ }
+
+ private StructureModifier> getFlagsModifier() {
+ return handle.getSets(
+ EnumWrappers.getGenericConverter(FLAGS_CLASS, PlayerTeleportFlag.class));
+ }
+
+ public Set getFlags() {
+ return getFlagsModifier().read(0);
+ }
+
+ public void setFlags(Set value) {
+ getFlagsModifier().write(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerRespawn.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerRespawn.java
new file mode 100644
index 0000000..2e7ab88
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerRespawn.java
@@ -0,0 +1,121 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import org.bukkit.WorldType;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers.Difficulty;
+import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
+
+public class WrapperPlayServerRespawn extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.RESPAWN;
+
+ public WrapperPlayServerRespawn() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerRespawn(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Dimension.
+ *
+ * Notes: -1: The Nether, 0: The Overworld, 1: The End
+ *
+ * @return The current Dimension
+ */
+ public int getDimension() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Dimension.
+ *
+ * @param value - new value.
+ */
+ public void setDimension(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve Difficulty.
+ *
+ * Notes: 0 thru 3 for Peaceful, Easy, Normal, Hard.
+ *
+ * @return The current Difficulty
+ */
+ public Difficulty getDifficulty() {
+ return handle.getDifficulties().read(0);
+ }
+
+ /**
+ * Set Difficulty.
+ *
+ * @param value - new value.
+ */
+ public void setDifficulty(Difficulty value) {
+ handle.getDifficulties().write(0, value);
+ }
+
+ /**
+ * Retrieve Gamemode.
+ *
+ * Notes: 0: survival, 1: creative, 2: adventure. The hardcore flag is not
+ * included
+ *
+ * @return The current Gamemode
+ */
+ public NativeGameMode getGamemode() {
+ return handle.getGameModes().read(0);
+ }
+
+ /**
+ * Set Gamemode.
+ *
+ * @param value - new value.
+ */
+ public void setGamemode(NativeGameMode value) {
+ handle.getGameModes().write(0, value);
+ }
+
+ /**
+ * Retrieve Level Type.
+ *
+ * Notes: same as Join Game
+ *
+ * @return The current Level Type
+ */
+ public WorldType getLevelType() {
+ return handle.getWorldTypeModifier().read(0);
+ }
+
+ /**
+ * Set Level Type.
+ *
+ * @param value - new value.
+ */
+ public void setLevelType(WorldType value) {
+ handle.getWorldTypeModifier().write(0, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardDisplayObjective.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardDisplayObjective.java
new file mode 100644
index 0000000..af9d950
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardDisplayObjective.java
@@ -0,0 +1,78 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+
+public class WrapperPlayServerScoreboardDisplayObjective extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE;
+
+ public WrapperPlayServerScoreboardDisplayObjective() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerScoreboardDisplayObjective(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Position.
+ *
+ * Notes: the position of the scoreboard. 0 = list, 1 = sidebar, 2 =
+ * belowName.
+ *
+ * @return The current Position
+ */
+ public int getPosition() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Position.
+ *
+ * @param value - new value.
+ */
+ public void setPosition(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve Score Name.
+ *
+ * Notes: the unique name for the scoreboard to be displayed.
+ *
+ * @return The current Score Name
+ */
+ public String getScoreName() {
+ return handle.getStrings().read(0);
+ }
+
+ /**
+ * Set Score Name.
+ *
+ * @param value - new value.
+ */
+ public void setScoreName(String value) {
+ handle.getStrings().write(0, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardObjective.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardObjective.java
new file mode 100644
index 0000000..bd0560e
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardObjective.java
@@ -0,0 +1,141 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.reflect.IntEnum;
+import com.comphenix.protocol.wrappers.WrappedChatComponent;
+
+public class WrapperPlayServerScoreboardObjective extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.SCOREBOARD_OBJECTIVE;
+
+ public WrapperPlayServerScoreboardObjective() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerScoreboardObjective(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Enum containing all known packet modes.
+ *
+ * @author dmulloy2
+ */
+ public static class Mode extends IntEnum {
+ public static final int ADD_OBJECTIVE = 0;
+ public static final int REMOVE_OBJECTIVE = 1;
+ public static final int UPDATE_VALUE = 2;
+
+ private static final Mode INSTANCE = new Mode();
+
+ public static Mode getInstance() {
+ return INSTANCE;
+ }
+ }
+
+ /**
+ * Retrieve Objective name.
+ *
+ * Notes: an unique name for the objective
+ *
+ * @return The current Objective name
+ */
+ public String getName() {
+ return handle.getStrings().read(0);
+ }
+
+ /**
+ * Set Objective name.
+ *
+ * @param value - new value.
+ */
+ public void setName(String value) {
+ handle.getStrings().write(0, value);
+ }
+
+ /**
+ * Retrieve Objective DisplayName.
+ *
+ * Notes: only if mode is 0 or 2. The text to be displayed for the score.
+ *
+ * @return The current Objective value
+ */
+ public WrappedChatComponent getDisplayName() {
+ return handle.getChatComponents().read(0);
+ }
+
+ /**
+ * Set Objective DisplayName.
+ *
+ * @param value - new value.
+ */
+ public void setDisplayName(WrappedChatComponent value) {
+ handle.getChatComponents().write(0, value);
+ }
+
+ /**
+ * Retrieve health display.
+ *
+ * Notes: Can be either INTEGER or HEARTS
+ *
+ * @return the current health display value
+ */
+ public HealthDisplay getHealthDisplay() {
+ return handle.getEnumModifier(HealthDisplay.class, 2).read(0);
+ }
+
+ /**
+ * Set health display.
+ *
+ * @param value - value
+ * @see #getHealthDisplay()
+ */
+ public void setHealthDisplay(HealthDisplay value) {
+ handle.getEnumModifier(HealthDisplay.class, 2).write(0, value);
+ }
+
+ /**
+ * Retrieve Mode.
+ *
+ * Notes: 0 to create the scoreboard. 1 to remove the scoreboard. 2 to
+ * update the display text.
+ *
+ * @return The current Mode
+ */
+ public int getMode() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Mode.
+ *
+ * @param value - new value.
+ */
+ public void setMode(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ public enum HealthDisplay {
+ INTEGER, HEARTS
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardScore.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardScore.java
new file mode 100644
index 0000000..4fc86a6
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardScore.java
@@ -0,0 +1,107 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers.ScoreboardAction;
+
+public class WrapperPlayServerScoreboardScore extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.SCOREBOARD_SCORE;
+
+ public WrapperPlayServerScoreboardScore() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerScoreboardScore(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Score name.
+ *
+ * Notes: the name of the score to be updated or removed.
+ *
+ * @return The current Score name
+ */
+ public String getScoreName() {
+ return handle.getStrings().read(0);
+ }
+
+ /**
+ * Set Score name.
+ *
+ * @param value - new value.
+ */
+ public void setScoreName(String value) {
+ handle.getStrings().write(0, value);
+ }
+
+ /**
+ * Retrieve Objective Name.
+ *
+ * Notes: the name of the objective the score belongs to.
+ *
+ * @return The current Objective Name
+ */
+ public String getObjectiveName() {
+ return handle.getStrings().read(1);
+ }
+
+ /**
+ * Set Objective Name.
+ *
+ * @param value - new value.
+ */
+ public void setObjectiveName(String value) {
+ handle.getStrings().write(1, value);
+ }
+
+ /**
+ * Retrieve Value.
+ *
+ * Notes: the score to be displayed next to the entry. Only sent when
+ * Update/Remove does not equal 1.
+ *
+ * @return The current Value
+ */
+ public int getValue() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Value.
+ *
+ * @param value - new value.
+ */
+ public void setValue(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ public ScoreboardAction getAction() {
+ return handle.getScoreboardActions().read(0);
+ }
+
+ public void setScoreboardAction(ScoreboardAction value) {
+ handle.getScoreboardActions().write(0, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardTeam.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardTeam.java
new file mode 100644
index 0000000..b132a65
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerScoreboardTeam.java
@@ -0,0 +1,279 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.Collection;
+import java.util.List;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.reflect.IntEnum;
+import com.comphenix.protocol.utility.MinecraftReflection;
+import com.comphenix.protocol.wrappers.WrappedChatComponent;
+
+import org.bukkit.ChatColor;
+
+public class WrapperPlayServerScoreboardTeam extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.SCOREBOARD_TEAM;
+
+ public WrapperPlayServerScoreboardTeam() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerScoreboardTeam(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Enum containing all known modes.
+ *
+ * @author dmulloy2
+ */
+ public static class Mode extends IntEnum {
+ public static final int TEAM_CREATED = 0;
+ public static final int TEAM_REMOVED = 1;
+ public static final int TEAM_UPDATED = 2;
+ public static final int PLAYERS_ADDED = 3;
+ public static final int PLAYERS_REMOVED = 4;
+
+ private static final Mode INSTANCE = new Mode();
+
+ public static Mode getInstance() {
+ return INSTANCE;
+ }
+ }
+
+ /**
+ * Retrieve Team Name.
+ *
+ * Notes: a unique name for the team. (Shared with scoreboard).
+ *
+ * @return The current Team Name
+ */
+ public String getName() {
+ return handle.getStrings().read(0);
+ }
+
+ /**
+ * Set Team Name.
+ *
+ * @param value - new value.
+ */
+ public void setName(String value) {
+ handle.getStrings().write(0, value);
+ }
+
+ /**
+ * Retrieve Team Display Name.
+ *
+ * Notes: only if Mode = 0 or 2.
+ *
+ * @return The current Team Display Name
+ */
+ public WrappedChatComponent getDisplayName() {
+ return handle.getChatComponents().read(0);
+ }
+
+ /**
+ * Set Team Display Name.
+ *
+ * @param value - new value.
+ */
+ public void setDisplayName(WrappedChatComponent value) {
+ handle.getChatComponents().write(0, value);
+ }
+
+ /**
+ * Retrieve Team Prefix.
+ *
+ * Notes: only if Mode = 0 or 2. Displayed before the players' name that are
+ * part of this team.
+ *
+ * @return The current Team Prefix
+ */
+ public WrappedChatComponent getPrefix() {
+ return handle.getChatComponents().read(1);
+ }
+
+ /**
+ * Set Team Prefix.
+ *
+ * @param value - new value.
+ */
+ public void setPrefix(WrappedChatComponent value) {
+ handle.getChatComponents().write(1, value);
+ }
+
+ /**
+ * Retrieve Team Suffix.
+ *
+ * Notes: only if Mode = 0 or 2. Displayed after the players' name that are
+ * part of this team.
+ *
+ * @return The current Team Suffix
+ */
+ public WrappedChatComponent getSuffix() {
+ return handle.getChatComponents().read(2);
+ }
+
+ /**
+ * Set Team Suffix.
+ *
+ * @param value - new value.
+ */
+ public void setSuffix(WrappedChatComponent value) {
+ handle.getChatComponents().write(2, value);
+ }
+
+ /**
+ * Retrieve Name Tag Visibility.
+ *
+ * Notes: only if Mode = 0 or 2. always, hideForOtherTeams, hideForOwnTeam,
+ * never.
+ *
+ * @return The current Name Tag Visibility
+ */
+ public String getNameTagVisibility() {
+ return handle.getStrings().read(1);
+ }
+
+ /**
+ * Set Name Tag Visibility.
+ *
+ * @param value - new value.
+ */
+ public void setNameTagVisibility(String value) {
+ handle.getStrings().write(1, value);
+ }
+
+ /**
+ * Retrieve Color.
+ *
+ * Notes: only if Mode = 0 or 2. Same as Chat colors.
+ *
+ * @return The current Color
+ */
+ public ChatColor getColor() {
+ return handle.getEnumModifier(ChatColor.class, MinecraftReflection.getMinecraftClass("EnumChatFormat")).read(0);
+ }
+
+ /**
+ * Set Color.
+ *
+ * @param value - new value.
+ */
+ public void setColor(ChatColor value) {
+ handle.getEnumModifier(ChatColor.class, MinecraftReflection.getMinecraftClass("EnumChatFormat")).write(0, value);
+ }
+
+ /**
+ * Get the collision rule.
+ * Notes: only if Mode = 0 or 2. always, pushOtherTeams, pushOwnTeam, never.
+ * @return The current collision rule
+ */
+ public String getCollisionRule() {
+ return handle.getStrings().read(2);
+ }
+
+ /**
+ * Sets the collision rule.
+ * @param value - new value.
+ */
+ public void setCollisionRule(String value) {
+ handle.getStrings().write(2, value);
+ }
+
+ /**
+ * Retrieve Players.
+ *
+ * Notes: only if Mode = 0 or 3 or 4. Players to be added/remove from the
+ * team. Max 40 characters so may be uuid's later
+ *
+ * @return The current Players
+ */
+ @SuppressWarnings("unchecked")
+ public List getPlayers() {
+ return (List) handle.getSpecificModifier(Collection.class)
+ .read(0);
+ }
+
+ /**
+ * Set Players.
+ *
+ * @param value - new value.
+ */
+ public void setPlayers(List value) {
+ handle.getSpecificModifier(Collection.class).write(0, value);
+ }
+
+ /**
+ * Retrieve Mode.
+ *
+ * Notes: if 0 then the team is created. If 1 then the team is removed. If 2
+ * the team team information is updated. If 3 then new players are added to
+ * the team. If 4 then players are removed from the team.
+ *
+ * @return The current Mode
+ */
+ public int getMode() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Mode.
+ *
+ * @param value - new value.
+ */
+ public void setMode(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve pack option data. Pack data is calculated as follows:
+ *
+ *
+ *
+ * int data = 0;
+ * if (team.allowFriendlyFire()) {
+ * data |= 1;
+ * }
+ * if (team.canSeeFriendlyInvisibles()) {
+ * data |= 2;
+ * }
+ *
+ *
+ *
+ * @return The current pack option data
+ */
+ public int getPackOptionData() {
+ return handle.getIntegers().read(1);
+ }
+
+ /**
+ * Set pack option data.
+ *
+ * @param value - new value
+ * @see #getPackOptionData()
+ */
+ public void setPackOptionData(int value) {
+ handle.getIntegers().write(1, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntity.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntity.java
new file mode 100644
index 0000000..414b2a7
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntity.java
@@ -0,0 +1,378 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.UUID;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.ProtocolLibrary;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+import com.comphenix.protocol.injector.PacketConstructor;
+import com.comphenix.protocol.reflect.IntEnum;
+
+public class WrapperPlayServerSpawnEntity extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY;
+
+ private static PacketConstructor entityConstructor;
+
+ /**
+ * Represents the different object types.
+ *
+ * @author Kristian
+ */
+ public static class ObjectTypes extends IntEnum {
+ public static final int BOAT = 1;
+ public static final int ITEM_STACK = 2;
+ public static final int AREA_EFFECT_CLOUD = 3;
+ public static final int MINECART = 10;
+ public static final int ACTIVATED_TNT = 50;
+ public static final int ENDER_CRYSTAL = 51;
+ public static final int TIPPED_ARROW_PROJECTILE = 60;
+ public static final int SNOWBALL_PROJECTILE = 61;
+ public static final int EGG_PROJECTILE = 62;
+ public static final int GHAST_FIREBALL = 63;
+ public static final int BLAZE_FIREBALL = 64;
+ public static final int THROWN_ENDERPEARL = 65;
+ public static final int WITHER_SKULL_PROJECTILE = 66;
+ public static final int SHULKER_BULLET = 67;
+ public static final int FALLING_BLOCK = 70;
+ public static final int ITEM_FRAME = 71;
+ public static final int EYE_OF_ENDER = 72;
+ public static final int THROWN_POTION = 73;
+ public static final int THROWN_EXP_BOTTLE = 75;
+ public static final int FIREWORK_ROCKET = 76;
+ public static final int LEASH_KNOT = 77;
+ public static final int ARMORSTAND = 78;
+ public static final int FISHING_FLOAT = 90;
+ public static final int SPECTRAL_ARROW = 91;
+ public static final int DRAGON_FIREBALL = 93;
+
+ /**
+ * The singleton instance. Can also be retrieved from the parent class.
+ */
+ private static ObjectTypes INSTANCE = new ObjectTypes();
+
+ /**
+ * Retrieve an instance of the object types enum.
+ *
+ * @return Object type enum.
+ */
+ public static ObjectTypes getInstance() {
+ return INSTANCE;
+ }
+ }
+
+ public WrapperPlayServerSpawnEntity() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerSpawnEntity(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ public WrapperPlayServerSpawnEntity(Entity entity, int type, int objectData) {
+ super(fromEntity(entity, type, objectData), TYPE);
+ }
+
+ // Useful constructor
+ private static PacketContainer fromEntity(Entity entity, int type,
+ int objectData) {
+ if (entityConstructor == null)
+ entityConstructor =
+ ProtocolLibrary.getProtocolManager()
+ .createPacketConstructor(TYPE, entity, type,
+ objectData);
+ return entityConstructor.createPacket(entity, type, objectData);
+ }
+
+ /**
+ * Retrieve entity ID of the Object.
+ *
+ * @return The current EID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Retrieve the entity that will be spawned.
+ *
+ * @param world - the current world of the entity.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity that will be spawned.
+ *
+ * @param event - the packet event.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+
+ /**
+ * Set entity ID of the Object.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ public UUID getUniqueId() {
+ return handle.getUUIDs().read(0);
+ }
+
+ public void setUniqueId(UUID value) {
+ handle.getUUIDs().write(0, value);
+ }
+
+ /**
+ * Retrieve the x position of the object.
+ *
+ * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
+ *
+ * @return The current X
+ */
+ public double getX() {
+ return handle.getDoubles().read(0);
+ }
+
+ /**
+ * Set the x position of the object.
+ *
+ * @param value - new value.
+ */
+ public void setX(double value) {
+ handle.getDoubles().write(0, value);
+ }
+
+ /**
+ * Retrieve the y position of the object.
+ *
+ * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
+ *
+ * @return The current y
+ */
+ public double getY() {
+ return handle.getDoubles().read(1);
+ }
+
+ /**
+ * Set the y position of the object.
+ *
+ * @param value - new value.
+ */
+ public void setY(double value) {
+ handle.getDoubles().write(1, value);
+ }
+
+ /**
+ * Retrieve the z position of the object.
+ *
+ * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
+ *
+ * @return The current z
+ */
+ public double getZ() {
+ return handle.getDoubles().read(2);
+ }
+
+ /**
+ * Set the z position of the object.
+ *
+ * @param value - new value.
+ */
+ public void setZ(double value) {
+ handle.getDoubles().write(2, value);
+ }
+
+ /**
+ * Retrieve the optional speed x.
+ *
+ * This is ignored if {@link #getObjectData()} is zero.
+ *
+ * @return The optional speed x.
+ */
+ public double getOptionalSpeedX() {
+ return handle.getIntegers().read(1) / 8000.0D;
+ }
+
+ /**
+ * Set the optional speed x.
+ *
+ * @param value - new value.
+ */
+ public void setOptionalSpeedX(double value) {
+ handle.getIntegers().write(1, (int) (value * 8000.0D));
+ }
+
+ /**
+ * Retrieve the optional speed y.
+ *
+ * This is ignored if {@link #getObjectData()} is zero.
+ *
+ * @return The optional speed y.
+ */
+ public double getOptionalSpeedY() {
+ return handle.getIntegers().read(2) / 8000.0D;
+ }
+
+ /**
+ * Set the optional speed y.
+ *
+ * @param value - new value.
+ */
+ public void setOptionalSpeedY(double value) {
+ handle.getIntegers().write(2, (int) (value * 8000.0D));
+ }
+
+ /**
+ * Retrieve the optional speed z.
+ *
+ * This is ignored if {@link #getObjectData()} is zero.
+ *
+ * @return The optional speed z.
+ */
+ public double getOptionalSpeedZ() {
+ return handle.getIntegers().read(3) / 8000.0D;
+ }
+
+ /**
+ * Set the optional speed z.
+ *
+ * @param value - new value.
+ */
+ public void setOptionalSpeedZ(double value) {
+ handle.getIntegers().write(3, (int) (value * 8000.0D));
+ }
+
+ /**
+ * Retrieve the pitch.
+ *
+ * @return The current pitch.
+ */
+ public float getPitch() {
+ return (handle.getIntegers().read(4) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the pitch.
+ *
+ * @param value - new pitch.
+ */
+ public void setPitch(float value) {
+ handle.getIntegers().write(4, (int) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the yaw.
+ *
+ * @return The current Yaw
+ */
+ public float getYaw() {
+ return (handle.getIntegers().read(5) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the yaw of the object spawned.
+ *
+ * @param value - new yaw.
+ */
+ public void setYaw(float value) {
+ handle.getIntegers().write(5, (int) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the type of object. See {@link ObjectTypes}
+ *
+ * @return The current Type
+ */
+ public int getType() {
+ return handle.getIntegers().read(6);
+ }
+
+ /**
+ * Set the type of object. See {@link ObjectTypes}.
+ *
+ * @param value - new value.
+ */
+ public void setType(int value) {
+ handle.getIntegers().write(6, value);
+ }
+
+ /**
+ * Retrieve object data.
+ *
+ * The content depends on the object type:
+ *
+ *
+ *
Object Type:
+ *
Name:
+ *
Description
+ *
+ *
+ *
ITEM_FRAME
+ *
Orientation
+ *
0-3: South, West, North, East
+ *
+ *
+ *
FALLING_BLOCK
+ *
Block Type
+ *
BlockID | (Metadata << 0xC)
+ *
+ *
+ *
Projectiles
+ *
Entity ID
+ *
The entity ID of the thrower
+ *
+ *
+ *
Splash Potions
+ *
Data Value
+ *
Potion data value.
+ *
+ *
+ *
+ * @return The current object Data
+ */
+ public int getObjectData() {
+ return handle.getIntegers().read(7);
+ }
+
+ /**
+ * Set object Data.
+ *
+ * The content depends on the object type. See {@link #getObjectData()} for
+ * more information.
+ *
+ * @param value - new object data.
+ */
+ public void setObjectData(int value) {
+ handle.getIntegers().write(7, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntityLiving.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntityLiving.java
new file mode 100644
index 0000000..2dda2ff
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntityLiving.java
@@ -0,0 +1,315 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import java.util.UUID;
+
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.ProtocolLibrary;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.events.PacketEvent;
+import com.comphenix.protocol.injector.PacketConstructor;
+import com.comphenix.protocol.wrappers.WrappedDataWatcher;
+
+public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
+ public static final PacketType TYPE =
+ PacketType.Play.Server.SPAWN_ENTITY_LIVING;
+
+ private static PacketConstructor entityConstructor;
+
+ public WrapperPlayServerSpawnEntityLiving() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerSpawnEntityLiving(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ public WrapperPlayServerSpawnEntityLiving(Entity entity) {
+ super(fromEntity(entity), TYPE);
+ }
+
+ // Useful constructor
+ private static PacketContainer fromEntity(Entity entity) {
+ if (entityConstructor == null)
+ entityConstructor =
+ ProtocolLibrary.getProtocolManager()
+ .createPacketConstructor(TYPE, entity);
+ return entityConstructor.createPacket(entity);
+ }
+
+ /**
+ * Retrieve entity ID.
+ *
+ * @return The current EID
+ */
+ public int getEntityID() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Retrieve the entity that will be spawned.
+ *
+ * @param world - the current world of the entity.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(World world) {
+ return handle.getEntityModifier(world).read(0);
+ }
+
+ /**
+ * Retrieve the entity that will be spawned.
+ *
+ * @param event - the packet event.
+ * @return The spawned entity.
+ */
+ public Entity getEntity(PacketEvent event) {
+ return getEntity(event.getPlayer().getWorld());
+ }
+
+ public UUID getUniqueId() {
+ return handle.getUUIDs().read(0);
+ }
+
+ public void setUniqueId(UUID value) {
+ handle.getUUIDs().write(0, value);
+ }
+
+ /**
+ * Set entity ID.
+ *
+ * @param value - new value.
+ */
+ public void setEntityID(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve the type of mob.
+ *
+ * @return The current Type
+ */
+ @SuppressWarnings("deprecation")
+ public EntityType getType() {
+ return EntityType.fromId(handle.getIntegers().read(1));
+ }
+
+ /**
+ * Set the type of mob.
+ *
+ * @param value - new value.
+ */
+ @SuppressWarnings("deprecation")
+ public void setType(EntityType value) {
+ handle.getIntegers().write(1, (int) value.getTypeId());
+ }
+
+ /**
+ * Retrieve the x position of the object.
+ *
+ * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
+ *
+ * @return The current X
+ */
+ public double getX() {
+ return handle.getDoubles().read(0);
+ }
+
+ /**
+ * Set the x position of the object.
+ *
+ * @param value - new value.
+ */
+ public void setX(double value) {
+ handle.getDoubles().write(0, value);
+ }
+
+ /**
+ * Retrieve the y position of the object.
+ *
+ * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
+ *
+ * @return The current y
+ */
+ public double getY() {
+ return handle.getDoubles().read(1);
+ }
+
+ /**
+ * Set the y position of the object.
+ *
+ * @param value - new value.
+ */
+ public void setY(double value) {
+ handle.getDoubles().write(1, value);
+ }
+
+ /**
+ * Retrieve the z position of the object.
+ *
+ * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
+ *
+ * @return The current z
+ */
+ public double getZ() {
+ return handle.getDoubles().read(2);
+ }
+
+ /**
+ * Set the z position of the object.
+ *
+ * @param value - new value.
+ */
+ public void setZ(double value) {
+ handle.getDoubles().write(2, value);
+ }
+
+ /**
+ * Retrieve the yaw.
+ *
+ * @return The current Yaw
+ */
+ public float getYaw() {
+ return (handle.getBytes().read(0) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the yaw of the spawned mob.
+ *
+ * @param value - new yaw.
+ */
+ public void setYaw(float value) {
+ handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the pitch.
+ *
+ * @return The current pitch
+ */
+ public float getPitch() {
+ return (handle.getBytes().read(1) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the pitch of the spawned mob.
+ *
+ * @param value - new pitch.
+ */
+ public void setPitch(float value) {
+ handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the yaw of the mob's head.
+ *
+ * @return The current yaw.
+ */
+ public float getHeadPitch() {
+ return (handle.getBytes().read(2) * 360.F) / 256.0F;
+ }
+
+ /**
+ * Set the yaw of the mob's head.
+ *
+ * @param value - new yaw.
+ */
+ public void setHeadPitch(float value) {
+ handle.getBytes().write(2, (byte) (value * 256.0F / 360.0F));
+ }
+
+ /**
+ * Retrieve the velocity in the x axis.
+ *
+ * @return The current velocity X
+ */
+ public double getVelocityX() {
+ return handle.getIntegers().read(2) / 8000.0D;
+ }
+
+ /**
+ * Set the velocity in the x axis.
+ *
+ * @param value - new value.
+ */
+ public void setVelocityX(double value) {
+ handle.getIntegers().write(2, (int) (value * 8000.0D));
+ }
+
+ /**
+ * Retrieve the velocity in the y axis.
+ *
+ * @return The current velocity y
+ */
+ public double getVelocityY() {
+ return handle.getIntegers().read(3) / 8000.0D;
+ }
+
+ /**
+ * Set the velocity in the y axis.
+ *
+ * @param value - new value.
+ */
+ public void setVelocityY(double value) {
+ handle.getIntegers().write(3, (int) (value * 8000.0D));
+ }
+
+ /**
+ * Retrieve the velocity in the z axis.
+ *
+ * @return The current velocity z
+ */
+ public double getVelocityZ() {
+ return handle.getIntegers().read(4) / 8000.0D;
+ }
+
+ /**
+ * Set the velocity in the z axis.
+ *
+ * @param value - new value.
+ */
+ public void setVelocityZ(double value) {
+ handle.getIntegers().write(4, (int) (value * 8000.0D));
+ }
+
+ /**
+ * Retrieve the data watcher.
+ *
+ * Content varies by mob, see Entities.
+ *
+ * @return The current Metadata
+ */
+/* public WrappedDataWatcher getMetadata() {
+ return handle.getDataWatcherModifier().read(0);
+ }*/
+
+ /**
+ * Set the data watcher.
+ *
+ * @param value - new value.
+ */
+ /*public void setMetadata(WrappedDataWatcher value) {
+ handle.getDataWatcherModifier().write(0, value);
+ }*/
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerStopSound.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerStopSound.java
new file mode 100644
index 0000000..b4ac3ee
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerStopSound.java
@@ -0,0 +1,54 @@
+/**
+ * This file is part of PacketWrapper.
+ * Copyright (C) 2012-2015 Kristian S. Strangeland
+ * Copyright (C) 2015 dmulloy2
+ *
+ * PacketWrapper is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PacketWrapper is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with PacketWrapper. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers;
+import com.comphenix.protocol.wrappers.MinecraftKey;
+
+public class WrapperPlayServerStopSound extends AbstractPacket {
+
+ public static final PacketType TYPE = PacketType.Play.Server.STOP_SOUND;
+
+ public WrapperPlayServerStopSound() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerStopSound(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ public MinecraftKey getSoundEffect() {
+ return handle.getMinecraftKeys().readSafely(0);
+ }
+
+ public void setSoundEffect(MinecraftKey value) {
+ handle.getMinecraftKeys().writeSafely(0, value);
+ }
+
+ public EnumWrappers.SoundCategory getCategory() {
+ return handle.getSoundCategories().readSafely(0);
+ }
+
+ public void setCategory(EnumWrappers.SoundCategory value) {
+ handle.getSoundCategories().writeSafely(0, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerTitle.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerTitle.java
new file mode 100644
index 0000000..0f31de7
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerTitle.java
@@ -0,0 +1,131 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
+import com.comphenix.protocol.wrappers.WrappedChatComponent;
+
+public class WrapperPlayServerTitle extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.TITLE;
+
+ public WrapperPlayServerTitle() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerTitle(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Action.
+ *
+ * @return The current Action
+ */
+ public TitleAction getAction() {
+ return handle.getTitleActions().read(0);
+ }
+
+ /**
+ * Set Action.
+ *
+ * @param value - new value.
+ */
+ public void setAction(TitleAction value) {
+ handle.getTitleActions().write(0, value);
+ }
+
+ /**
+ * Retrieve 0 (TITLE).
+ *
+ * Notes: chat
+ *
+ * @return The current 0 (TITLE)
+ */
+ public WrappedChatComponent getTitle() {
+ return handle.getChatComponents().read(0);
+ }
+
+ /**
+ * Set 0 (TITLE).
+ *
+ * @param value - new value.
+ */
+ public void setTitle(WrappedChatComponent value) {
+ handle.getChatComponents().write(0, value);
+ }
+
+ /**
+ * Retrieve 2 (TIMES).
+ *
+ * Notes: int
+ *
+ * @return The current 2 (TIMES)
+ */
+ public int getFadeIn() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set 2 (TIMES).
+ *
+ * @param value - new value.
+ */
+ public void setFadeIn(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve Stay.
+ *
+ * @return The current Stay
+ */
+ public int getStay() {
+ return handle.getIntegers().read(1);
+ }
+
+ /**
+ * Set Stay.
+ *
+ * @param value - new value.
+ */
+ public void setStay(int value) {
+ handle.getIntegers().write(1, value);
+ }
+
+ /**
+ * Retrieve Fade Out.
+ *
+ * @return The current Fade Out
+ */
+ public int getFadeOut() {
+ return handle.getIntegers().read(2);
+ }
+
+ /**
+ * Set Fade Out.
+ *
+ * @param value - new value.
+ */
+ public void setFadeOut(int value) {
+ handle.getIntegers().write(2, value);
+ }
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerUpdateHealth.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerUpdateHealth.java
new file mode 100644
index 0000000..2a1c48f
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerUpdateHealth.java
@@ -0,0 +1,96 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+
+public class WrapperPlayServerUpdateHealth extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.UPDATE_HEALTH;
+
+ public WrapperPlayServerUpdateHealth() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerUpdateHealth(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Health.
+ *
+ * Notes: 0 or less = dead, 20 = full HP
+ *
+ * @return The current Health
+ */
+ public float getHealth() {
+ return handle.getFloat().read(0);
+ }
+
+ /**
+ * Set Health.
+ *
+ * @param value - new value.
+ */
+ public void setHealth(float value) {
+ handle.getFloat().write(0, value);
+ }
+
+ /**
+ * Retrieve Food.
+ *
+ * Notes: 0 - 20
+ *
+ * @return The current Food
+ */
+ public int getFood() {
+ return handle.getIntegers().read(0);
+ }
+
+ /**
+ * Set Food.
+ *
+ * @param value - new value.
+ */
+ public void setFood(int value) {
+ handle.getIntegers().write(0, value);
+ }
+
+ /**
+ * Retrieve Food Saturation.
+ *
+ * Notes: seems to vary from 0.0 to 5.0 in integer increments
+ *
+ * @return The current Food Saturation
+ */
+ public float getFoodSaturation() {
+ return handle.getFloat().read(1);
+ }
+
+ /**
+ * Set Food Saturation.
+ *
+ * @param value - new value.
+ */
+ public void setFoodSaturation(float value) {
+ handle.getFloat().write(1, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerUpdateTime.java b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerUpdateTime.java
new file mode 100644
index 0000000..49b56ef
--- /dev/null
+++ b/src/main/java/fr/leomelki/com/comphenix/packetwrapper/WrapperPlayServerUpdateTime.java
@@ -0,0 +1,77 @@
+/**
+ * PacketWrapper - ProtocolLib wrappers for Minecraft packets
+ * Copyright (C) dmulloy2
+ * Copyright (C) Kristian S. Strangeland
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package fr.leomelki.com.comphenix.packetwrapper;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.events.PacketContainer;
+
+public class WrapperPlayServerUpdateTime extends AbstractPacket {
+ public static final PacketType TYPE = PacketType.Play.Server.UPDATE_TIME;
+
+ public WrapperPlayServerUpdateTime() {
+ super(new PacketContainer(TYPE), TYPE);
+ handle.getModifier().writeDefaults();
+ }
+
+ public WrapperPlayServerUpdateTime(PacketContainer packet) {
+ super(packet, TYPE);
+ }
+
+ /**
+ * Retrieve Age of the world.
+ *
+ * Notes: in ticks; not changed by server commands
+ *
+ * @return The current Age of the world
+ */
+ public long getAgeOfTheWorld() {
+ return handle.getLongs().read(0);
+ }
+
+ /**
+ * Set Age of the world.
+ *
+ * @param value - new value.
+ */
+ public void setAgeOfTheWorld(long value) {
+ handle.getLongs().write(0, value);
+ }
+
+ /**
+ * Retrieve Time of day.
+ *
+ * Notes: the world (or region) time, in ticks. If negative the sun will
+ * stop moving at the Math.abs of the time
+ *
+ * @return The current Time of day
+ */
+ public long getTimeOfDay() {
+ return handle.getLongs().read(1);
+ }
+
+ /**
+ * Set Time of day.
+ *
+ * @param value - new value.
+ */
+ public void setTimeOfDay(long value) {
+ handle.getLongs().write(1, value);
+ }
+
+}
diff --git a/src/main/java/fr/leomelki/loupgarou/MainLg.java b/src/main/java/fr/leomelki/loupgarou/MainLg.java
new file mode 100644
index 0000000..8ce4dff
--- /dev/null
+++ b/src/main/java/fr/leomelki/loupgarou/MainLg.java
@@ -0,0 +1,414 @@
+package fr.leomelki.loupgarou;
+
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import com.comphenix.protocol.PacketType;
+import com.comphenix.protocol.ProtocolLibrary;
+import com.comphenix.protocol.ProtocolManager;
+import com.comphenix.protocol.events.ListenerPriority;
+import com.comphenix.protocol.events.PacketAdapter;
+import com.comphenix.protocol.events.PacketEvent;
+import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
+import com.comphenix.protocol.wrappers.PlayerInfoData;
+import com.comphenix.protocol.wrappers.WrappedChatComponent;
+
+import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityEquipment;
+import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerNamedSoundEffect;
+import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerPlayerInfo;
+import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
+import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerUpdateHealth;
+import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerUpdateTime;
+import fr.leomelki.loupgarou.classes.LGGame;
+import fr.leomelki.loupgarou.classes.LGPlayer;
+import fr.leomelki.loupgarou.classes.LGWinType;
+import fr.leomelki.loupgarou.events.LGSkinLoadEvent;
+import fr.leomelki.loupgarou.events.LGUpdatePrefixEvent;
+import fr.leomelki.loupgarou.listeners.CancelListener;
+import fr.leomelki.loupgarou.listeners.ChatListener;
+import fr.leomelki.loupgarou.listeners.JoinListener;
+import fr.leomelki.loupgarou.listeners.LoupGarouListener;
+import fr.leomelki.loupgarou.listeners.VoteListener;
+import fr.leomelki.loupgarou.roles.RAnge;
+import fr.leomelki.loupgarou.roles.RAssassin;
+import fr.leomelki.loupgarou.roles.RBouffon;
+import fr.leomelki.loupgarou.roles.RChaperonRouge;
+import fr.leomelki.loupgarou.roles.RChasseur;
+import fr.leomelki.loupgarou.roles.RChienLoup;
+import fr.leomelki.loupgarou.roles.RCorbeau;
+import fr.leomelki.loupgarou.roles.RCupidon;
+import fr.leomelki.loupgarou.roles.RDetective;
+import fr.leomelki.loupgarou.roles.RDictateur;
+import fr.leomelki.loupgarou.roles.REnfantSauvage;
+import fr.leomelki.loupgarou.roles.RFaucheur;
+import fr.leomelki.loupgarou.roles.RGarde;
+import fr.leomelki.loupgarou.roles.RGrandMechantLoup;
+import fr.leomelki.loupgarou.roles.RLoupGarou;
+import fr.leomelki.loupgarou.roles.RLoupGarouBlanc;
+import fr.leomelki.loupgarou.roles.RLoupGarouNoir;
+import fr.leomelki.loupgarou.roles.RMedium;
+import fr.leomelki.loupgarou.roles.RPetiteFille;
+import fr.leomelki.loupgarou.roles.RPirate;
+import fr.leomelki.loupgarou.roles.RPretre;
+import fr.leomelki.loupgarou.roles.RPyromane;
+import fr.leomelki.loupgarou.roles.RSorciere;
+import fr.leomelki.loupgarou.roles.RSurvivant;
+import fr.leomelki.loupgarou.roles.RVillageois;
+import fr.leomelki.loupgarou.roles.RVoyante;
+import fr.leomelki.loupgarou.roles.Role;
+import lombok.Getter;
+import lombok.Setter;
+
+public class MainLg extends JavaPlugin{
+ private static MainLg instance;
+ @Getter private HashMap> roles = new HashMap>();
+ @Getter private static String prefix = ""/*"§7[§9Loup-Garou§7] "*/;
+
+ @Getter @Setter private LGGame currentGame;//Because for now, only one game will be playable on one server (flemme)
+
+ @Override
+ public void onEnable() {
+ // Audio4WebPlugin.getMain().unRegisterPackets();
+ instance = this;
+ loadRoles();
+ if(!new File(getDataFolder(), "config.yml").exists()) {//Créer la config
+ FileConfiguration config = getConfig();
+ config.set("spawns", new ArrayList>());
+ for(String role : roles.keySet())//Nombre de participant pour chaque rôle
+ config.set("role."+role, 1);
+ saveConfig();
+ }
+ loadConfig();
+ Bukkit.getConsoleSender().sendMessage("/");
+ Bukkit.getPluginManager().registerEvents(new JoinListener(), this);
+ Bukkit.getPluginManager().registerEvents(new CancelListener(), this);
+ Bukkit.getPluginManager().registerEvents(new VoteListener(), this);
+ Bukkit.getPluginManager().registerEvents(new ChatListener(), this);
+ Bukkit.getPluginManager().registerEvents(new LoupGarouListener(), this);
+
+ for(Player player : Bukkit.getOnlinePlayers())
+ Bukkit.getPluginManager().callEvent(new PlayerJoinEvent(player, "is connected"));
+
+ ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
+ protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.UPDATE_TIME) {
+ @Override
+ public void onPacketSending(PacketEvent event) {
+ // if (event.getPacketType() == PacketType.Play.Server.UPDATE_TIME) {
+ WrapperPlayServerUpdateTime time = new WrapperPlayServerUpdateTime(event.getPacket());
+ LGPlayer lgp = LGPlayer.thePlayer(event.getPlayer());
+ if(lgp.getGame() != null && lgp.getGame().getTime() != time.getTimeOfDay())
+ event.setCancelled(true);
+ // }
+ }
+ }
+ );
+ //Éviter que les gens s'entendent quand ils se sélectionnent et qu'ils sont trop proche
+ protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.NAMED_SOUND_EFFECT) {
+ @Override
+ public void onPacketSending(PacketEvent event) {
+ WrapperPlayServerNamedSoundEffect sound = new WrapperPlayServerNamedSoundEffect(event.getPacket());
+ if(sound.getSoundEffect() == Sound.ENTITY_PLAYER_ATTACK_NODAMAGE)
+ event.setCancelled(true);
+ }
+ }
+ );
+ protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.PLAYER_INFO) {
+ @Override
+ public void onPacketSending(PacketEvent event) {
+ // if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {
+ LGPlayer player = LGPlayer.thePlayer(event.getPlayer());
+ WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event.getPacket());
+ ArrayList datas = new ArrayList();
+ for(PlayerInfoData data : info.getData()) {
+ LGPlayer lgp = LGPlayer.thePlayer(Bukkit.getPlayer(data.getProfile().getUUID()));
+ if(player.getGame() != null && player.getGame() == lgp.getGame()) {
+ LGUpdatePrefixEvent evt2 = new LGUpdatePrefixEvent(player.getGame(), lgp, player, "");
+ WrappedChatComponent displayName = data.getDisplayName();
+ Bukkit.getPluginManager().callEvent(evt2);
+ if(evt2.getPrefix().length() > 0) {
+ try {
+ if(displayName != null) {
+ JSONObject obj = (JSONObject) new JSONParser().parse(displayName.getJson());
+ displayName = WrappedChatComponent.fromText(evt2.getPrefix()+obj.get("text"));
+ } else
+ displayName = WrappedChatComponent.fromText(evt2.getPrefix()+data.getProfile().getName());
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ }
+ LGSkinLoadEvent evt = new LGSkinLoadEvent(lgp.getGame(), lgp, player, data.getProfile());
+ Bukkit.getPluginManager().callEvent(evt);
+ datas.add(new PlayerInfoData(evt.getProfile(), data.getLatency(), data.getGameMode(), displayName));
+ }else
+ datas.add(data);
+ }
+ info.setData(datas);
+ // }
+ }
+ });
+ protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.UPDATE_HEALTH) {
+ @Override
+ public void onPacketSending(PacketEvent event) {
+ // if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {
+ LGPlayer player = LGPlayer.thePlayer(event.getPlayer());
+ if(player.getGame() != null && player.getGame().isStarted()) {
+ WrapperPlayServerUpdateHealth health = new WrapperPlayServerUpdateHealth(event.getPacket());
+ health.setFood(6);
+ }
+ // }
+ }
+ });
+ protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.SCOREBOARD_TEAM) {
+ @Override
+ public void onPacketSending(PacketEvent event) {
+ LGPlayer player = LGPlayer.thePlayer(event.getPlayer());
+ WrapperPlayServerScoreboardTeam team = new WrapperPlayServerScoreboardTeam(event.getPacket());
+ team.setColor(ChatColor.WHITE);
+ Player other = Bukkit.getPlayer(team.getName());
+ if(other == null)return;
+ LGPlayer lgp = LGPlayer.thePlayer(other);
+ if(player.getGame() != null && player.getGame() == lgp.getGame()) {
+ LGUpdatePrefixEvent evt2 = new LGUpdatePrefixEvent(player.getGame(), lgp, player, "");
+ Bukkit.getPluginManager().callEvent(evt2);
+ if(evt2.getPrefix().length() > 0)
+ team.setPrefix(WrappedChatComponent.fromText(evt2.getPrefix()));
+ else
+ team.setPrefix(WrappedChatComponent.fromText("§f"));
+ }
+ }
+ });
+ protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.ENTITY_EQUIPMENT) {
+ @Override
+ public void onPacketSending(PacketEvent event) {
+ // if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {
+ LGPlayer player = LGPlayer.thePlayer(event.getPlayer());
+ if(player.getGame() != null) {
+ WrapperPlayServerEntityEquipment equip = new WrapperPlayServerEntityEquipment(event.getPacket());
+ if(equip.getSlot() == ItemSlot.OFFHAND && equip.getEntityID() != player.getPlayer().getEntityId())
+ equip.setItem(new ItemStack(Material.AIR));
+ }
+ // }
+ }
+ });
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if(label.equalsIgnoreCase("lg")) {
+ if(!sender.hasPermission("loupgarou.admin")) {
+ sender.sendMessage(prefix+"§4Erreur: Vous n'avez pas la permission...");
+ return true;
+ }
+ if(args.length >= 1) {
+ if(args[0].equalsIgnoreCase("addspawn")) {
+ Player player = (Player)sender;
+ Location loc = player.getLocation();
+ List