Reformat code
This commit is contained in:
parent
53f1508a01
commit
20b545b93d
108 changed files with 10123 additions and 9809 deletions
2
pom.xml
2
pom.xml
|
@ -1,4 +1,4 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.leomelki</groupId>
|
||||
|
|
|
@ -2,30 +2,29 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public abstract class AbstractPacket {
|
||||
// The packet we will be modifying
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,30 +2,30 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class WrapperPlayServerChat extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.CHAT;
|
||||
|
||||
|
@ -95,8 +95,7 @@ public class WrapperPlayServerChat extends AbstractPacket {
|
|||
public void setPosition(byte value) {
|
||||
handle.getBytes().writeSafely(0, value);
|
||||
|
||||
if (EnumWrappers.getChatTypeClass() != null)
|
||||
{
|
||||
if (EnumWrappers.getChatTypeClass() != null) {
|
||||
Arrays.stream(ChatType.values()).filter(t -> t.getId() == value).findAny()
|
||||
.ifPresent(t -> handle.getChatTypes().writeSafely(0, t));
|
||||
}
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,28 +2,27 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrapperPlayServerEntity extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY;
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,30 +2,29 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class WrapperPlayServerEntityEquipment extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
|
|
|
@ -2,28 +2,27 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrapperPlayServerEntityLook extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_LOOK;
|
||||
|
|
|
@ -2,31 +2,30 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WrapperPlayServerEntityMetadata extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
|
|
|
@ -2,28 +2,27 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class WrapperPlayServerEntityTeleport extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,32 +2,31 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class WrapperPlayServerNamedEntitySpawn extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
|
|
|
@ -2,27 +2,26 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class WrapperPlayServerNamedSoundEffect extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
|
|
|
@ -2,29 +2,29 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WrapperPlayServerPlayerInfo extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.PLAYER_INFO;
|
||||
|
||||
|
|
|
@ -2,32 +2,35 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class WrapperPlayServerPosition extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.POSITION;
|
||||
private static final Class<?> FLAGS_CLASS = MinecraftReflection
|
||||
.getMinecraftClass("EnumPlayerTeleportFlags",
|
||||
"PacketPlayOutPosition$EnumPlayerTeleportFlags");
|
||||
|
||||
public WrapperPlayServerPosition() {
|
||||
super(new PacketContainer(TYPE), TYPE);
|
||||
|
@ -138,14 +141,6 @@ public class WrapperPlayServerPosition extends AbstractPacket {
|
|||
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<Set<PlayerTeleportFlag>> getFlagsModifier() {
|
||||
return handle.getSets(
|
||||
EnumWrappers.getGenericConverter(FLAGS_CLASS, PlayerTeleportFlag.class));
|
||||
|
@ -158,4 +153,8 @@ public class WrapperPlayServerPosition extends AbstractPacket {
|
|||
public void setFlags(Set<PlayerTeleportFlag> value) {
|
||||
getFlagsModifier().write(0, value);
|
||||
}
|
||||
|
||||
public enum PlayerTeleportFlag {
|
||||
X, Y, Z, Y_ROT, X_ROT
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,28 +2,27 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.WorldType;
|
||||
|
||||
public class WrapperPlayServerRespawn extends AbstractPacket {
|
||||
public static final PacketType TYPE = PacketType.Play.Server.RESPAWN;
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
@ -36,23 +36,6 @@ public class WrapperPlayServerScoreboardObjective extends AbstractPacket {
|
|||
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.
|
||||
* <p>
|
||||
|
@ -138,4 +121,21 @@ public class WrapperPlayServerScoreboardObjective extends AbstractPacket {
|
|||
public enum HealthDisplay {
|
||||
INTEGER, HEARTS
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,33 +2,32 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class WrapperPlayServerScoreboardTeam extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
PacketType.Play.Server.SCOREBOARD_TEAM;
|
||||
|
@ -42,25 +41,6 @@ public class WrapperPlayServerScoreboardTeam extends AbstractPacket {
|
|||
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.
|
||||
* <p>
|
||||
|
@ -276,4 +256,23 @@ public class WrapperPlayServerScoreboardTeam extends AbstractPacket {
|
|||
public void setPackOptionData(int value) {
|
||||
handle.getIntegers().write(1, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,86 +2,38 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
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 final 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();
|
||||
|
@ -115,6 +67,15 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
|||
return handle.getIntegers().read(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set entity ID of the Object.
|
||||
*
|
||||
* @param value - new value.
|
||||
*/
|
||||
public void setEntityID(int value) {
|
||||
handle.getIntegers().write(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the entity that will be spawned.
|
||||
*
|
||||
|
@ -135,15 +96,6 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
|||
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);
|
||||
}
|
||||
|
@ -375,4 +327,51 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
|||
public void setObjectData(int value) {
|
||||
handle.getIntegers().write(7, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 final ObjectTypes INSTANCE = new ObjectTypes();
|
||||
|
||||
/**
|
||||
* Retrieve an instance of the object types enum.
|
||||
*
|
||||
* @return Object type enum.
|
||||
*/
|
||||
public static ObjectTypes getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,33 +2,32 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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 org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
|
||||
public static final PacketType TYPE =
|
||||
|
@ -67,6 +66,15 @@ public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
|
|||
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 that will be spawned.
|
||||
*
|
||||
|
@ -95,15 +103,6 @@ public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* This file is part of PacketWrapper.
|
||||
* Copyright (C) 2012-2015 Kristian S. Strangeland
|
||||
* Copyright (C) 2015 dmulloy2
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with PacketWrapper. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
|
||||
* Copyright (C) dmulloy2 <http://dmulloy2.net>
|
||||
* Copyright (C) Kristian S. Strangeland
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
|
@ -1,18 +1,26 @@
|
|||
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 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.*;
|
||||
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.*;
|
||||
import fr.leomelki.loupgarou.roles.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
@ -25,71 +33,26 @@ 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.RChasseurDeVampire;
|
||||
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.RMontreurDOurs;
|
||||
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.RVampire;
|
||||
import fr.leomelki.loupgarou.roles.RVillageois;
|
||||
import fr.leomelki.loupgarou.roles.RVoyante;
|
||||
import fr.leomelki.loupgarou.roles.Role;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
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;
|
||||
|
||||
public class MainLg extends JavaPlugin {
|
||||
@Getter
|
||||
private static final String prefix = ""/*"§7[§9Loup-Garou§7] "*/;
|
||||
private static MainLg instance;
|
||||
@Getter private final HashMap<String, Constructor<? extends Role>> roles = new HashMap<>();
|
||||
@Getter private static final String prefix = ""/*"§7[§9Loup-Garou§7] "*/;
|
||||
@Getter
|
||||
private final HashMap<String, Constructor<? extends Role>> roles = new HashMap<>();
|
||||
@Getter
|
||||
@Setter
|
||||
private LGGame currentGame;//Because for now, only one game will be playable on one server (flemme)
|
||||
|
||||
@Getter @Setter private LGGame currentGame;//Because for now, only one game will be playable on one server (flemme)
|
||||
public static MainLg getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -324,7 +287,9 @@ public class MainLg extends JavaPlugin{
|
|||
return true;
|
||||
} else
|
||||
role = (String) array[i];
|
||||
}catch(Exception err) {sender.sendMessage(prefix+"§4Erreur: §cCeci n'est pas un nombre");}
|
||||
} catch (Exception err) {
|
||||
sender.sendMessage(prefix + "§4Erreur: §cCeci n'est pas un nombre");
|
||||
}
|
||||
else
|
||||
role = args[2];
|
||||
|
||||
|
@ -365,6 +330,7 @@ public class MainLg extends JavaPlugin{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
if (!sender.hasPermission("loupgarou.admin"))
|
||||
|
@ -382,6 +348,7 @@ public class MainLg extends JavaPlugin{
|
|||
return getStartingList(args[0], "addSpawn", "end", "start", "nextNight", "nextDay", "reloadConfig", "roles", "joinAll", "reloadPacks");
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
|
||||
private List<String> getStartingList(String startsWith, String... list) {
|
||||
startsWith = startsWith.toLowerCase();
|
||||
ArrayList<String> returnlist = new ArrayList<>();
|
||||
|
@ -392,19 +359,19 @@ public class MainLg extends JavaPlugin{
|
|||
returnlist.add(s);
|
||||
return returnlist;
|
||||
}
|
||||
|
||||
public void loadConfig() {
|
||||
int players = 0;
|
||||
for (String role : roles.keySet())
|
||||
players += getConfig().getInt("role." + role);
|
||||
currentGame = new LGGame(this, players);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
ProtocolLibrary.getProtocolManager().removePacketListeners(this);
|
||||
}
|
||||
public static MainLg getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void loadRoles() {
|
||||
try {
|
||||
roles.put("LoupGarou", RLoupGarou.class.getConstructor(LGGame.class));
|
||||
|
|
|
@ -6,8 +6,11 @@ import lombok.RequiredArgsConstructor;
|
|||
|
||||
@RequiredArgsConstructor
|
||||
public class IndexedRole {
|
||||
@Getter private final Role role;
|
||||
@Getter private int number = 1;
|
||||
@Getter
|
||||
private final Role role;
|
||||
@Getter
|
||||
private int number = 1;
|
||||
|
||||
public void increase() {
|
||||
number++;
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package fr.leomelki.loupgarou.classes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import fr.leomelki.loupgarou.events.LGCustomItemChangeEvent;
|
||||
import fr.leomelki.loupgarou.roles.Role;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
import fr.leomelki.loupgarou.events.LGCustomItemChangeEvent;
|
||||
import fr.leomelki.loupgarou.roles.Role;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class LGCustomItems {
|
||||
static final HashMap<Class<? extends Role>, HashMap<String, Material>> mappings = new HashMap<>();
|
||||
|
||||
static {
|
||||
JSONParser parser = new JSONParser();
|
||||
try {
|
||||
|
@ -41,6 +41,7 @@ public class LGCustomItems {
|
|||
public static Material getItem(Role role) {
|
||||
return mappings.get(role.getClass()).get("");
|
||||
}
|
||||
|
||||
public static Material getItem(LGPlayer player, ArrayList<String> constraints) {
|
||||
Bukkit.getPluginManager().callEvent(new LGCustomItemChangeEvent(player.getGame(), player, constraints));
|
||||
|
||||
|
@ -53,6 +54,7 @@ public class LGCustomItems {
|
|||
sj.add(s);
|
||||
return mapps.get(sj.toString());
|
||||
}
|
||||
|
||||
public static Material getItem(LGPlayer player) {
|
||||
return getItem(player, new ArrayList<>());
|
||||
}
|
||||
|
@ -73,7 +75,8 @@ public class LGCustomItems {
|
|||
MAYOR("maire"),
|
||||
VAMPIRE_INFECTE("vampire-infecte"),
|
||||
DEAD("mort");
|
||||
@Getter private final String name;
|
||||
@Getter
|
||||
private final String name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package fr.leomelki.loupgarou.classes;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedSignedProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
@ -10,5 +9,6 @@ public enum LGCustomSkin {
|
|||
VILLAGER(new WrappedSignedProperty("textures", "eyJ0aW1lc3RhbXAiOjE1NzcwNTE5MDIyNDgsInByb2ZpbGVJZCI6Ijc4YWQzMjI2YmJkYTQwMGZiNTExMjAzMDY4MGNjN2I0IiwicHJvZmlsZU5hbWUiOiJTaHl0b29zIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzYxZmE3Y2UyYmQxMmJmMzBjOTcxZjUwZjJiMGIyYTZkZWUyOWU4MWM5MmJkZmFhZjFkMDJlNjM5YzJiZjMzNWEiLCJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifX19fQ==", "Qk3Gh9IbVwqIvzv0t3vNrGhzW1ejvKls/7n1vqC7UozJYFotECsBla3DFrxrLvTVsCMAQ3cXGq9QjfFF1U/q0NYvWNXVPbrIxX6LH2t2SI9F1+WLQ7LGYwwABzMGDClJXkuUr0yEOPtCwoTgvinVkCZmNRrN0VDAwd+ie3LCnuBjo3iabjA4dxXLE59mnvCGKo5pGdqThn/KikUldvYGBjpQa+X5F+jQhj7TucZ8t0VJ2t05TkKHS+bcIcmCD+UorGG1N5uiNkQe89BMXZKQEebydtnH5RT8efqHfYT5aZY/6IJKTMqIeclcWy2f6LIfRb97AeifOPPHTfjl2Q6wjvOdnvGuNa+Xk6biNM7cLz1KQzdMM0CvkiZZ9XtFul5+PXEobx2IjIEcrStZX0fl/NZid+kf+2RXbPKx4Z+07q5PbeCzr1UD3DMWlrEMQQppIB26uhPLS9mh3IvM9bhx+vIbByr1Z5p3aT4J2mbhwwmf/LUpNUyMn6oHt19zX6cEcSbncGBLgEHOrUXgxdK/Sm4lJKA1Mr3M0o8CSt7ldLc6mA4oBPMK/OV/c0rwb1W2GWOUyw99dNT/jFSFXyyjCHW0+5FkAW+H+8Y0dZ3U4UWaAmX4JNfdxiih97eTBKEvIC8V48hiFS/UV9A9LBVPNkca/4lanh/jNZ7VRQ+/vU8=")),
|
||||
MAYOR(new WrappedSignedProperty("textures", "eyJ0aW1lc3RhbXAiOjE1NzcwNTE4NjcxMDcsInByb2ZpbGVJZCI6Ijc4YWQzMjI2YmJkYTQwMGZiNTExMjAzMDY4MGNjN2I0IiwicHJvZmlsZU5hbWUiOiJTaHl0b29zIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzUzYTk5NjljMjU0YWRkYmZkNjdmNDJlZmMxODNkZDg5ZWE3ZTliOGE4NDY2YWNkOWZhMWZmMTYzMTQ0MTczMDMifX19", "fq/bN78Y70k2clbfg6sLRuj4mhvDTz58fKI3/0XvzJH/bQF5Mf+jcFwpXJN+ZiupMaHFHI1bBQ20lrzlGvtrCoYu9+Bx4otin0NQVxc3pOEewikzYub64niMPq8irGJrS2pB1B2Uym5F+/wX8TXOkySyAo1r3lzh6qmfe1bpNG7gcc9+ulYdAbnyhxTko3d8poBsjLnadpo0/rBNMkNIua9ryIE3WHW+DOxLwpLpd3TAB15RnA3/qvyBlqQBny1M24ccjmzxjiUbzF66EtTC+BRs3eS8or/vxvdmi70e295gMoERZJ5pFukxe9LB0IEg9cLHwuEl7OC8FcuLUQFnm1EVPjfSlSF36Sd+iVwjFE/x1zINKYsDHwF/TM+yAWOv+PwgGxgQj1C97VaWEkrHXDMEzgxi8DAcPbDBwcyBZXRgOJTHRSH2ATvGDqeT7iQbPrP+y0YNFUDXyBrKYgscgA7bMtBgWvW75SdvcIhqQEVe/jMivMWDuvwhQF4lUGonHc0B5wi1216fqTypEcOeaa5ab+siNssFXpEsaFP9l+1o6uYjNbBpptEAsIlKbnjDaVSkCTvsW7ICaPAZcZCavpyST5MYTv6C7n/bwl3nfzzI7U1LYvYi/gMEHKWfNwLs4T+4VQ3xZD0DpkEQgDrax+Wt182K6OvrAcOcCAfWySo=\",\"name")),
|
||||
WEREWOLF(new WrappedSignedProperty("textures", "eyJ0aW1lc3RhbXAiOjE1NzcwNTE3NTU1NDgsInByb2ZpbGVJZCI6Ijc4YWQzMjI2YmJkYTQwMGZiNTExMjAzMDY4MGNjN2I0IiwicHJvZmlsZU5hbWUiOiJTaHl0b29zIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U1NGE2MmRhNGMzZTI5YjdiZWM4ZTI0YzhiNTAyZGZjNWNmMTNmYjc0NjFhN2I5YWY2NGY2Yjc1ZGFhNmE2MDUifX19", "k0cT/rDkBW3QMqSavKc0Nbu39ft3i0TLLhxLht7LKKuA+Q+amCmzw/NZjZRtJc/R87uyl2B+JHLTWTOcbDQX2bE7fIzEvYFhvbb2dasxeYA03wBwZ+OuJlhhxWSSX2NoAI6gEGcWQ3k4xcf+xhtD+5eddjL5k+Dv/kVW6qCWprfPSmd4+KQ0aVwyBkbheyTBSaamtpPj24UYM1EL9POF/PrbmiipfSthp7DkwL4PprW+0Z3pzFMgY46Ay2VJYxa+Q6q3IlYqSXMkjJccf3msyOTGe3JSiQc1Du/djffvLIoyjybolNb5rQ/OrnYIEtnqCuXstJJd3J+a6F8w4DkS2ZMVY4lvidb4coVeFmm9Nk/afqqyG99TDmvZNFWFSeaaxGSWeZPkneAEFuFQXn76sl1xdtXkgXmP8H0yvs9SwA9UnGoldIay6D1HzAOGo3n3stV6188K0ucey1KsH6nNlZfT2hnqvI1lfKD67oQNFfl4kDLRwArfZJUmcQOJh9/fk6/bJvgYuElEkGy++0FkuKKkRJHPIW5+kPZguNo96cAAGxhSH3IIscLoxDdn53iSnngpKttWfG6ccI/XMGTWp4wCq6IC2IBZcmKEqK+fN5dVbR4tn79pXlQ2Yyk7kvXaZjdVHrKC1Buw1gjjC1EvmiJjTRZVHPYlCTkfy+hdqzE="));
|
||||
@Getter private final WrappedSignedProperty property;
|
||||
@Getter
|
||||
private final WrappedSignedProperty property;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
package fr.leomelki.loupgarou.classes;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.*;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems.LGCustomItemsConstraints;
|
||||
import fr.leomelki.loupgarou.classes.chat.LGChat;
|
||||
import fr.leomelki.loupgarou.events.*;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.roles.*;
|
||||
import fr.leomelki.loupgarou.scoreboard.CustomScoreboard;
|
||||
import fr.leomelki.loupgarou.utils.MultipleValueMap;
|
||||
import fr.leomelki.loupgarou.utils.VariousUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
|
@ -23,73 +32,56 @@ import org.bukkit.potion.PotionEffectType;
|
|||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerChat;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityDestroy;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerExperience;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerPlayerInfo;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardObjective;
|
||||
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.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems.LGCustomItemsConstraints;
|
||||
import fr.leomelki.loupgarou.classes.chat.LGChat;
|
||||
import fr.leomelki.loupgarou.events.LGCustomItemChangeEvent;
|
||||
import fr.leomelki.loupgarou.events.LGDayEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGDayStartEvent;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameJoinEvent;
|
||||
import fr.leomelki.loupgarou.events.LGMayorVoteEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightPlayerPreKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightStart;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerGotKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGPreDayStartEvent;
|
||||
import fr.leomelki.loupgarou.events.LGRoleTurnEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGSkinLoadEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVoteEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVoteLeaderChange;
|
||||
import fr.leomelki.loupgarou.roles.RChienLoupLG;
|
||||
import fr.leomelki.loupgarou.roles.REnfantSauvageLG;
|
||||
import fr.leomelki.loupgarou.roles.Role;
|
||||
import fr.leomelki.loupgarou.roles.RoleType;
|
||||
import fr.leomelki.loupgarou.roles.RoleWinType;
|
||||
import fr.leomelki.loupgarou.scoreboard.CustomScoreboard;
|
||||
import fr.leomelki.loupgarou.utils.MultipleValueMap;
|
||||
import fr.leomelki.loupgarou.utils.VariousUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class LGGame implements Listener {
|
||||
private static final boolean autoStart = false;
|
||||
|
||||
|
||||
@Getter private final SecureRandom random = new SecureRandom();
|
||||
@Getter private final int maxPlayers;
|
||||
@Getter private final ArrayList<LGPlayer> inGame = new ArrayList<>();
|
||||
@Getter private final ArrayList<Role> roles = new ArrayList<>();
|
||||
@Getter private final MainLg plugin;
|
||||
|
||||
@Getter private boolean started;
|
||||
@Getter private int night = 0;
|
||||
@Getter
|
||||
private final SecureRandom random = new SecureRandom();
|
||||
@Getter
|
||||
private final int maxPlayers;
|
||||
@Getter
|
||||
private final ArrayList<LGPlayer> inGame = new ArrayList<>();
|
||||
@Getter
|
||||
private final ArrayList<Role> roles = new ArrayList<>();
|
||||
@Getter
|
||||
private final MainLg plugin;
|
||||
@Getter
|
||||
private final HashMap<Integer, LGPlayer> placements = new HashMap<>();
|
||||
@Getter
|
||||
private final LGChat spectatorChat = new LGChat((sender, message) -> "§7" + sender.getName() + " §6» §f" + message);
|
||||
@Getter
|
||||
private final LGChat dayChat = new LGChat((sender, message) -> "§e" + sender.getName() + " §6» §f" + message);
|
||||
@Getter
|
||||
private final MultipleValueMap<LGPlayerKilledEvent.Reason, LGPlayer> deaths = new MultipleValueMap<>();
|
||||
@Getter
|
||||
public long time = 0;
|
||||
@Setter
|
||||
boolean ended;
|
||||
boolean isPeopleVote = false;
|
||||
@Getter
|
||||
private boolean started;
|
||||
@Getter
|
||||
private int night = 0;
|
||||
private BukkitTask startingTask;
|
||||
@Getter @Setter private int waitTicks;
|
||||
@Getter private boolean day;
|
||||
@Getter public long time = 0;
|
||||
@Getter private final HashMap<Integer, LGPlayer> placements = new HashMap<>();
|
||||
|
||||
@Getter private final LGChat spectatorChat = new LGChat((sender, message) -> "§7"+sender.getName()+" §6» §f"+message);
|
||||
@Getter private final LGChat dayChat = new LGChat((sender, message) -> "§e"+sender.getName()+" §6» §f"+message);
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private int waitTicks;
|
||||
@Getter
|
||||
private boolean day;
|
||||
private BukkitTask waitTask;
|
||||
@Getter
|
||||
private LGPlayer mayor;
|
||||
@Getter
|
||||
private LGVote vote;
|
||||
|
||||
public LGGame(MainLg mainLg, int maxPlayers) {
|
||||
this.plugin = mainLg;
|
||||
|
@ -97,9 +89,6 @@ public class LGGame implements Listener{
|
|||
Bukkit.getPluginManager().registerEvents(this, MainLg.getInstance());
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final MultipleValueMap<LGPlayerKilledEvent.Reason, LGPlayer> deaths = new MultipleValueMap<>();
|
||||
|
||||
public void sendActionBarMessage(String msg) {
|
||||
WrapperPlayServerChat chat = new WrapperPlayServerChat();
|
||||
chat.setPosition((byte) 2);
|
||||
|
@ -107,19 +96,21 @@ public class LGGame implements Listener{
|
|||
for (LGPlayer lgp : inGame)
|
||||
chat.sendPacket(lgp.getPlayer());
|
||||
}
|
||||
|
||||
public void broadcastMessage(String msg) {
|
||||
for (LGPlayer lgp : inGame)
|
||||
lgp.sendMessage(msg);
|
||||
}
|
||||
|
||||
public void broadcastSpacer() {
|
||||
for (LGPlayer lgp : inGame)
|
||||
lgp.getPlayer().sendMessage("\n");
|
||||
}
|
||||
|
||||
private BukkitTask waitTask;
|
||||
public void wait(int seconds, Runnable callback) {
|
||||
wait(seconds, callback, null);
|
||||
}
|
||||
|
||||
public void wait(int seconds, Runnable callback, TextGenerator generator) {
|
||||
cancelWait();
|
||||
waitTicks = seconds * 20;
|
||||
|
@ -145,6 +136,7 @@ public class LGGame implements Listener{
|
|||
}
|
||||
}.runTaskTimer(MainLg.getInstance(), 0, 1);
|
||||
}
|
||||
|
||||
public void wait(int seconds, int initialSeconds, Runnable callback, TextGenerator generator) {
|
||||
cancelWait();
|
||||
waitTicks = seconds * 20;
|
||||
|
@ -171,9 +163,6 @@ public class LGGame implements Listener{
|
|||
}.runTaskTimer(MainLg.getInstance(), 0, 1);
|
||||
}
|
||||
|
||||
public interface TextGenerator{
|
||||
String generate(LGPlayer player, int secondsLeft);
|
||||
}
|
||||
public void cancelWait() {
|
||||
if (waitTask != null) {
|
||||
waitTask.cancel();
|
||||
|
@ -189,6 +178,7 @@ public class LGGame implements Listener{
|
|||
deaths.put(event.getReason(), player);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryToJoin(LGPlayer lgp) {
|
||||
if (ended) return false;
|
||||
if (!started && inGame.size() < maxPlayers) {//Si la partie n'a pas démarrée et qu'il reste de la place
|
||||
|
@ -259,6 +249,7 @@ public class LGGame implements Listener{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void checkLeave() {
|
||||
if (startingTask != null) {
|
||||
startingTask.cancel();
|
||||
|
@ -266,6 +257,7 @@ public class LGGame implements Listener{
|
|||
broadcastMessage("§c§oUn joueur s'est déconnecté. Le décompte de lancement a donc été arrêté.");
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStart() {
|
||||
if (!isStarted())
|
||||
if (inGame.size() == maxPlayers) {//Il faut que la partie soit totalement remplie pour qu'elle démarre car sinon, tous les rôles ne seraient pas distribués
|
||||
|
@ -277,6 +269,7 @@ public class LGGame implements Listener{
|
|||
if (startingTask == null) {
|
||||
startingTask = new BukkitRunnable() {
|
||||
int timeLeft = 5 + 1;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (--timeLeft == 0)//start
|
||||
|
@ -291,6 +284,7 @@ public class LGGame implements Listener{
|
|||
broadcastMessage("§c§oLe démarrage de la partie a été annulé car une personne l'a quittée !");
|
||||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (startingTask != null) {
|
||||
startingTask.cancel();
|
||||
|
@ -331,6 +325,7 @@ public class LGGame implements Listener{
|
|||
new BukkitRunnable() {
|
||||
int timeLeft = 5 * 2;
|
||||
int actualRole = getRoles().size();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (--timeLeft == 0) {
|
||||
|
@ -359,6 +354,7 @@ public class LGGame implements Listener{
|
|||
}
|
||||
}.runTaskTimer(MainLg.getInstance(), 0, 4);
|
||||
}
|
||||
|
||||
private void _start() {
|
||||
broadcastMessage("§8§oDébut de la partie...");
|
||||
//Give roles...
|
||||
|
@ -386,6 +382,7 @@ public class LGGame implements Listener{
|
|||
//Start day one
|
||||
nextNight(10);
|
||||
}
|
||||
|
||||
public void updateRoleScoreboard() {
|
||||
HashMap<Role, IndexedRole> roles_ = new HashMap<>();
|
||||
for (LGPlayer lgp : getAlive())
|
||||
|
@ -411,6 +408,7 @@ public class LGGame implements Listener{
|
|||
for (LGPlayer lgp : getInGame())
|
||||
lgp.getScoreboard().getLine(i).delete();
|
||||
}
|
||||
|
||||
public List<LGPlayer> getAlive() {
|
||||
ArrayList<LGPlayer> alive = new ArrayList<>();
|
||||
for (LGPlayer lgp : getInGame())
|
||||
|
@ -422,6 +420,7 @@ public class LGGame implements Listener{
|
|||
public void nextNight() {
|
||||
nextNight(5);
|
||||
}
|
||||
|
||||
public void nextNight(int timeout) {
|
||||
if (ended) return;
|
||||
LGNightStart event = new LGNightStart(this);
|
||||
|
@ -452,6 +451,7 @@ public class LGGame implements Listener{
|
|||
|
||||
new BukkitRunnable() {
|
||||
int timeoutLeft = timeout * 20;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (--timeoutLeft <= 20 + 20 * 2) {
|
||||
|
@ -467,6 +467,7 @@ public class LGGame implements Listener{
|
|||
}.runTaskTimer(MainLg.getInstance(), 1, 1);
|
||||
LGGame.this.wait(timeout, this::nextNight_, (player, secondsLeft) -> "§6La nuit va tomber dans §e" + secondsLeft + " seconde" + (secondsLeft > 1 ? "s" : ""));
|
||||
}
|
||||
|
||||
private void nextNight_() {
|
||||
if (ended) return;
|
||||
night++;
|
||||
|
@ -515,6 +516,7 @@ public class LGGame implements Listener{
|
|||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
public boolean kill(LGPlayer killed, Reason reason, boolean endGame) {
|
||||
if (killed.getPlayer() != null) {
|
||||
killed.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 1, false, false));
|
||||
|
@ -578,8 +580,6 @@ public class LGGame implements Listener{
|
|||
e.getWinners().add(lgp);
|
||||
}
|
||||
|
||||
@Setter
|
||||
boolean ended;
|
||||
public void endGame(LGWinType winType) {
|
||||
if (ended) return;
|
||||
|
||||
|
@ -612,8 +612,7 @@ public class LGGame implements Listener{
|
|||
|
||||
if (winners.contains(lgp))
|
||||
lgp.sendTitle("§a§lVictoire !", "§6Vous avez gagné la partie.", 200);
|
||||
else
|
||||
if(winType == LGWinType.EQUAL || winType == LGWinType.NONE)
|
||||
else if (winType == LGWinType.EQUAL || winType == LGWinType.NONE)
|
||||
lgp.sendTitle("§7§lÉgalité", "§8Personne n'a gagné...", 200);
|
||||
else
|
||||
lgp.sendTitle("§c§lDéfaite...", "§4Vous avez perdu la partie.", 200);
|
||||
|
@ -648,9 +647,11 @@ public class LGGame implements Listener{
|
|||
return "§6Démarrage d'une nouvelle partie dans §e"+secondsLeft+" seconde"+(secondsLeft > 1 ? "s" : "");
|
||||
});*/
|
||||
}
|
||||
|
||||
public boolean mayorKilled() {
|
||||
return getMayor() != null && getMayor().isDead();
|
||||
}
|
||||
|
||||
public void endNight() {
|
||||
if (ended) return;
|
||||
broadcastSpacer();
|
||||
|
@ -697,6 +698,7 @@ public class LGGame implements Listener{
|
|||
|
||||
new BukkitRunnable() {
|
||||
int timeoutLeft = 20;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (timeoutLeft++ > 20) {
|
||||
|
@ -720,6 +722,7 @@ public class LGGame implements Listener{
|
|||
startDay();
|
||||
}
|
||||
}
|
||||
|
||||
public void startDay() {
|
||||
for (LGPlayer player : getInGame())
|
||||
player.joinChat(dayChat, player.isDead());
|
||||
|
@ -760,7 +763,6 @@ public class LGGame implements Listener{
|
|||
}.runTaskLater(MainLg.getInstance(), 40);
|
||||
|
||||
}
|
||||
@Getter private LGPlayer mayor;
|
||||
|
||||
public void setMayor(LGPlayer mayor) {
|
||||
LGPlayer latestMayor = this.mayor;
|
||||
|
@ -786,6 +788,7 @@ public class LGGame implements Listener{
|
|||
e.getConstraints().add(LGCustomItemsConstraints.DEAD.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onSkinChange(LGSkinLoadEvent e) {
|
||||
if (e.getGame() == this) {
|
||||
|
@ -815,8 +818,7 @@ public class LGGame implements Listener{
|
|||
});
|
||||
}
|
||||
}
|
||||
@Getter private LGVote vote;
|
||||
boolean isPeopleVote = false;
|
||||
|
||||
@EventHandler
|
||||
public void leaderChange(LGVoteLeaderChange e) {
|
||||
if (isPeopleVote && vote != null && e.getGame() == this) {
|
||||
|
@ -829,6 +831,7 @@ public class LGGame implements Listener{
|
|||
VariousUtils.setWarning(player.getPlayer(), true);
|
||||
}
|
||||
}
|
||||
|
||||
private void peopleVote() {
|
||||
if (ended) return;
|
||||
LGVoteEvent event = new LGVoteEvent(this);
|
||||
|
@ -857,6 +860,7 @@ public class LGGame implements Listener{
|
|||
public boolean checkEndGame() {
|
||||
return checkEndGame(true);
|
||||
}
|
||||
|
||||
public boolean checkEndGame(boolean doEndGame) {
|
||||
int goodGuy = 0, badGuy = 0, solo = 0, vampires = 0;
|
||||
for (LGPlayer lgp : getAlive())
|
||||
|
@ -884,4 +888,8 @@ public class LGGame implements Listener{
|
|||
endGame(event.getWinType());
|
||||
return event.getWinType() != LGWinType.NONE;
|
||||
}
|
||||
|
||||
public interface TextGenerator {
|
||||
String generate(LGPlayer player, int secondsLeft);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
package fr.leomelki.loupgarou.classes;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
|
||||
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerChat;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerPlayerInfo;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
|
||||
|
@ -37,10 +26,59 @@ import net.minecraft.server.v1_15_R1.DimensionManager;
|
|||
import net.minecraft.server.v1_15_R1.EnumGamemode;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutRespawn;
|
||||
import net.minecraft.server.v1_15_R1.WorldType;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class LGPlayer {
|
||||
private static final HashMap<Player, LGPlayer> cachedPlayers = new HashMap<>();
|
||||
private final MainLg plugin;
|
||||
@Getter
|
||||
private final VariableCache cache = new VariableCache();
|
||||
public boolean canSelectDead;
|
||||
@Getter
|
||||
boolean muted;
|
||||
long lastChoose;
|
||||
@Getter
|
||||
@Setter
|
||||
private int place;
|
||||
@Getter
|
||||
private Player player;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean dead;
|
||||
@Setter
|
||||
@Getter
|
||||
private Role role;
|
||||
private LGChooseCallback chooseCallback;
|
||||
private List<LGPlayer> blacklistedChoice = new ArrayList<>(0);
|
||||
@Getter
|
||||
@Setter
|
||||
private LGGame game;
|
||||
@Getter
|
||||
@Setter
|
||||
private String latestObjective;
|
||||
@Getter
|
||||
private CustomScoreboard scoreboard;
|
||||
private String name;
|
||||
@Getter
|
||||
private LGChat chat;
|
||||
|
||||
public LGPlayer(MainLg mainLg, Player player) {
|
||||
this.plugin = mainLg;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public LGPlayer(MainLg mainLg, String name) {
|
||||
this.plugin = mainLg;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static LGPlayer thePlayer(MainLg plugin, Player player) {
|
||||
LGPlayer lgp = cachedPlayers.get(player);
|
||||
|
@ -50,27 +88,10 @@ public class LGPlayer {
|
|||
}
|
||||
return lgp;
|
||||
}
|
||||
|
||||
public static LGPlayer removePlayer(Player player) {
|
||||
return cachedPlayers.remove(player);//.remove();
|
||||
}
|
||||
@Getter @Setter private int place;
|
||||
@Getter private Player player;
|
||||
@Getter @Setter private boolean dead;
|
||||
@Setter @Getter private Role role;
|
||||
private LGChooseCallback chooseCallback;
|
||||
private List<LGPlayer> blacklistedChoice = new ArrayList<>(0);
|
||||
@Getter private final VariableCache cache = new VariableCache();
|
||||
@Getter @Setter private LGGame game;
|
||||
@Getter @Setter private String latestObjective;
|
||||
@Getter private CustomScoreboard scoreboard;
|
||||
public LGPlayer(MainLg mainLg, Player player) {
|
||||
this.plugin = mainLg;
|
||||
this.player = player;
|
||||
}
|
||||
public LGPlayer(MainLg mainLg, String name) {
|
||||
this.plugin = mainLg;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setScoreboard(CustomScoreboard scoreboard) {
|
||||
if (player != null) {
|
||||
|
@ -92,10 +113,12 @@ public class LGPlayer {
|
|||
chat.sendPacket(getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(String msg) {
|
||||
if (this.player != null)
|
||||
getPlayer().sendMessage(MainLg.getPrefix() + msg);
|
||||
}
|
||||
|
||||
public void sendTitle(String title, String subTitle, int stay) {
|
||||
if (this.player != null) {
|
||||
WrapperPlayServerTitle titlePacket = new WrapperPlayServerTitle();
|
||||
|
@ -116,15 +139,15 @@ public class LGPlayer {
|
|||
titlePacket.sendPacket(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
this.player = null;
|
||||
}
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return player != null ? getPlayer().getName() : name;
|
||||
}
|
||||
|
||||
|
||||
public boolean join(LGGame game) {
|
||||
if (getPlayer().getGameMode() == GameMode.SPECTATOR) {
|
||||
sendMessage("§cÉtant en mode spectateur, vous ne rejoignez pas la partie !");
|
||||
|
@ -139,20 +162,18 @@ public class LGPlayer {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void choose(LGChooseCallback callback, LGPlayer... blacklisted) {
|
||||
this.blacklistedChoice = blacklisted == null ? new ArrayList<>(0) : Arrays.asList(blacklisted);
|
||||
this.chooseCallback = callback;
|
||||
//sendMessage("§7§oTIP: Regardez un joueur et tapez le afin de le sélectionner.");
|
||||
}
|
||||
|
||||
public void stopChoosing() {
|
||||
this.blacklistedChoice = null;
|
||||
this.chooseCallback = null;
|
||||
}
|
||||
|
||||
public interface LGChooseCallback{
|
||||
void callback(LGPlayer choosen);
|
||||
}
|
||||
|
||||
public void showView() {
|
||||
if (getGame() != null && player != null)
|
||||
for (LGPlayer lgp : getGame().getAlive())
|
||||
|
@ -201,6 +222,7 @@ public class LGPlayer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideView() {
|
||||
if (getGame() != null && player != null) {
|
||||
WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo();
|
||||
|
@ -237,6 +259,7 @@ public class LGPlayer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateOwnSkin() {
|
||||
if (player != null) {
|
||||
//On change son skin avec un packet de PlayerInfo (dans le tab)
|
||||
|
@ -263,7 +286,7 @@ public class LGPlayer {
|
|||
//Et c'est bon, le joueur se voit avec un nouveau skin avec quasiment aucun problème visible à l'écran :D
|
||||
}
|
||||
}
|
||||
public boolean canSelectDead;
|
||||
|
||||
public LGPlayer getPlayerOnCursor(List<LGPlayer> list) {
|
||||
Location loc = getPlayer().getLocation();
|
||||
if (loc.getPitch() > 60)
|
||||
|
@ -285,6 +308,7 @@ public class LGPlayer {
|
|||
public RoleType getRoleType() {
|
||||
return this.getCache().getBoolean("vampire") ? RoleType.VAMPIRE : this.getCache().getBoolean("infected") ? RoleType.LOUP_GAROU : getRole().getType(this);
|
||||
}
|
||||
|
||||
public RoleWinType getRoleWinType() {
|
||||
return this.getCache().getBoolean("vampire") ? RoleWinType.VAMPIRE : this.getCache().getBoolean("infected") ? RoleWinType.LOUP_GAROU : getRole().getWinType(this);
|
||||
}
|
||||
|
@ -293,14 +317,10 @@ public class LGPlayer {
|
|||
return !this.getCache().getBoolean("vampire");
|
||||
}
|
||||
|
||||
@Getter
|
||||
boolean muted;
|
||||
|
||||
public void die() {
|
||||
setMuted();
|
||||
}
|
||||
|
||||
|
||||
private void setMuted() {
|
||||
if (player != null)
|
||||
for (LGPlayer lgp : getGame().getInGame())
|
||||
|
@ -308,21 +328,23 @@ public class LGPlayer {
|
|||
lgp.getPlayer().hidePlayer(plugin, getPlayer());
|
||||
muted = true;
|
||||
}
|
||||
|
||||
public void resetMuted() {
|
||||
muted = false;
|
||||
}
|
||||
|
||||
@Getter private LGChat chat;
|
||||
|
||||
public void joinChat(LGChat chat, LGChatCallback callback) {
|
||||
joinChat(chat, callback, false);
|
||||
}
|
||||
|
||||
public void joinChat(LGChat chat) {
|
||||
joinChat(chat, null, false);
|
||||
}
|
||||
|
||||
public void joinChat(LGChat chat, boolean muted) {
|
||||
joinChat(chat, null, muted);
|
||||
}
|
||||
|
||||
public void joinChat(LGChat chat, LGChatCallback callback, boolean muted) {
|
||||
if (this.chat != null && !muted)
|
||||
this.chat.leave(this);
|
||||
|
@ -350,12 +372,12 @@ public class LGPlayer {
|
|||
if (player != null)
|
||||
getPlayer().playSound(getPlayer().getLocation(), sound.getSound(), (float) volume, 1);
|
||||
}
|
||||
|
||||
public void stopAudio(LGSound sound) {
|
||||
if (player != null)
|
||||
getPlayer().stopSound(sound.getSound());
|
||||
}
|
||||
|
||||
long lastChoose;
|
||||
public void chooseAction() {
|
||||
long now = System.currentTimeMillis();
|
||||
if (lastChoose + 200 < now) {
|
||||
|
@ -369,4 +391,8 @@ public class LGPlayer {
|
|||
public String toString() {
|
||||
return super.toString() + " (" + getName() + ")";
|
||||
}
|
||||
|
||||
public interface LGChooseCallback {
|
||||
void callback(LGPlayer choosen);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package fr.leomelki.loupgarou.classes;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public enum LGSound {
|
||||
KILL(Sound.ENTITY_BLAZE_DEATH),
|
||||
|
@ -13,6 +12,7 @@ public enum LGSound {
|
|||
|
||||
@Getter
|
||||
final Sound sound;
|
||||
|
||||
LGSound(Sound sound) {
|
||||
this.sound = sound;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
package fr.leomelki.loupgarou.classes;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.*;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame.TextGenerator;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer.LGChooseCallback;
|
||||
import fr.leomelki.loupgarou.events.LGVoteLeaderChange;
|
||||
import fr.leomelki.loupgarou.utils.VariousUtils;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -13,83 +21,16 @@ import org.bukkit.entity.EntityType;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityDestroy;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityEquipment;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityLook;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityMetadata;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerSpawnEntityLiving;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame.TextGenerator;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer.LGChooseCallback;
|
||||
import fr.leomelki.loupgarou.events.LGVoteLeaderChange;
|
||||
import fr.leomelki.loupgarou.utils.VariousUtils;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.server.v1_15_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_15_R1.DataWatcherObject;
|
||||
import net.minecraft.server.v1_15_R1.Entity;
|
||||
import net.minecraft.server.v1_15_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_15_R1.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityMetadata;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class LGVote {
|
||||
@Getter LGPlayer choosen;
|
||||
private int timeout;
|
||||
private final int initialTimeout;
|
||||
private final int littleTimeout;
|
||||
private Runnable callback;
|
||||
private final LGGame game;
|
||||
@Getter private List<LGPlayer> participants, viewers;
|
||||
private final TextGenerator generator;
|
||||
@Getter private final HashMap<LGPlayer, List<LGPlayer>> votes = new HashMap<>();
|
||||
private int votesSize = 0;
|
||||
private LGPlayer mayor;
|
||||
private ArrayList<LGPlayer> latestTop = new ArrayList<>(), blacklisted = new ArrayList<>();
|
||||
private final boolean randomIfEqual;
|
||||
@Getter private boolean mayorVote;
|
||||
private boolean ended;
|
||||
public LGVote(int timeout, int littleTimeout, LGGame game, boolean positiveVote, boolean randomIfEqual, TextGenerator generator) {
|
||||
this.littleTimeout = littleTimeout;
|
||||
this.initialTimeout = timeout;
|
||||
this.timeout = timeout;
|
||||
this.game = game;
|
||||
this.generator = generator;
|
||||
this.randomIfEqual = randomIfEqual;
|
||||
}
|
||||
public void start(List<LGPlayer> participants, List<LGPlayer> viewers, Runnable callback) {
|
||||
this.callback = callback;
|
||||
this.participants = participants;
|
||||
this.viewers = viewers;
|
||||
game.wait(timeout, this::end, generator);
|
||||
for(LGPlayer player : participants)
|
||||
player.choose(getChooseCallback(player));
|
||||
}
|
||||
public void start(List<LGPlayer> participants, List<LGPlayer> viewers, Runnable callback, ArrayList<LGPlayer> blacklisted) {
|
||||
this.callback = callback;
|
||||
this.participants = participants;
|
||||
this.viewers = viewers;
|
||||
game.wait(timeout, this::end, generator);
|
||||
for(LGPlayer player : participants)
|
||||
player.choose(getChooseCallback(player));
|
||||
this.blacklisted = blacklisted;
|
||||
}
|
||||
public void start(List<LGPlayer> participants, List<LGPlayer> viewers, Runnable callback, LGPlayer mayor) {
|
||||
this.callback = callback;
|
||||
this.participants = participants;
|
||||
this.viewers = viewers;
|
||||
this.mayor = mayor;
|
||||
game.wait(timeout, this::end, generator);
|
||||
for(LGPlayer player : participants)
|
||||
player.choose(getChooseCallback(player));
|
||||
}
|
||||
private static final EntityArmorStand eas = new EntityArmorStand(((CraftWorld) Bukkit.getWorlds().get(0)).getHandle(), 0, 0, 0);
|
||||
private static DataWatcherObject<Optional<IChatBaseComponent>> az;
|
||||
private static DataWatcherObject<Boolean> aA;
|
||||
private static DataWatcherObject<Byte> T;
|
||||
private static final EntityArmorStand eas = new EntityArmorStand(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle(), 0, 0, 0);
|
||||
|
||||
static {
|
||||
try {
|
||||
Field f = Entity.class.getDeclaredField("az");
|
||||
|
@ -105,6 +46,70 @@ public class LGVote {
|
|||
err.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
final WrappedDataWatcherObject invisible = new WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
|
||||
final WrappedDataWatcherObject noGravity = new WrappedDataWatcherObject(5, WrappedDataWatcher.Registry.get(Boolean.class));
|
||||
private final int initialTimeout;
|
||||
private final int littleTimeout;
|
||||
private final LGGame game;
|
||||
private final TextGenerator generator;
|
||||
@Getter
|
||||
private final HashMap<LGPlayer, List<LGPlayer>> votes = new HashMap<>();
|
||||
private final boolean randomIfEqual;
|
||||
@Getter
|
||||
LGPlayer choosen;
|
||||
WrappedDataWatcherObject customNameVisible = new WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class));
|
||||
WrappedDataWatcherObject customName = new WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.get(IChatBaseComponent.class));
|
||||
WrappedDataWatcherObject item = new WrappedDataWatcherObject(7, WrappedDataWatcher.Registry.get(net.minecraft.server.v1_15_R1.ItemStack.class));
|
||||
private int timeout;
|
||||
private Runnable callback;
|
||||
@Getter
|
||||
private List<LGPlayer> participants, viewers;
|
||||
private int votesSize = 0;
|
||||
private LGPlayer mayor;
|
||||
private ArrayList<LGPlayer> latestTop = new ArrayList<>(), blacklisted = new ArrayList<>();
|
||||
@Getter
|
||||
private boolean mayorVote;
|
||||
private boolean ended;
|
||||
|
||||
public LGVote(int timeout, int littleTimeout, LGGame game, boolean positiveVote, boolean randomIfEqual, TextGenerator generator) {
|
||||
this.littleTimeout = littleTimeout;
|
||||
this.initialTimeout = timeout;
|
||||
this.timeout = timeout;
|
||||
this.game = game;
|
||||
this.generator = generator;
|
||||
this.randomIfEqual = randomIfEqual;
|
||||
}
|
||||
|
||||
public void start(List<LGPlayer> participants, List<LGPlayer> viewers, Runnable callback) {
|
||||
this.callback = callback;
|
||||
this.participants = participants;
|
||||
this.viewers = viewers;
|
||||
game.wait(timeout, this::end, generator);
|
||||
for (LGPlayer player : participants)
|
||||
player.choose(getChooseCallback(player));
|
||||
}
|
||||
|
||||
public void start(List<LGPlayer> participants, List<LGPlayer> viewers, Runnable callback, ArrayList<LGPlayer> blacklisted) {
|
||||
this.callback = callback;
|
||||
this.participants = participants;
|
||||
this.viewers = viewers;
|
||||
game.wait(timeout, this::end, generator);
|
||||
for (LGPlayer player : participants)
|
||||
player.choose(getChooseCallback(player));
|
||||
this.blacklisted = blacklisted;
|
||||
}
|
||||
|
||||
public void start(List<LGPlayer> participants, List<LGPlayer> viewers, Runnable callback, LGPlayer mayor) {
|
||||
this.callback = callback;
|
||||
this.participants = participants;
|
||||
this.viewers = viewers;
|
||||
this.mayor = mayor;
|
||||
game.wait(timeout, this::end, generator);
|
||||
for (LGPlayer player : participants)
|
||||
player.choose(getChooseCallback(player));
|
||||
}
|
||||
|
||||
private void end() {
|
||||
ended = true;
|
||||
for (LGPlayer lgp : viewers)
|
||||
|
@ -204,12 +209,14 @@ public class LGVote {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public LGChooseCallback getChooseCallback(LGPlayer who) {
|
||||
return choosen -> {
|
||||
if (choosen != null)
|
||||
vote(who, choosen);
|
||||
};
|
||||
}
|
||||
|
||||
public void vote(LGPlayer voter, LGPlayer voted) {
|
||||
if (blacklisted.contains(voted)) {
|
||||
voter.sendMessage("§cVous ne pouvez pas votre pour §7§l" + voted.getName() + "§c.");
|
||||
|
@ -283,6 +290,7 @@ public class LGVote {
|
|||
private void updateVotes(LGPlayer voted) {
|
||||
updateVotes(voted, false);
|
||||
}
|
||||
|
||||
private void updateVotes(LGPlayer voted, boolean kill) {
|
||||
int entityId = Integer.MIN_VALUE + voted.getPlayer().getEntityId();
|
||||
WrapperPlayServerEntityDestroy destroy = new WrapperPlayServerEntityDestroy();
|
||||
|
@ -368,11 +376,7 @@ public class LGVote {
|
|||
// spawn.sendPacket(lgp.getPlayer());
|
||||
}
|
||||
}
|
||||
final WrappedDataWatcherObject invisible = new WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
|
||||
final WrappedDataWatcherObject noGravity = new WrappedDataWatcherObject(5, WrappedDataWatcher.Registry.get(Boolean.class));
|
||||
WrappedDataWatcherObject customNameVisible = new WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class));
|
||||
WrappedDataWatcherObject customName = new WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.get(IChatBaseComponent.class));
|
||||
WrappedDataWatcherObject item = new WrappedDataWatcherObject(7, WrappedDataWatcher.Registry.get(net.minecraft.server.v1_15_R1.ItemStack.class));
|
||||
|
||||
private void showVoting(LGPlayer to, LGPlayer ofWho) {
|
||||
int entityId = -to.getPlayer().getEntityId();
|
||||
WrapperPlayServerEntityDestroy destroy = new WrapperPlayServerEntityDestroy();
|
||||
|
@ -469,6 +473,7 @@ public class LGVote {
|
|||
}.runTaskLater(MainLg.getInstance(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(LGPlayer killed) {
|
||||
participants.remove(killed);
|
||||
if (!ended) {
|
||||
|
|
|
@ -17,5 +17,6 @@ public enum LGWinType {
|
|||
VAMPIRE("§6§l§oLa partie a été gagnée par les §5§lVampires§6§l§o !"),
|
||||
NONE("§4Erreur: §cpersonne n'a gagné la partie.");
|
||||
|
||||
@Getter private final String message;
|
||||
@Getter
|
||||
private final String message;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
package fr.leomelki.loupgarou.classes.chat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class LGChat {
|
||||
@Getter private final HashMap<LGPlayer, LGChatCallback> viewers = new HashMap<>();
|
||||
@Getter private final LGChatCallback defaultCallback;
|
||||
|
||||
public interface LGChatCallback{
|
||||
String receive(LGPlayer sender, String message);
|
||||
default String send(LGPlayer sender, String message) {return null;}
|
||||
}
|
||||
@Getter
|
||||
private final HashMap<LGPlayer, LGChatCallback> viewers = new HashMap<>();
|
||||
@Getter
|
||||
private final LGChatCallback defaultCallback;
|
||||
|
||||
public void sendMessage(LGPlayer sender, String message) {
|
||||
String sendMessage = getViewers().get(sender).send(sender, message);
|
||||
|
@ -29,7 +26,16 @@ public class LGChat {
|
|||
else
|
||||
getViewers().put(player, callback);
|
||||
}
|
||||
|
||||
public void leave(LGPlayer player) {
|
||||
getViewers().remove(player);
|
||||
}
|
||||
|
||||
public interface LGChatCallback {
|
||||
String receive(LGPlayer sender, String message);
|
||||
|
||||
default String send(LGPlayer sender, String message) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,13 @@ public class LGNoChat extends LGChat{
|
|||
super(null);
|
||||
}
|
||||
|
||||
public void sendMessage(LGPlayer sender, String message) {}
|
||||
public void sendMessage(LGPlayer sender, String message) {
|
||||
}
|
||||
|
||||
public void join(LGPlayer player, LGChatCallback callback) {
|
||||
|
||||
}
|
||||
|
||||
public void leave(LGPlayer player) {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LGCustomItemChangeEvent extends LGEvent {
|
||||
@Getter private final LGPlayer player;
|
||||
@Getter private final List<String> constraints;
|
||||
@Getter
|
||||
private final LGPlayer player;
|
||||
@Getter
|
||||
private final List<String> constraints;
|
||||
|
||||
public LGCustomItemChangeEvent(LGGame game, LGPlayer player, List<String> constraints) {
|
||||
super(game);
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGDayStartEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
public LGDayStartEvent(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Getter @Setter private boolean cancelled;
|
||||
}
|
|
@ -6,10 +6,12 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
public class LGEndCheckEvent extends LGEvent {
|
||||
@Getter
|
||||
@Setter
|
||||
private LGWinType winType;
|
||||
|
||||
public LGEndCheckEvent(LGGame game, LGWinType winType) {
|
||||
super(game);
|
||||
this.winType = winType;
|
||||
}
|
||||
|
||||
@Getter @Setter private LGWinType winType;
|
||||
}
|
|
@ -1,22 +1,23 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class LGEvent extends Event {
|
||||
@Getter final LGGame game;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@Getter
|
||||
final LGGame game;
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LGGameEndEvent extends LGEvent implements Cancellable {
|
||||
@Getter @Setter private boolean cancelled;
|
||||
@Getter private final LGWinType winType;
|
||||
@Getter private final List<LGPlayer> winners;
|
||||
@Getter
|
||||
private final LGWinType winType;
|
||||
@Getter
|
||||
private final List<LGPlayer> winners;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
public LGGameEndEvent(LGGame game, LGWinType winType, List<LGPlayer> winners) {
|
||||
super(game);
|
||||
this.winType = winType;
|
||||
|
|
|
@ -5,11 +5,11 @@ import fr.leomelki.loupgarou.classes.LGPlayer;
|
|||
import lombok.Getter;
|
||||
|
||||
public class LGGameJoinEvent extends LGEvent {
|
||||
@Getter
|
||||
final LGPlayer player;
|
||||
|
||||
public LGGameJoinEvent(LGGame game, LGPlayer player) {
|
||||
super(game);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Getter
|
||||
final LGPlayer player;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGMayorVoteEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
public LGMayorVoteEvent(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Getter @Setter private boolean cancelled;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGNightEndEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
public LGNightEndEvent(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Getter @Setter private boolean cancelled;
|
||||
}
|
|
@ -1,23 +1,25 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGNightPlayerPreKilledEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
private final LGPlayer killed;
|
||||
@Getter
|
||||
@Setter
|
||||
boolean cancelled;
|
||||
@Getter
|
||||
@Setter
|
||||
private Reason reason;
|
||||
public LGNightPlayerPreKilledEvent(LGGame game, LGPlayer killed, Reason reason) {
|
||||
super(game);
|
||||
this.killed = killed;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Getter @Setter boolean cancelled;
|
||||
|
||||
@Getter private final LGPlayer killed;
|
||||
@Getter @Setter private Reason reason;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGNightStart extends LGEvent implements Cancellable {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
boolean cancelled;
|
||||
|
||||
public LGNightStart(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Getter @Setter boolean cancelled;
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@ import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
|||
import lombok.Getter;
|
||||
|
||||
public class LGPlayerGotKilledEvent extends LGEvent {
|
||||
@Getter
|
||||
private final boolean endGame;
|
||||
@Getter
|
||||
private final LGPlayer killed;
|
||||
@Getter
|
||||
private final Reason reason;
|
||||
public LGPlayerGotKilledEvent(LGGame game, LGPlayer killed, Reason reason, boolean endGame) {
|
||||
super(game);
|
||||
this.killed = killed;
|
||||
|
@ -13,8 +19,4 @@ public class LGPlayerGotKilledEvent extends LGEvent {
|
|||
this.endGame = endGame;
|
||||
}
|
||||
|
||||
@Getter private final boolean endGame;
|
||||
@Getter private final LGPlayer killed;
|
||||
@Getter private final Reason reason;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGPlayerKilledEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
@Setter
|
||||
boolean cancelled;
|
||||
@Getter
|
||||
@Setter
|
||||
private LGPlayer killed;
|
||||
@Getter
|
||||
@Setter
|
||||
private Reason reason;
|
||||
public LGPlayerKilledEvent(LGGame game, LGPlayer killed, Reason reason) {
|
||||
super(game);
|
||||
this.killed = killed;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Getter @Setter boolean cancelled;
|
||||
|
||||
@Getter @Setter private LGPlayer killed;
|
||||
@Getter @Setter private Reason reason;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public enum Reason {
|
||||
LOUP_GAROU("§7§l%s§4 est mort pendant la nuit"),
|
||||
|
@ -41,7 +44,8 @@ public class LGPlayerKilledEvent extends LGEvent implements Cancellable{
|
|||
|
||||
DONT_DIE("§7§l%s§4 est mort pour rien");
|
||||
|
||||
@Getter private final String message;
|
||||
@Getter
|
||||
private final String message;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGPreDayStartEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
public LGPreDayStartEvent(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Getter @Setter private boolean cancelled;
|
||||
}
|
|
@ -1,18 +1,20 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGPyromaneGasoilEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
@Getter
|
||||
@Setter
|
||||
private LGPlayer player;
|
||||
public LGPyromaneGasoilEvent(LGGame game, LGPlayer player) {
|
||||
super(game);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Getter @Setter private boolean cancelled;
|
||||
@Getter @Setter private LGPlayer player;
|
||||
}
|
|
@ -5,11 +5,12 @@ import fr.leomelki.loupgarou.roles.Role;
|
|||
import lombok.Getter;
|
||||
|
||||
public class LGRoleTurnEndEvent extends LGEvent {
|
||||
@Getter
|
||||
private final Role newRole, previousRole;
|
||||
|
||||
public LGRoleTurnEndEvent(LGGame game, Role newRole, Role previousRole) {
|
||||
super(game);
|
||||
this.newRole = newRole;
|
||||
this.previousRole = previousRole;
|
||||
}
|
||||
|
||||
@Getter private final Role newRole, previousRole;
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import lombok.Getter;
|
||||
|
@ -9,8 +8,12 @@ import lombok.Setter;
|
|||
|
||||
public class LGSkinLoadEvent extends LGEvent {
|
||||
|
||||
@Getter private final LGPlayer player, to;
|
||||
@Getter @Setter private WrappedGameProfile profile;
|
||||
@Getter
|
||||
private final LGPlayer player, to;
|
||||
@Getter
|
||||
@Setter
|
||||
private WrappedGameProfile profile;
|
||||
|
||||
public LGSkinLoadEvent(LGGame game, LGPlayer player, LGPlayer to, WrappedGameProfile profile) {
|
||||
super(game);
|
||||
this.player = player;
|
||||
|
|
|
@ -6,8 +6,12 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
public class LGUpdatePrefixEvent extends LGEvent {
|
||||
@Getter @Setter private String prefix;
|
||||
@Getter private final LGPlayer player, to;
|
||||
@Getter
|
||||
private final LGPlayer player, to;
|
||||
@Getter
|
||||
@Setter
|
||||
private String prefix;
|
||||
|
||||
public LGUpdatePrefixEvent(LGGame game, LGPlayer player, LGPlayer to, String prefix) {
|
||||
super(game);
|
||||
this.player = player;
|
||||
|
|
|
@ -6,11 +6,14 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
public class LGVampiredEvent extends LGEvent {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean immuned, protect;
|
||||
@Getter
|
||||
@Setter
|
||||
private LGPlayer player;
|
||||
public LGVampiredEvent(LGGame game, LGPlayer player) {
|
||||
super(game);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Getter @Setter private boolean immuned, protect;
|
||||
@Getter @Setter private LGPlayer player;
|
||||
}
|
|
@ -1,15 +1,16 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class LGVoteEvent extends LGEvent implements Cancellable {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
public LGVoteEvent(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Getter @Setter private boolean cancelled;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
package fr.leomelki.loupgarou.events;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGVote;
|
||||
import lombok.Getter;
|
||||
|
||||
public class LGVoteLeaderChange extends LGEvent{
|
||||
import java.util.ArrayList;
|
||||
|
||||
public LGVoteLeaderChange(LGGame game, LGVote vote, ArrayList<LGPlayer> latest, ArrayList<LGPlayer> now) {
|
||||
super(game);
|
||||
this.latest = latest;
|
||||
this.now = now;
|
||||
this.vote = vote;
|
||||
}
|
||||
public class LGVoteLeaderChange extends LGEvent {
|
||||
|
||||
@Getter
|
||||
final ArrayList<LGPlayer> latest;
|
||||
|
@ -22,5 +15,11 @@ public class LGVoteLeaderChange extends LGEvent{
|
|||
final ArrayList<LGPlayer> now;
|
||||
@Getter
|
||||
final LGVote vote;
|
||||
public LGVoteLeaderChange(LGGame game, LGVote vote, ArrayList<LGPlayer> latest, ArrayList<LGPlayer> now) {
|
||||
super(game);
|
||||
this.latest = latest;
|
||||
this.now = now;
|
||||
this.vote = vote;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package fr.leomelki.loupgarou.listeners;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -15,41 +16,46 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
|
||||
public class CancelListener implements Listener {
|
||||
private final MainLg plugin;
|
||||
|
||||
public CancelListener(MainLg mainLg) {
|
||||
this.plugin = mainLg;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPluie(WeatherChangeEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
LGPlayer lgp = LGPlayer.thePlayer(plugin, e.getPlayer());
|
||||
if (lgp.getGame() != null && lgp.getGame().isStarted() && e.getFrom().distanceSquared(e.getTo()) > 0.001)
|
||||
e.setTo(e.getFrom());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFood(FoodLevelChangeEvent e) {
|
||||
e.setFoodLevel(6);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
e.setRespawnLocation(e.getPlayer().getLocation());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerDeathEvent e) {
|
||||
e.setDeathMessage("");
|
||||
e.setKeepInventory(true);
|
||||
}
|
||||
|
||||
/* @EventHandler
|
||||
public void onAchievement(PlayerAchievementAwardedEvent e) {
|
||||
e.setCancelled(true);
|
||||
|
@ -58,15 +64,18 @@ public class CancelListener implements Listener{
|
|||
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDrop(PlayerDropItemEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClickInventory(InventoryClickEvent e) {
|
||||
if (LGPlayer.thePlayer(plugin, (Player) e.getWhoClicked()).getGame() != null)
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClickInventory(PlayerSwapHandItemsEvent e) {
|
||||
if (LGPlayer.thePlayer(plugin, e.getPlayer()).getGame() != null)
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package fr.leomelki.loupgarou.listeners;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
|
||||
public class ChatListener implements Listener {
|
||||
|
||||
private final MainLg plugin;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package fr.leomelki.loupgarou.listeners;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -13,12 +16,7 @@ import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
|||
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import java.util.Collections;
|
||||
|
||||
public class JoinListener implements Listener {
|
||||
private final MainLg plugin;
|
||||
|
@ -65,6 +63,7 @@ public class JoinListener implements Listener{
|
|||
p.removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||
p.setWalkSpeed(0.2f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onResoucePack(PlayerResourcePackStatusEvent e) {
|
||||
if (e.getStatus() == Status.SUCCESSFULLY_LOADED) {
|
||||
|
@ -75,6 +74,7 @@ public class JoinListener implements Listener{
|
|||
} else if (e.getStatus() == Status.DECLINED || e.getStatus() == Status.FAILED_DOWNLOAD)
|
||||
e.getPlayer().kickPlayer(MainLg.getPrefix() + "§cIl vous faut le resourcepack pour jouer ! (" + e.getStatus() + ")");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package fr.leomelki.loupgarou.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ScoreboardAction;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardScore;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
|
||||
import fr.leomelki.loupgarou.events.LGGameJoinEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class LoupGarouListener implements Listener {
|
||||
@EventHandler
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package fr.leomelki.loupgarou.listeners;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationType;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
|
||||
public class VoteListener implements Listener {
|
||||
private final MainLg plugin;
|
||||
|
||||
public VoteListener(MainLg mainLg) {
|
||||
this.plugin = mainLg;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClick(PlayerAnimationEvent e) {
|
||||
if (e.getAnimationType() == PlayerAnimationType.ARM_SWING)
|
||||
LGPlayer.thePlayer(plugin, e.getPlayer()).chooseAction();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBreak(BlockBreakEvent e) {
|
||||
e.setCancelled(true);
|
||||
|
|
|
@ -1,59 +1,68 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGDayEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerGotKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVoteEvent;
|
||||
import fr.leomelki.loupgarou.events.*;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RAnge extends Role {
|
||||
final ArrayList<LGPlayer> winners = new ArrayList<>();
|
||||
boolean vote;
|
||||
int night = 1;
|
||||
|
||||
public RAnge(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§d§lAnge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "de l'" + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes si tu remplis ton objectif";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu es §d§lNeutre§f et tu gagnes si tu remplis ton objectif. Ton objectif est d'être éliminé par le village lors du premier vote de jour. Si tu réussis, tu gagnes la partie. Sinon, tu deviens un §a§lVillageois§f.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVoteStart(LGVoteEvent e) {
|
||||
if (e.getGame() == getGame()) {
|
||||
|
@ -64,7 +73,7 @@ public class RAnge extends Role{
|
|||
lgp.sendMessage("§9§oFais en sorte que les autres votent contre toi !");
|
||||
}
|
||||
}
|
||||
boolean vote;
|
||||
|
||||
@EventHandler
|
||||
public void onDayEnd(LGDayEndEvent e) {
|
||||
if (e.getGame() == getGame()) {
|
||||
|
@ -91,8 +100,7 @@ public class RAnge extends Role{
|
|||
vote = false;
|
||||
}
|
||||
}
|
||||
final ArrayList<LGPlayer> winners = new ArrayList<>();
|
||||
int night = 1;
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(LGPlayerGotKilledEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
|
|
@ -1,56 +1,58 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightPlayerPreKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.*;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGPyromaneGasoilEvent;
|
||||
import fr.leomelki.loupgarou.events.LGRoleTurnEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVampiredEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class RAssassin extends Role {
|
||||
public RAssassin(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.SEUL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§1§lAssassin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "de l'" + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes §7§lSEUL";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes §7§lSEUL§f. Chaque nuit, tu peux choisir un joueur à éliminer. Tu es immunisé contre l'attaque des §c§lLoups§f.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis un joueur à éliminer.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "L'" + getName() + "§9 ne controle plus ses pulsions...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
|
@ -105,6 +107,7 @@ public class RAssassin extends Role{
|
|||
if (e.getPlayer().getRole() == this && e.getPlayer().isRoleActive())
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVampired(LGVampiredEvent e) {
|
||||
if (e.getPlayer().getRole() == this && e.getPlayer().isRoleActive())
|
||||
|
|
|
@ -1,55 +1,65 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class RBouffon extends Role {
|
||||
final ArrayList<LGPlayer> needToPlay = new ArrayList<>();
|
||||
|
||||
public RBouffon(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§d§lBouffon";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes si tu remplis ton objectif";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu es §d§lNeutre§f et tu gagnes si tu remplis ton objectif. Ton objectif est d'être éliminé par le village lors de n’importe quel vote de jour. Si tu réussis, tu gagnes la partie, mais celle-ci continue. Tu pourras tuer l'une des personnes qui t'ont condamné.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis quelqu’un à hanter parmi ceux qui ont voté pour ta mort.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "L'esprit vengeur du " + getName() + "§9 rôde sur le village...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
|
@ -67,19 +77,21 @@ public class RBouffon extends Role{
|
|||
return;
|
||||
}
|
||||
LGPlayer player = players.remove(0);
|
||||
getGame().wait(getTimeout(), ()->{RBouffon.this.onNightTurnTimeout(player);this.run();}, (currentPlayer, secondsLeft)-> currentPlayer == player ? "§9§lC'est à ton tour !" : "§6C'est au tour "+getFriendlyName()+" §6(§e"+secondsLeft+" s§6)");
|
||||
getGame().wait(getTimeout(), () -> {
|
||||
RBouffon.this.onNightTurnTimeout(player);
|
||||
this.run();
|
||||
}, (currentPlayer, secondsLeft) -> currentPlayer == player ? "§9§lC'est à ton tour !" : "§6C'est au tour " + getFriendlyName() + " §6(§e" + secondsLeft + " s§6)");
|
||||
player.sendMessage("§6" + getTask());
|
||||
// player.sendTitle("§6C'est à vous de jouer", "§a"+getTask(), 100);
|
||||
onNightTurn(player, this);
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
public boolean hasPlayersLeft() {
|
||||
return needToPlay.size() > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
needToPlay.remove(player);
|
||||
|
@ -119,8 +131,6 @@ public class RBouffon extends Role{
|
|||
player.stopChoosing();
|
||||
}
|
||||
|
||||
final ArrayList<LGPlayer> needToPlay = new ArrayList<>();
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerKill(LGPlayerKilledEvent e) {
|
||||
if (e.getKilled().getRole() == this && e.getReason() == Reason.VOTE && e.getKilled().isRoleActive()) {
|
||||
|
|
|
@ -1,51 +1,59 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGNightEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightPlayerPreKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGRoleTurnEndEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class RChaperonRouge extends Role {
|
||||
public RChaperonRouge(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lChaperon Rouge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Tant que le §a§lChasseur§f est en vie, tu ne peux pas te faire tuer par les §c§lLoups§f pendant la nuit.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return -1;
|
||||
|
@ -63,6 +71,7 @@ public class RChaperonRouge extends Role{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTour(LGRoleTurnEndEvent e) {
|
||||
if (e.getGame() == getGame()) {
|
||||
|
@ -82,6 +91,7 @@ public class RChaperonRouge extends Role{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDayStart(LGNightEndEvent e) {
|
||||
if (e.getGame() == getGame()) {
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGDayStartEvent;
|
||||
|
@ -12,43 +7,58 @@ import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
|||
import fr.leomelki.loupgarou.events.LGNightStart;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RChasseur extends Role {
|
||||
final ArrayList<LGPlayer> needToPlay = new ArrayList<>();
|
||||
|
||||
public RChasseur(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lChasseur";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. À ta mort, tu dois éliminer un joueur en utilisant ta dernière balle.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Tu dois choisir qui va mourir avec toi.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 choisit qui il va emporter avec lui.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
|
@ -85,13 +95,12 @@ public class RChasseur extends Role{
|
|||
player.stopChoosing();
|
||||
}
|
||||
|
||||
final ArrayList<LGPlayer> needToPlay = new ArrayList<>();
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerKill(LGPlayerKilledEvent e) {
|
||||
if (e.getKilled().getRole() == this && e.getReason() != Reason.DISCONNECTED && e.getKilled().isRoleActive())
|
||||
needToPlay.add(e.getKilled());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDayStart(LGDayStartEvent e) {
|
||||
if (e.getGame() != getGame()) return;
|
||||
|
|
|
@ -8,42 +8,52 @@ public class RChasseurDeVampire extends Role{
|
|||
public RChasseurDeVampire(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lChasseur de Vampires";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu peux traquer un joueur pour découvrir s'il s'agit d'un Vampire. Si c'est le cas, tu le tueras dans son sommeil. Si les §5§lVampires§f te prennent pour cible, tu seras immunisé contre leur attaque, et tu tueras le plus jeune d'entre eux.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis un joueur à pister.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 traque ses proies...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlayersLeft() {
|
||||
for (LGPlayer lgp : getGame().getAlive())
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -15,12 +15,12 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class RChienLoup extends Role {
|
||||
static final ItemStack[] items = new ItemStack[9];
|
||||
|
||||
static {
|
||||
items[3] = new ItemStack(Material.GOLDEN_APPLE);
|
||||
ItemMeta meta = items[3].getItemMeta();
|
||||
|
@ -35,6 +35,10 @@ public class RChienLoup extends Role{
|
|||
items[5].setItemMeta(meta);
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
boolean already;
|
||||
boolean inMenu;
|
||||
|
||||
public RChienLoup(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -68,10 +72,12 @@ public class RChienLoup extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 pourrait trouver de nouveaux amis...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
|
@ -87,9 +93,6 @@ public class RChienLoup extends Role{
|
|||
return super.hasPlayersLeft() && !already;
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
boolean already;
|
||||
|
||||
public void openInventory(Player player) {
|
||||
inMenu = true;
|
||||
Inventory inventory = Bukkit.createInventory(null, 9, "§7Choisis ton camp.");
|
||||
|
@ -97,6 +100,7 @@ public class RChienLoup extends Role{
|
|||
player.closeInventory();
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
already = true;
|
||||
|
@ -104,6 +108,7 @@ public class RChienLoup extends Role{
|
|||
this.callback = callback;
|
||||
openInventory(player.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
closeInventory(player.getPlayer());
|
||||
|
@ -113,12 +118,11 @@ public class RChienLoup extends Role{
|
|||
player.sendMessage("§6Tu rejoins le §a§lVillage.");
|
||||
}
|
||||
|
||||
boolean inMenu;
|
||||
|
||||
private void closeInventory(Player p) {
|
||||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class RChienLoupLG extends Role {
|
||||
public RChienLoupLG(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
for (LGPlayer lgp : getPlayers())
|
||||
|
@ -42,10 +42,12 @@ public class RChienLoupLG extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 pourrait trouver de nouveaux amis...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.LOUP_GAROU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.LOUP_GAROU;
|
||||
|
|
|
@ -1,50 +1,58 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGDayEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVoteEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class RCorbeau extends Role {
|
||||
public RCorbeau(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lCorbeau";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu peux désigner un joueur qui se retrouvera le lendemain avec deux voix contre lui au vote.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Tu peux choisir un joueur qui aura deux votes contre lui.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 s'apprête à diffamer quelqu'un...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.*;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.*;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -13,59 +21,52 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityDestroy;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityEquipment;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityLook;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityMetadata;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerSpawnEntityLiving;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerGotKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGUpdatePrefixEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RCupidon extends Role {
|
||||
final WrappedDataWatcherObject invisible = new WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
|
||||
final WrappedDataWatcherObject noGravity = new WrappedDataWatcherObject(5, WrappedDataWatcher.Registry.get(Boolean.class));
|
||||
|
||||
public RCupidon(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lCupidon";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "de " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Dès le début de la partie, tu dois former un couple de deux joueurs. Leur objectif sera de survivre ensemble, car si l'un d'eux meurt, l'autre se suicidera.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis deux joueurs à mettre en couple.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return getName() + "§9 choisit deux âmes à unir.";
|
||||
|
@ -75,6 +76,7 @@ public class RCupidon extends Role{
|
|||
public int getTimeout() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlayersLeft() {
|
||||
return getGame().getNight() == 1;
|
||||
|
@ -113,6 +115,7 @@ public class RCupidon extends Role{
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setInLove(LGPlayer player1, LGPlayer player2) {
|
||||
player1.getCache().set("inlove", player2);
|
||||
player1.sendMessage("§9Tu tombes amoureux de §7§l" + player2.getName() + "§9, il est " + player2.getRole().getName());
|
||||
|
@ -130,8 +133,6 @@ public class RCupidon extends Role{
|
|||
player2.updatePrefix();
|
||||
}
|
||||
|
||||
final WrappedDataWatcherObject invisible = new WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
|
||||
final WrappedDataWatcherObject noGravity = new WrappedDataWatcherObject(5, WrappedDataWatcher.Registry.get(Boolean.class));
|
||||
protected void sendHead(LGPlayer to, LGPlayer ofWho) {
|
||||
int entityId = Integer.MAX_VALUE - ofWho.getPlayer().getEntityId();
|
||||
WrapperPlayServerSpawnEntityLiving spawn = new WrapperPlayServerSpawnEntityLiving();
|
||||
|
@ -163,7 +164,6 @@ public class RCupidon extends Role{
|
|||
meta.sendPacket(to.getPlayer());
|
||||
|
||||
|
||||
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
|
@ -261,6 +261,7 @@ public class RCupidon extends Role{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onUpdatePrefix(LGUpdatePrefixEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
|
|
@ -7,34 +7,42 @@ public class RDetective extends Role{
|
|||
public RDetective(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lDétective";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu mènes l'enquête sur deux joueurs pour découvrir s'ils font partie du même camp.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis deux joueurs à étudier.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 est sur une enquête...";
|
||||
|
@ -44,6 +52,7 @@ public class RDetective extends Role{
|
|||
public int getTimeout() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
player.showView();
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGDayEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGMayorVoteEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGVoteEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -19,19 +23,15 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGDayEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGMayorVoteEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGVoteEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class RDictateur extends Role {
|
||||
static private final ItemStack[] items = new ItemStack[9];
|
||||
static private final Inventory inventory;
|
||||
|
||||
static {
|
||||
items[3] = new ItemStack(Material.IRON_NUGGET);
|
||||
ItemMeta meta = items[3].getItemMeta();
|
||||
|
@ -51,37 +51,49 @@ public class RDictateur extends Role{
|
|||
inventory = Bukkit.createInventory(null, 9, "§7Veux-tu faire un coup d'état ?");
|
||||
inventory.setContents(items.clone());
|
||||
}
|
||||
|
||||
Runnable callback, run;
|
||||
boolean inMenu = false;
|
||||
|
||||
public RDictateur(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lDictateur";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Une fois dans la partie, tu peux choisir d'effectuer un §e§o§lcoup d'état§f, tu choisiras alors seul qui mourra au jour suivant. Si tu fais le bon choix, tu deviendras §5§lCapitaine§f mais si tu tues un §a§lVillageois§f, tu te suicideras la nuit qui suit.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Veux-tu réaliser un coup d'état ?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 décide s'il veut se dévoiler.";
|
||||
|
@ -97,13 +109,14 @@ public class RDictateur extends Role{
|
|||
player.closeInventory();
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
Runnable callback, run;
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
player.showView();
|
||||
this.callback = callback;
|
||||
openInventory(player.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.hideView();
|
||||
|
@ -113,12 +126,11 @@ public class RDictateur extends Role{
|
|||
player.sendMessage("§7§oVous aurez de nouveau le choix lors de la prochaine nuit.");*/
|
||||
}
|
||||
|
||||
boolean inMenu = false;
|
||||
|
||||
private void closeInventory(Player p) {
|
||||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
@ -187,6 +199,7 @@ public class RDictateur extends Role{
|
|||
if (e.getGame() == getGame())
|
||||
onTurn(e);
|
||||
}
|
||||
|
||||
public void onTurn(Cancellable e) {
|
||||
for (LGPlayer lgp : getPlayers())
|
||||
if (lgp.getCache().getBoolean("just_coup_d_etat") && lgp.isRoleActive())
|
||||
|
@ -237,6 +250,7 @@ public class RDictateur extends Role{
|
|||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
protected void kill(LGPlayer choosen, LGPlayer dicta, Runnable callback) {
|
||||
RoleType roleType = choosen.getRoleType();
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class REnfantSauvage extends Role {
|
||||
private static final Random random = new Random();
|
||||
|
||||
public REnfantSauvage(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -43,10 +44,12 @@ public class REnfantSauvage extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "L'" + getName() + "§9 cherche ses marques...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
|
@ -74,7 +77,7 @@ public class REnfantSauvage extends Role{
|
|||
}
|
||||
}, player);
|
||||
}
|
||||
private static final Random random = new Random();
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.stopChoosing();
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
|
@ -12,6 +11,7 @@ public class REnfantSauvageLG extends Role{
|
|||
public REnfantSauvageLG(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
for (LGPlayer lgp : getPlayers())
|
||||
|
@ -44,10 +44,12 @@ public class REnfantSauvageLG extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "L'" + getName() + "§9 cherche ses marques...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.LOUP_GAROU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.LOUP_GAROU;
|
||||
|
|
|
@ -1,61 +1,69 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class RFaucheur extends Role {
|
||||
private static final Random random = new Random();
|
||||
|
||||
public RFaucheur(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lFaucheur";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Si les §c§lLoups-Garous§f te tuent pendant la nuit, tu emporteras l’un d’entre eux dans ta mort, mais si tu meurs lors du vote du §a§lvillage§f, ce sont tes deux voisins qui en paieront le prix.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onKill(LGPlayerKilledEvent e) {
|
||||
if (e.getKilled().getRole() == this && e.getKilled().isRoleActive()) {
|
||||
|
|
|
@ -1,49 +1,58 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGNightPlayerPreKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGPreDayStartEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVampiredEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class RGarde extends Role {
|
||||
private static final List<Reason> reasonsProtected = Arrays.asList(Reason.LOUP_GAROU, Reason.LOUP_BLANC, Reason.GM_LOUP_GAROU, Reason.ASSASSIN);
|
||||
|
||||
public RGarde(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lGarde";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu peux te protéger toi ou quelqu'un d'autre des attaques §c§lhostiles§f. Tu ne peux pas protéger deux fois d’affilé la même personne.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis un joueur à protéger.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 choisit un joueur à protéger.";
|
||||
|
@ -83,6 +92,7 @@ public class RGarde extends Role{
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.getCache().remove("garde_lastProtected");
|
||||
|
@ -92,8 +102,6 @@ public class RGarde extends Role{
|
|||
//player.sendMessage("§cVous n'avez protégé personne cette nuit.");
|
||||
}
|
||||
|
||||
private static final List<Reason> reasonsProtected = Arrays.asList(Reason.LOUP_GAROU, Reason.LOUP_BLANC, Reason.GM_LOUP_GAROU, Reason.ASSASSIN);
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerKill(LGNightPlayerPreKilledEvent e) {
|
||||
if (e.getGame() == getGame() && reasonsProtected.contains(e.getReason()) && e.getKilled().getCache().getBoolean("garde_protected")) {
|
||||
|
@ -101,11 +109,13 @@ public class RGarde extends Role{
|
|||
e.setReason(Reason.DONT_DIE);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVampired(LGVampiredEvent e) {
|
||||
if (e.getGame() == getGame() && e.getPlayer().getCache().getBoolean("garde_protected"))
|
||||
e.setProtect(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDayStart(LGPreDayStartEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class RGrandMechantLoup extends Role {
|
||||
|
||||
boolean lgDied;
|
||||
Runnable callback;
|
||||
|
||||
public RGrandMechantLoup(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -42,10 +44,12 @@ public class RGrandMechantLoup extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le §c§lGrand Méchant Loup§9 n'en a pas terminé...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.LOUP_GAROU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.LOUP_GAROU;
|
||||
|
@ -60,8 +64,7 @@ public class RGrandMechantLoup extends Role{
|
|||
public boolean hasPlayersLeft() {
|
||||
return super.hasPlayersLeft() && !lgDied;
|
||||
}
|
||||
boolean lgDied;
|
||||
Runnable callback;
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
this.callback = callback;
|
||||
|
@ -87,7 +90,6 @@ public class RGrandMechantLoup extends Role{
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.stopChoosing();
|
||||
|
|
|
@ -1,29 +1,25 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
|
||||
import fr.leomelki.loupgarou.classes.*;
|
||||
import fr.leomelki.loupgarou.classes.chat.LGChat;
|
||||
import fr.leomelki.loupgarou.events.*;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomSkin;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGVote;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.classes.chat.LGChat;
|
||||
import fr.leomelki.loupgarou.events.LGDayEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGSkinLoadEvent;
|
||||
import fr.leomelki.loupgarou.events.LGUpdatePrefixEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
public class RLoupGarou extends Role {
|
||||
|
||||
@Getter
|
||||
private final LGChat chat = new LGChat((sender, message) -> "§c" + sender.getName() + " §6» §f" + message);
|
||||
boolean showSkins = false;
|
||||
LGVote vote;
|
||||
|
||||
public RLoupGarou(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -57,10 +53,12 @@ public class RLoupGarou extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Les §c§lLoups-Garous§9 choisissent leur cible.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.LOUP_GAROU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.LOUP_GAROU;
|
||||
|
@ -71,10 +69,6 @@ public class RLoupGarou extends Role{
|
|||
return 30;
|
||||
}
|
||||
|
||||
@Getter private final LGChat chat = new LGChat((sender, message) -> "§c"+sender.getName()+" §6» §f"+message);
|
||||
|
||||
boolean showSkins = false;
|
||||
LGVote vote;
|
||||
@Override
|
||||
public void join(LGPlayer player, boolean sendMessage) {
|
||||
super.join(player, sendMessage);
|
||||
|
@ -98,6 +92,7 @@ public class RLoupGarou extends Role{
|
|||
callback.run();
|
||||
});
|
||||
}
|
||||
|
||||
private void onNightTurnEnd() {
|
||||
for (LGPlayer lgp : getGame().getAlive())
|
||||
if (lgp.getRoleType() == RoleType.LOUP_GAROU)
|
||||
|
@ -158,6 +153,7 @@ public class RLoupGarou extends Role{
|
|||
e.getProfile().getProperties().put("textures", LGCustomSkin.WEREWOLF.getProperty());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameEnd(LGGameEndEvent e) {
|
||||
if (e.getGame() == getGame() && e.getWinType() == LGWinType.LOUPGAROU)
|
||||
|
@ -181,6 +177,7 @@ public class RLoupGarou extends Role{
|
|||
player.updateOwnSkin();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onNight(LGDayEndEvent e) {
|
||||
if (e.getGame() == getGame()) {
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -10,15 +14,11 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import java.util.Collections;
|
||||
|
||||
public class RLoupGarouBlanc extends Role {
|
||||
private static final ItemStack skip;
|
||||
|
||||
static {
|
||||
skip = new ItemStack(Material.IRON_NUGGET);
|
||||
ItemMeta meta = skip.getItemMeta();
|
||||
|
@ -27,6 +27,9 @@ public class RLoupGarouBlanc extends Role{
|
|||
skip.setItemMeta(meta);
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
RLoupGarou lg;
|
||||
|
||||
public RLoupGarouBlanc(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -60,10 +63,12 @@ public class RLoupGarouBlanc extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 pourrait faire un ravage cette nuit...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.LOUP_GAROU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.SEUL;
|
||||
|
@ -78,7 +83,7 @@ public class RLoupGarouBlanc extends Role{
|
|||
public boolean hasPlayersLeft() {
|
||||
return super.hasPlayersLeft() && getGame().getNight() % 2 == 0;
|
||||
}
|
||||
Runnable callback;
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
this.callback = callback;
|
||||
|
@ -109,6 +114,7 @@ public class RLoupGarouBlanc extends Role{
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClick(PlayerInteractEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
|
@ -122,6 +128,7 @@ public class RLoupGarouBlanc extends Role{
|
|||
callback.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.stopChoosing();
|
||||
|
@ -131,7 +138,6 @@ public class RLoupGarouBlanc extends Role{
|
|||
player.sendMessage("§6Tu n'as tué personne.");
|
||||
}
|
||||
|
||||
RLoupGarou lg;
|
||||
@Override
|
||||
public void join(LGPlayer player, boolean sendMessage) {
|
||||
super.join(player, sendMessage);
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems.LGCustomItemsConstraints;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGVote;
|
||||
import fr.leomelki.loupgarou.events.LGCustomItemChangeEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -16,19 +22,13 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems.LGCustomItemsConstraints;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGVote;
|
||||
import fr.leomelki.loupgarou.events.LGCustomItemChangeEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class RLoupGarouNoir extends Role {
|
||||
static final ItemStack[] items = new ItemStack[9];
|
||||
static final ItemStack[] skip = new ItemStack[9];
|
||||
|
||||
static {
|
||||
items[3] = new ItemStack(Material.IRON_NUGGET);
|
||||
ItemMeta meta = items[3].getItemMeta();
|
||||
|
@ -45,6 +45,11 @@ public class RLoupGarouNoir extends Role{
|
|||
skip[4] = items[3];
|
||||
}
|
||||
|
||||
LGVote vote;
|
||||
Runnable callback;
|
||||
LGPlayer toInfect;
|
||||
boolean inMenu = false;
|
||||
|
||||
public RLoupGarouNoir(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -78,10 +83,12 @@ public class RLoupGarouNoir extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 décide s'il veut infecter sa cible.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.LOUP_GAROU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.LOUP_GAROU;
|
||||
|
@ -97,10 +104,6 @@ public class RLoupGarouNoir extends Role{
|
|||
return super.hasPlayersLeft() && getGame().getDeaths().containsKey(Reason.LOUP_GAROU);
|
||||
}
|
||||
|
||||
LGVote vote;
|
||||
Runnable callback;
|
||||
LGPlayer toInfect;
|
||||
|
||||
public void openInventory(Player player) {
|
||||
inMenu = true;
|
||||
Inventory inventory = Bukkit.createInventory(null, 9, "§7Infecter " + toInfect.getName() + " ?");
|
||||
|
@ -108,6 +111,7 @@ public class RLoupGarouNoir extends Role{
|
|||
player.closeInventory();
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
toInfect = getGame().getDeaths().get(Reason.LOUP_GAROU);
|
||||
|
@ -117,6 +121,7 @@ public class RLoupGarouNoir extends Role{
|
|||
this.callback = callback;
|
||||
openInventory(player.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.getPlayer().getInventory().setItem(8, null);
|
||||
|
@ -128,12 +133,11 @@ public class RLoupGarouNoir extends Role{
|
|||
player.sendMessage("§6Tu n'as rien fait cette nuit.");
|
||||
}
|
||||
|
||||
boolean inMenu = false;
|
||||
|
||||
private void closeInventory(Player p) {
|
||||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
@ -166,6 +170,7 @@ public class RLoupGarouNoir extends Role{
|
|||
callback.run();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDayStart(LGNightEndEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
|
|
@ -1,50 +1,58 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.chat.LGChat;
|
||||
import fr.leomelki.loupgarou.events.LGDayEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPreDayStartEvent;
|
||||
import fr.leomelki.loupgarou.events.LGRoleTurnEndEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class RMedium extends Role {
|
||||
public RMedium(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lMédium";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu peux communiquer avec les morts pour tenter de récupérer des informations cruciales.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return -1;
|
||||
|
@ -75,6 +83,7 @@ public class RMedium extends Role{
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRoleTurn(LGRoleTurnEndEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
|
|
@ -1,60 +1,68 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGDayStartEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class RMontreurDOurs extends Role {
|
||||
private static final Random random = new Random();
|
||||
private int lastNight = -1;
|
||||
|
||||
public RMontreurDOurs(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lMontreur d'Ours";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque matin, ton Ours va renifler tes voisins et grognera si l'un d'eux est hostile aux Villageois.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static final Random random = new Random();
|
||||
private int lastNight = -1;
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onDay(LGDayStartEvent e) {
|
||||
if (e.getGame() == getGame() && getPlayers().size() > 0) {
|
||||
|
|
|
@ -1,57 +1,65 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGRoleTurnEndEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class RPetiteFille extends Role {
|
||||
final List<String> customNames = Arrays.asList("Loup Glouton", "Loup Méchant", "Loup Burlesque", "Loup Peureux", "Loup Malingre", "Loup Gentil", "Loup Tueur", "Loup Énervé", "Loup Docteur");
|
||||
|
||||
public RPetiteFille(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lPetite Fille";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "de la " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu peux espionner les §c§lLoups§f.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
final List<String> customNames = Arrays.asList("Loup Glouton", "Loup Méchant", "Loup Burlesque", "Loup Peureux", "Loup Malingre", "Loup Gentil", "Loup Tueur", "Loup Énervé", "Loup Docteur");
|
||||
|
||||
@EventHandler
|
||||
public void onChangeRole(LGRoleTurnEndEvent e) {
|
||||
if (e.getGame() == getGame()) {
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -17,15 +20,12 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class RPirate extends Role {
|
||||
static final ItemStack[] items = new ItemStack[9];
|
||||
|
||||
static {
|
||||
items[3] = new ItemStack(Material.IRON_NUGGET);
|
||||
ItemMeta meta = items[3].getItemMeta();
|
||||
|
@ -41,6 +41,9 @@ public class RPirate extends Role{
|
|||
items[5].setItemMeta(meta);
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
boolean inMenu = false;
|
||||
|
||||
public RPirate(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -74,10 +77,12 @@ public class RPirate extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 aiguise son crochet...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
|
@ -88,8 +93,6 @@ public class RPirate extends Role{
|
|||
return 15;
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
|
||||
public void openInventory(Player player) {
|
||||
inMenu = true;
|
||||
Inventory inventory = Bukkit.createInventory(null, 9, "§7Veux-tu prendre un otage ?");
|
||||
|
@ -97,12 +100,14 @@ public class RPirate extends Role{
|
|||
player.closeInventory();
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
player.showView();
|
||||
this.callback = callback;
|
||||
openInventory(player.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.getPlayer().getInventory().setItem(8, null);
|
||||
|
@ -114,12 +119,11 @@ public class RPirate extends Role{
|
|||
player.sendMessage("§6Tu n'as rien fait cette nuit.");
|
||||
}
|
||||
|
||||
boolean inMenu = false;
|
||||
|
||||
private void closeInventory(Player p) {
|
||||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
@ -161,6 +165,7 @@ public class RPirate extends Role{
|
|||
}, lgp);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerKilled(LGPlayerKilledEvent e) {
|
||||
if (e.getGame() == getGame() && e.getReason() == Reason.VOTE)
|
||||
|
@ -190,6 +195,7 @@ public class RPirate extends Role{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuitInventory(InventoryCloseEvent e) {
|
||||
if (e.getInventory() instanceof CraftInventoryCustom) {
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityMetadata;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPreDayStartEvent;
|
||||
import fr.leomelki.loupgarou.utils.VariousUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -19,21 +26,13 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerEntityMetadata;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPreDayStartEvent;
|
||||
import fr.leomelki.loupgarou.utils.VariousUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class RPretre extends Role {
|
||||
static final ItemStack[] items = new ItemStack[9];
|
||||
|
||||
static {
|
||||
items[3] = new ItemStack(Material.IRON_NUGGET);
|
||||
ItemMeta meta = items[3].getItemMeta();
|
||||
|
@ -49,6 +48,11 @@ public class RPretre extends Role{
|
|||
items[5].setItemMeta(meta);
|
||||
}
|
||||
|
||||
final WrappedDataWatcherObject invisible = new WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
|
||||
final ArrayList<LGPlayer> ressucited = new ArrayList<>();
|
||||
Runnable callback;
|
||||
boolean inMenu = false;
|
||||
|
||||
public RPretre(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -82,10 +86,12 @@ public class RPretre extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 récite ses ouvrages...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
|
@ -95,6 +101,7 @@ public class RPretre extends Role{
|
|||
public int getTimeout() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlayersLeft() {
|
||||
for (LGPlayer pretre : getPlayers())
|
||||
|
@ -104,8 +111,6 @@ public class RPretre extends Role{
|
|||
return false;
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
|
||||
public void openInventory(Player player) {
|
||||
inMenu = true;
|
||||
Inventory inventory = Bukkit.createInventory(null, 9, "§7Veux-tu réssusciter quelqu'un ?");
|
||||
|
@ -113,7 +118,7 @@ public class RPretre extends Role{
|
|||
player.closeInventory();
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
final WrappedDataWatcherObject invisible = new WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
player.showView();
|
||||
|
@ -131,6 +136,7 @@ public class RPretre extends Role{
|
|||
this.callback = callback;
|
||||
openInventory(player.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.getPlayer().getInventory().setItem(8, null);
|
||||
|
@ -151,13 +157,11 @@ public class RPretre extends Role{
|
|||
}
|
||||
}
|
||||
|
||||
boolean inMenu = false;
|
||||
final ArrayList<LGPlayer> ressucited = new ArrayList<>();
|
||||
|
||||
private void closeInventory(Player p) {
|
||||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
@ -212,6 +216,7 @@ public class RPretre extends Role{
|
|||
}, lgp);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClick(PlayerInteractEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
|
@ -267,6 +272,7 @@ public class RPretre extends Role{
|
|||
ressucited.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuitInventory(InventoryCloseEvent e) {
|
||||
if (e.getInventory() instanceof CraftInventoryCustom) {
|
||||
|
|
|
@ -7,38 +7,47 @@ public class RPronostiqueur extends Role{
|
|||
public RPronostiqueur(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lPronostiqueur";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu peux espionner un joueur et découvrir s'il est gentil ou non. Cependant, dans certaines parties, vos pronostiques ne sont pas exacts...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis un joueur sur lequel pronostiquer.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 s'apprête à pronostiquer...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
|
@ -60,6 +69,7 @@ public class RPronostiqueur extends Role{
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.stopChoosing();
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGPyromaneGasoilEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -19,21 +24,16 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGEndCheckEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPyromaneGasoilEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RPyromane extends Role {
|
||||
static final ItemStack[] items = new ItemStack[9];
|
||||
static final ItemStack cancel;
|
||||
static final ItemStack nothing;
|
||||
|
||||
static {
|
||||
cancel = new ItemStack(Material.IRON_NUGGET);
|
||||
ItemMeta meta = cancel.getItemMeta();
|
||||
|
@ -59,6 +59,10 @@ public class RPyromane extends Role{
|
|||
items[5].setItemMeta(meta);
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
boolean inMenu = false;
|
||||
LGPlayer first;
|
||||
|
||||
public RPyromane(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -92,10 +96,12 @@ public class RPyromane extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 joue avec une allumette...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.SEUL;
|
||||
|
@ -106,8 +112,6 @@ public class RPyromane extends Role{
|
|||
return 30;
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
|
||||
public void openInventory(Player player) {
|
||||
inMenu = true;
|
||||
Inventory inventory = Bukkit.createInventory(null, 9, "§7Que veux-tu faire ?");
|
||||
|
@ -121,6 +125,7 @@ public class RPyromane extends Role{
|
|||
player.closeInventory();
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
first = null;
|
||||
|
@ -128,6 +133,7 @@ public class RPyromane extends Role{
|
|||
this.callback = callback;
|
||||
openInventory(player.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
if (first != null) {
|
||||
|
@ -149,13 +155,11 @@ public class RPyromane extends Role{
|
|||
player.sendMessage("§6Tu n'as rien fait cette nuit.");
|
||||
}
|
||||
|
||||
boolean inMenu = false;
|
||||
LGPlayer first;
|
||||
|
||||
private void closeInventory(Player p) {
|
||||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
@ -245,6 +249,7 @@ public class RPyromane extends Role{
|
|||
}, lgp);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClick(PlayerInteractEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
|
@ -259,6 +264,7 @@ public class RPyromane extends Role{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKilled(LGPlayerKilledEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
@ -269,6 +275,7 @@ public class RPyromane extends Role{
|
|||
liste.remove(e.getKilled());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuitInventory(InventoryCloseEvent e) {
|
||||
if (e.getInventory() instanceof CraftInventoryCustom) {
|
||||
|
@ -294,6 +301,7 @@ public class RPyromane extends Role{
|
|||
e.setWinType(LGWinType.PYROMANE);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEndGame(LGGameEndEvent e) {
|
||||
if (e.getWinType() == LGWinType.PYROMANE) {
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -16,15 +19,12 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerHeldItemSlot;
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import java.util.Collections;
|
||||
|
||||
public class RSorciere extends Role {
|
||||
private static final ItemStack[] items = new ItemStack[4];
|
||||
private static final ItemStack cancel;
|
||||
|
||||
static {
|
||||
items[0] = new ItemStack(Material.PURPLE_DYE, 1);
|
||||
ItemMeta meta = items[0].getItemMeta();
|
||||
|
@ -46,50 +46,59 @@ public class RSorciere extends Role{
|
|||
cancel.setItemMeta(meta);
|
||||
}
|
||||
|
||||
boolean inMenu = false;
|
||||
private LGPlayer sauver;
|
||||
private Runnable callback;
|
||||
|
||||
public RSorciere(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lSorcière";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "de la " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Tu disposes de deux potions : une §e§o§lpotion de vie§f pour sauver la victime des §c§lLoups§f, et une §e§o§lpotion de mort§f pour assassiner quelqu'un.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Que veux-tu faire cette nuit ?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "La " + getName() + "§9 est en train de concocter un nouvel élixir.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
private LGPlayer sauver;
|
||||
private Runnable callback;
|
||||
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
player.showView();
|
||||
|
@ -100,6 +109,7 @@ public class RSorciere extends Role{
|
|||
|
||||
openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.getPlayer().getInventory().setItem(8, null);
|
||||
|
@ -110,6 +120,7 @@ public class RSorciere extends Role{
|
|||
//player.sendTitle("§cVous n'avez utilisé aucune potion", "§4Vous avez mis trop de temps à vous décider...", 80);
|
||||
//player.sendMessage("§6Tu n'as rien fait cette nuit.");
|
||||
}
|
||||
|
||||
private void openInventory(LGPlayer player) {
|
||||
inMenu = true;
|
||||
Inventory inventory = Bukkit.createInventory(null, InventoryType.BREWING, sauver == null ? "§7Personne n'a été ciblé" : "§7§l" + sauver.getName() + " §7est ciblé");
|
||||
|
@ -129,12 +140,12 @@ public class RSorciere extends Role{
|
|||
player.getPlayer().closeInventory();
|
||||
player.getPlayer().openInventory(inventory);
|
||||
}
|
||||
boolean inMenu = false;
|
||||
|
||||
private void closeInventory(Player p) {
|
||||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
@ -186,6 +197,7 @@ public class RSorciere extends Role{
|
|||
openInventory(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuitInventory(InventoryCloseEvent e) {
|
||||
if (e.getInventory() instanceof CraftInventoryCustom) {
|
||||
|
@ -212,6 +224,7 @@ public class RSorciere extends Role{
|
|||
player.hideView();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
private void saveLife(LGPlayer player) {
|
||||
player.getCache().set("witch_used_life", true);
|
||||
getGame().getDeaths().remove(Reason.LOUP_GAROU, sauver);
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightPlayerPreKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGPreDayStartEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVampiredEvent;
|
||||
import fr.leomelki.loupgarou.utils.VariableCache;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom;
|
||||
|
@ -15,58 +22,62 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightPlayerPreKilledEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGPreDayStartEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVampiredEvent;
|
||||
import fr.leomelki.loupgarou.utils.VariableCache;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class RSurvivant extends Role {
|
||||
boolean inMenu;
|
||||
Runnable callback;
|
||||
|
||||
public RSurvivant(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§d§lSurvivant";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "du " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes si tu remplis ton objectif";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu es §d§lNeutre§f et tu gagnes si tu remplis ton objectif. Ton objectif est de survivre. Tu disposes de §l2§f protections. Chaque nuit, tu peux utiliser une protection pour ne pas être tué par les §c§lLoups§f. Tu peux gagner aussi bien avec les §a§lVillageois§f qu'avec les §c§lLoups§f, tu dois juste rester en vie jusqu'à la fin de la partie.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Veux-tu utiliser une protection cette nuit ?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "Le " + getName() + "§9 décide s'il veut se protéger.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
}
|
||||
boolean inMenu;
|
||||
|
||||
public void openInventory(Player player) {
|
||||
inMenu = true;
|
||||
Inventory inventory = Bukkit.createInventory(null, 9, "§7Veux-tu te protéger ?");
|
||||
|
@ -96,19 +107,20 @@ public class RSurvivant extends Role{
|
|||
inventory.setContents(items);
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void join(LGPlayer player) {
|
||||
super.join(player);
|
||||
player.getCache().set("survivant_left", 2);
|
||||
}
|
||||
|
||||
Runnable callback;
|
||||
@Override
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
player.showView();
|
||||
this.callback = callback;
|
||||
openInventory(player.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.hideView();
|
||||
|
@ -120,6 +132,7 @@ public class RSurvivant extends Role{
|
|||
inMenu = false;
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
@ -152,11 +165,13 @@ public class RSurvivant extends Role{
|
|||
e.setReason(Reason.DONT_DIE);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVampired(LGVampiredEvent e) {
|
||||
if (e.getGame() == getGame() && e.getPlayer().getCache().getBoolean("survivant_protected"))
|
||||
e.setProtect(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDayStart(LGPreDayStartEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
@ -182,9 +197,6 @@ public class RSurvivant extends Role{
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onWin(LGGameEndEvent e) {
|
||||
if (e.getGame() == getGame() && getPlayers().size() > 0 && e.getWinType() != LGWinType.ANGE) {
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.*;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems.LGCustomItemsConstraints;
|
||||
import fr.leomelki.loupgarou.classes.chat.LGChat;
|
||||
import fr.leomelki.loupgarou.events.*;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import fr.leomelki.loupgarou.classes.LGVote;
|
||||
import fr.leomelki.loupgarou.classes.LGWinType;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems.LGCustomItemsConstraints;
|
||||
import fr.leomelki.loupgarou.classes.chat.LGChat;
|
||||
import fr.leomelki.loupgarou.events.LGCustomItemChangeEvent;
|
||||
import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGNightEndEvent;
|
||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
import fr.leomelki.loupgarou.events.LGUpdatePrefixEvent;
|
||||
import fr.leomelki.loupgarou.events.LGVampiredEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
public class RVampire extends Role {
|
||||
|
||||
@Getter
|
||||
private final LGChat chat = new LGChat((sender, message) -> "§5" + sender.getName() + " §6» §f" + message);
|
||||
int nextCanInfect = 0;
|
||||
LGVote vote;
|
||||
|
||||
public RVampire(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
@ -58,10 +54,12 @@ public class RVampire extends Role{
|
|||
public String getBroadcastedTask() {
|
||||
return "Les §5§lVampires§9 choisissent leur cible.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VAMPIRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VAMPIRE;
|
||||
|
@ -71,14 +69,12 @@ public class RVampire extends Role{
|
|||
public int getTimeout() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlayersLeft() {
|
||||
return nextCanInfect < getGame().getNight() && super.hasPlayersLeft();
|
||||
}
|
||||
|
||||
@Getter private final LGChat chat = new LGChat((sender, message) -> "§5"+sender.getName()+" §6» §f"+message);
|
||||
int nextCanInfect = 0;
|
||||
LGVote vote;
|
||||
@Override
|
||||
public void join(LGPlayer player, boolean sendMessage) {
|
||||
super.join(player, sendMessage);
|
||||
|
@ -101,6 +97,7 @@ public class RVampire extends Role{
|
|||
callback.run();
|
||||
}, getPlayers());
|
||||
}
|
||||
|
||||
private void onNightTurnEnd() {
|
||||
for (LGPlayer lgp : getGame().getAlive())
|
||||
if (lgp.getRoleType() == RoleType.VAMPIRE)
|
||||
|
@ -167,6 +164,7 @@ public class RVampire extends Role{
|
|||
for (LGPlayer player : getPlayers())
|
||||
player.sendMessage("§6Personne n'a été infecté.");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDayStart(LGNightEndEvent e) {
|
||||
if (e.getGame() == getGame())
|
||||
|
|
|
@ -6,38 +6,47 @@ public class RVillageois extends Role{
|
|||
public RVillageois(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lVillageois";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "des " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Tu ne disposes d'aucun pouvoir particulier, uniquement ta perspicacité et ta force de persuasion.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return -1;
|
||||
|
|
|
@ -7,22 +7,27 @@ public class RVoyante extends Role{
|
|||
public RVoyante(LGGame game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleType getType() {
|
||||
return RoleType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleWinType getWinType() {
|
||||
return RoleWinType.VILLAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "§a§lVoyante";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return "de la " + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage";
|
||||
|
@ -32,14 +37,17 @@ public class RVoyante extends Role{
|
|||
public String getDescription() {
|
||||
return "Tu gagnes avec le §a§lVillage§f. Chaque nuit, tu peux espionner un joueur et découvrir sa véritable identité...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTask() {
|
||||
return "Choisis un joueur dont tu veux connnaître l'identité.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBroadcastedTask() {
|
||||
return "La " + getName() + "§9 s'apprête à sonder un joueur...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeout() {
|
||||
return 15;
|
||||
|
@ -60,6 +68,7 @@ public class RVoyante extends Role{
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.stopChoosing();
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
package fr.leomelki.loupgarou.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.leomelki.loupgarou.MainLg;
|
||||
import fr.leomelki.loupgarou.classes.LGCustomItems;
|
||||
import fr.leomelki.loupgarou.classes.LGGame;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public abstract class Role implements Listener {
|
||||
@Getter @Setter private int waitedPlayers;
|
||||
@Getter private final ArrayList<LGPlayer> players = new ArrayList<>();
|
||||
@Getter private final LGGame game;
|
||||
@Getter
|
||||
private final ArrayList<LGPlayer> players = new ArrayList<>();
|
||||
@Getter
|
||||
private final LGGame game;
|
||||
@Getter
|
||||
@Setter
|
||||
private int waitedPlayers;
|
||||
|
||||
public Role(LGGame game) {
|
||||
this.game = game;
|
||||
|
@ -31,19 +34,33 @@ public abstract class Role implements Listener{
|
|||
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract String getFriendlyName();
|
||||
|
||||
public abstract String getShortDescription();
|
||||
|
||||
public abstract String getDescription();
|
||||
|
||||
public abstract String getTask();
|
||||
|
||||
public abstract String getBroadcastedTask();
|
||||
|
||||
public RoleType getType(LGPlayer lgp) {
|
||||
return getType();
|
||||
}
|
||||
|
||||
public RoleWinType getWinType(LGPlayer lgp) {
|
||||
return getWinType();
|
||||
}
|
||||
public RoleType getType() {return null;}
|
||||
public RoleWinType getWinType() {return null;}
|
||||
|
||||
public RoleType getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public RoleWinType getWinType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Timeout in second for this role
|
||||
*/
|
||||
|
@ -75,7 +92,8 @@ public abstract class Role implements Listener{
|
|||
// player.sendTitle("§6C'est à vous de jouer", "§a"+getTask(), 100);
|
||||
onNightTurn(player, this);
|
||||
} else {
|
||||
getGame().wait(getTimeout(), ()->{}, (currentPlayer, secondsLeft)-> currentPlayer == player ? "§c§lTu ne peux pas jouer" : "§6C'est au tour "+getFriendlyName()+" §6(§e"+secondsLeft+" s§6)");
|
||||
getGame().wait(getTimeout(), () -> {
|
||||
}, (currentPlayer, secondsLeft) -> currentPlayer == player ? "§c§lTu ne peux pas jouer" : "§6C'est au tour " + getFriendlyName() + " §6(§e" + secondsLeft + " s§6)");
|
||||
Runnable run = this;
|
||||
new BukkitRunnable() {
|
||||
|
||||
|
@ -88,6 +106,7 @@ public abstract class Role implements Listener{
|
|||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
public void join(LGPlayer player, boolean sendMessage) {
|
||||
System.out.println(player.getName() + " est " + getName());
|
||||
players.add(player);
|
||||
|
@ -100,18 +119,26 @@ public abstract class Role implements Listener{
|
|||
player.sendMessage("§6Description : §f" + getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
public void join(LGPlayer player) {
|
||||
join(player, !getGame().isStarted());
|
||||
LGCustomItems.updateItem(player);
|
||||
}
|
||||
|
||||
public boolean hasPlayersLeft() {
|
||||
return getPlayers().size() > 0;
|
||||
}
|
||||
protected void onNightTurnTimeout(LGPlayer player) {}
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {}
|
||||
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
}
|
||||
|
||||
protected void onNightTurn(LGPlayer player, Runnable callback) {
|
||||
}
|
||||
|
||||
protected void onTurnFinish(Runnable callback) {
|
||||
callback.run();
|
||||
}
|
||||
|
||||
public int getTurnOrder() {
|
||||
try {
|
||||
RoleSort role = RoleSort.valueOf(getClass().getSimpleName().substring(1));
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package fr.leomelki.loupgarou.scoreboard;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardDisplayObjective;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardObjective;
|
||||
import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||
|
@ -12,18 +8,25 @@ import fr.leomelki.loupgarou.utils.RandomString;
|
|||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class CustomScoreboard {
|
||||
@Getter private final String name = RandomString.generate(16);
|
||||
@Getter private final String displayName;
|
||||
@Getter
|
||||
private final String name = RandomString.generate(16);
|
||||
@Getter
|
||||
private final String displayName;
|
||||
private final List<CustomScoreboardEntry> entries = Arrays.asList(new CustomScoreboardEntry(15, this), new CustomScoreboardEntry(14, this), new CustomScoreboardEntry(13, this),
|
||||
new CustomScoreboardEntry(12, this), new CustomScoreboardEntry(11, this), new CustomScoreboardEntry(10, this),
|
||||
new CustomScoreboardEntry(9, this), new CustomScoreboardEntry(8, this), new CustomScoreboardEntry(7, this),
|
||||
new CustomScoreboardEntry(6, this), new CustomScoreboardEntry(5, this), new CustomScoreboardEntry(4, this),
|
||||
new CustomScoreboardEntry(3, this), new CustomScoreboardEntry(2, this), new CustomScoreboardEntry(1, this),
|
||||
new CustomScoreboardEntry(0, this));
|
||||
@Getter private final LGPlayer player;
|
||||
@Getter private boolean shown;
|
||||
@Getter
|
||||
private final LGPlayer player;
|
||||
@Getter
|
||||
private boolean shown;
|
||||
|
||||
public CustomScoreboardEntry getLine(int index) {
|
||||
return entries.get(index);
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package fr.leomelki.loupgarou.scoreboard;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ScoreboardAction;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardScore;
|
||||
import fr.leomelki.com.comphenix.packetwrapper.WrapperPlayServerScoreboardTeam;
|
||||
import fr.leomelki.loupgarou.utils.VariousUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class CustomScoreboardEntry {
|
||||
private static final WrappedChatComponent nullComponent = WrappedChatComponent.fromText("");
|
||||
|
||||
//setter car flemme de modifier le systeme pour le rendre plus logique
|
||||
@Getter @Setter private int score;
|
||||
private final String name;
|
||||
private final CustomScoreboard scoreboard;
|
||||
//setter car flemme de modifier le systeme pour le rendre plus logique
|
||||
@Getter
|
||||
@Setter
|
||||
private int score;
|
||||
private WrappedChatComponent prefix, suffix;
|
||||
|
||||
public CustomScoreboardEntry(int score, CustomScoreboard scoreboard) {
|
||||
|
@ -61,8 +61,7 @@ public class CustomScoreboardEntry {
|
|||
if (storeColorCode) {
|
||||
storeColorCode = false;
|
||||
colorCode = c;
|
||||
}else
|
||||
if(c == '§')
|
||||
} else if (c == '§')
|
||||
storeColorCode = true;
|
||||
suffix = WrappedChatComponent.fromText("§" + colorCode + displayName.substring(limit));
|
||||
} else
|
||||
|
@ -87,10 +86,12 @@ public class CustomScoreboardEntry {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
hide();
|
||||
prefix = null;
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
if (prefix != null && scoreboard.isShown()) {
|
||||
WrapperPlayServerScoreboardScore score = new WrapperPlayServerScoreboardScore();
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
package fr.leomelki.loupgarou.utils;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
public class MultipleValueMap<K, V> {
|
||||
private final HashMap<K, List<V>> map = new HashMap<>();
|
||||
|
||||
public void put(K key, V value) {
|
||||
List<V> list = map.computeIfAbsent(key, k -> new ArrayList<>());
|
||||
list.add(value);
|
||||
}
|
||||
|
||||
public V remove(K key, V value) {
|
||||
List<V> list = map.get(key);
|
||||
if (list != null) {
|
||||
|
@ -25,9 +27,11 @@ public class MultipleValueMap<K, V> {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean containsKey(K key) {
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
public boolean containsValue(V value) {
|
||||
if (value != null)
|
||||
for (List<V> list : map.values())
|
||||
|
@ -36,9 +40,11 @@ public class MultipleValueMap<K, V> {
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public V get(K key) {
|
||||
return map.containsKey(key) ? map.get(key).get(0) : null;
|
||||
}
|
||||
|
||||
public List<Entry<K, V>> entrySet() {
|
||||
ArrayList<Entry<K, V>> toReturn = new ArrayList<>();
|
||||
for (Entry<K, List<V>> entry : map.entrySet())
|
||||
|
@ -47,15 +53,18 @@ public class MultipleValueMap<K, V> {
|
|||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
map.clear();
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
public static class MultipleValueKeyEntry<K, V> implements Entry<K, V> {
|
||||
@Getter
|
||||
private final K key;
|
||||
@Getter
|
||||
private V value;
|
||||
|
||||
@Override
|
||||
public V setValue(V value) {
|
||||
return this.value = value;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue