Code cleanup
This commit is contained in:
parent
94bc0a32e8
commit
ee69cdc34e
33 changed files with 145 additions and 131 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -23,3 +23,10 @@ hs_err_pid*
|
||||||
|
|
||||||
# Minecraft data
|
# Minecraft data
|
||||||
/minecraft_data
|
/minecraft_data
|
||||||
|
|
||||||
|
# IntelliJ files
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# Maven files
|
||||||
|
/target/
|
||||||
|
|
|
@ -41,9 +41,9 @@ Un serveur est mis à votre disposition pour vous permettre de jouer au LoupGaro
|
||||||
- [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/)
|
- [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/)
|
||||||
|
|
||||||
### Installation classique
|
### Installation classique
|
||||||
**Minecraft 1.15.1 est requis.**
|
**Minecraft 1.15.2 est requis.**
|
||||||
Pour installer le plug-in, merci de suivre les étapes suivantes:
|
Pour installer le plug-in, merci de suivre les étapes suivantes:
|
||||||
- Téléchargez Spigot 1.15.1 et lancez une fois le serveur
|
- Téléchargez Spigot 1.15.2 et lancez une fois le serveur
|
||||||
- Dans le dossier `plugins`, insérez [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/) et [LoupGarou.jar](https://github.com/leomelki/LoupGarou/releases)
|
- Dans le dossier `plugins`, insérez [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/) et [LoupGarou.jar](https://github.com/leomelki/LoupGarou/releases)
|
||||||
- Redémarrez votre serveur puis donnez vous les permissions administrateur (/op <votre_pseudo> dans la console)
|
- Redémarrez votre serveur puis donnez vous les permissions administrateur (/op <votre_pseudo> dans la console)
|
||||||
- Allez sur la map et ajoutez les points de spawn sur chaque dalle `/lg addSpawn`
|
- Allez sur la map et ajoutez les points de spawn sur chaque dalle `/lg addSpawn`
|
||||||
|
|
42
pom.xml
42
pom.xml
|
@ -1,35 +1,45 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>fr.leomelki</groupId>
|
<groupId>fr.leomelki</groupId>
|
||||||
<artifactId>LoupGarou</artifactId>
|
<artifactId>LoupGarou</artifactId>
|
||||||
<version>1.1.0</version>
|
<version>1.0.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>LoupGarou</finalName>
|
<finalName>LoupGarou</finalName>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${project.java.version}</source>
|
|
||||||
<target>${project.java.version}</target>
|
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
</descriptorRefs>
|
</descriptorRefs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
@ -39,53 +49,49 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/java</directory>
|
|
||||||
<includes>
|
|
||||||
<include>plugin.yml</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>dmulloy2-repo</id>
|
<id>dmulloy2-repo</id>
|
||||||
<url>http://repo.dmulloy2.net/nexus/repository/public/</url>
|
<url>http://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!--Bungeecord Repo-->
|
|
||||||
<!--Only include if using the Spigot API dependency-->
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>bungeecord-repo</id>
|
<id>bungeecord-repo</id>
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.15.1-R0.1-SNAPSHOT</version>
|
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20180813</version>
|
<version>20180813</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.comphenix.protocol</groupId>
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
<artifactId>ProtocolLib</artifactId>
|
<artifactId>ProtocolLib</artifactId>
|
||||||
<version>4.4.0</version>
|
<version>4.4.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.10</version>
|
<version>1.18.10</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -70,7 +70,7 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
||||||
/**
|
/**
|
||||||
* The singleton instance. Can also be retrieved from the parent class.
|
* The singleton instance. Can also be retrieved from the parent class.
|
||||||
*/
|
*/
|
||||||
private static ObjectTypes INSTANCE = new ObjectTypes();
|
private static final ObjectTypes INSTANCE = new ObjectTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve an instance of the object types enum.
|
* Retrieve an instance of the object types enum.
|
||||||
|
|
|
@ -87,8 +87,8 @@ import lombok.Setter;
|
||||||
|
|
||||||
public class MainLg extends JavaPlugin{
|
public class MainLg extends JavaPlugin{
|
||||||
private static MainLg instance;
|
private static MainLg instance;
|
||||||
@Getter private HashMap<String, Constructor<? extends Role>> roles = new HashMap<String, Constructor<? extends Role>>();
|
@Getter private final HashMap<String, Constructor<? extends Role>> roles = new HashMap<String, Constructor<? extends Role>>();
|
||||||
@Getter private static String prefix = ""/*"§7[§9Loup-Garou§7] "*/;
|
@Getter private static final String prefix = ""/*"§7[§9Loup-Garou§7] "*/;
|
||||||
|
|
||||||
@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)
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class LGCustomItems {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public static enum LGCustomItemsConstraints{
|
public enum LGCustomItemsConstraints{
|
||||||
INFECTED("infecte"),
|
INFECTED("infecte"),
|
||||||
MAYOR("maire"),
|
MAYOR("maire"),
|
||||||
VAMPIRE_INFECTE("vampire-infecte"),
|
VAMPIRE_INFECTE("vampire-infecte"),
|
||||||
|
|
|
@ -70,13 +70,13 @@ import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class LGGame implements Listener{
|
public class LGGame implements Listener{
|
||||||
private static boolean autoStart = false;
|
private static final boolean autoStart = false;
|
||||||
|
|
||||||
|
|
||||||
@Getter private final SecureRandom random = new SecureRandom();
|
@Getter private final SecureRandom random = new SecureRandom();
|
||||||
@Getter private final int maxPlayers;
|
@Getter private final int maxPlayers;
|
||||||
@Getter private ArrayList<LGPlayer> inGame = new ArrayList<LGPlayer>();
|
@Getter private final ArrayList<LGPlayer> inGame = new ArrayList<LGPlayer>();
|
||||||
@Getter private ArrayList<Role> roles = new ArrayList<Role>();
|
@Getter private final ArrayList<Role> roles = new ArrayList<Role>();
|
||||||
|
|
||||||
@Getter private boolean started;
|
@Getter private boolean started;
|
||||||
@Getter private int night = 0;
|
@Getter private int night = 0;
|
||||||
|
@ -84,12 +84,12 @@ public class LGGame implements Listener{
|
||||||
@Getter @Setter private int waitTicks;
|
@Getter @Setter private int waitTicks;
|
||||||
@Getter private boolean day;
|
@Getter private boolean day;
|
||||||
@Getter public long time = 0;
|
@Getter public long time = 0;
|
||||||
@Getter private HashMap<Integer, LGPlayer> placements = new HashMap<Integer, LGPlayer>();
|
@Getter private final HashMap<Integer, LGPlayer> placements = new HashMap<Integer, LGPlayer>();
|
||||||
|
|
||||||
@Getter private LGChat spectatorChat = new LGChat((sender, message) -> {
|
@Getter private final LGChat spectatorChat = new LGChat((sender, message) -> {
|
||||||
return "§7"+sender.getName()+" §6» §f"+message;
|
return "§7"+sender.getName()+" §6» §f"+message;
|
||||||
});
|
});
|
||||||
@Getter private LGChat dayChat = new LGChat((sender, message) -> {
|
@Getter private final LGChat dayChat = new LGChat((sender, message) -> {
|
||||||
return "§e"+sender.getName()+" §6» §f"+message;
|
return "§e"+sender.getName()+" §6» §f"+message;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class LGGame implements Listener{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private MultipleValueMap<LGPlayerKilledEvent.Reason, LGPlayer> deaths = new MultipleValueMap<LGPlayerKilledEvent.Reason, LGPlayer>();
|
private final MultipleValueMap<LGPlayerKilledEvent.Reason, LGPlayer> deaths = new MultipleValueMap<LGPlayerKilledEvent.Reason, LGPlayer>();
|
||||||
|
|
||||||
public void sendActionBarMessage(String msg) {
|
public void sendActionBarMessage(String msg) {
|
||||||
WrapperPlayServerChat chat = new WrapperPlayServerChat();
|
WrapperPlayServerChat chat = new WrapperPlayServerChat();
|
||||||
|
@ -173,8 +173,8 @@ public class LGGame implements Listener{
|
||||||
}.runTaskTimer(MainLg.getInstance(), 0, 1);
|
}.runTaskTimer(MainLg.getInstance(), 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface TextGenerator{
|
public interface TextGenerator{
|
||||||
public String generate(LGPlayer player, int secondsLeft);
|
String generate(LGPlayer player, int secondsLeft);
|
||||||
}
|
}
|
||||||
public void cancelWait() {
|
public void cancelWait() {
|
||||||
if(waitTask != null) {
|
if(waitTask != null) {
|
||||||
|
@ -551,7 +551,6 @@ public class LGGame implements Listener{
|
||||||
killed.getPlayer().getWorld().strikeLightningEffect(killed.getPlayer().getLocation());
|
killed.getPlayer().getWorld().strikeLightningEffect(killed.getPlayer().getLocation());
|
||||||
|
|
||||||
for(Role role : getRoles())
|
for(Role role : getRoles())
|
||||||
if(role.getPlayers().contains(killed))
|
|
||||||
role.getPlayers().remove(killed);
|
role.getPlayers().remove(killed);
|
||||||
|
|
||||||
killed.setDead(true);
|
killed.setDead(true);
|
||||||
|
|
|
@ -42,7 +42,7 @@ import net.minecraft.server.v1_15_R1.PacketPlayOutRespawn;
|
||||||
import net.minecraft.server.v1_15_R1.WorldType;
|
import net.minecraft.server.v1_15_R1.WorldType;
|
||||||
|
|
||||||
public class LGPlayer {
|
public class LGPlayer {
|
||||||
private static HashMap<Player, LGPlayer> cachedPlayers = new HashMap<Player, LGPlayer>();
|
private static final HashMap<Player, LGPlayer> cachedPlayers = new HashMap<Player, LGPlayer>();
|
||||||
public static LGPlayer thePlayer(Player player) {
|
public static LGPlayer thePlayer(Player player) {
|
||||||
LGPlayer lgp = cachedPlayers.get(player);
|
LGPlayer lgp = cachedPlayers.get(player);
|
||||||
if(lgp == null) {
|
if(lgp == null) {
|
||||||
|
@ -60,7 +60,7 @@ public class LGPlayer {
|
||||||
@Setter @Getter private Role role;
|
@Setter @Getter private Role role;
|
||||||
private LGChooseCallback chooseCallback;
|
private LGChooseCallback chooseCallback;
|
||||||
private List<LGPlayer> blacklistedChoice = new ArrayList<>(0);
|
private List<LGPlayer> blacklistedChoice = new ArrayList<>(0);
|
||||||
@Getter private VariableCache cache = new VariableCache();
|
@Getter private final VariableCache cache = new VariableCache();
|
||||||
@Getter @Setter private LGGame game;
|
@Getter @Setter private LGGame game;
|
||||||
@Getter @Setter private String latestObjective;
|
@Getter @Setter private String latestObjective;
|
||||||
@Getter private CustomScoreboard scoreboard;
|
@Getter private CustomScoreboard scoreboard;
|
||||||
|
@ -148,8 +148,8 @@ public class LGPlayer {
|
||||||
this.chooseCallback = null;
|
this.chooseCallback = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface LGChooseCallback{
|
public interface LGChooseCallback{
|
||||||
public void callback(LGPlayer choosen);
|
void callback(LGPlayer choosen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showView() {
|
public void showView() {
|
||||||
|
|
|
@ -44,7 +44,9 @@ import net.minecraft.server.v1_15_R1.PacketPlayOutEntityMetadata;
|
||||||
|
|
||||||
public class LGVote {
|
public class LGVote {
|
||||||
@Getter LGPlayer choosen;
|
@Getter LGPlayer choosen;
|
||||||
private int timeout, initialTimeout, littleTimeout;
|
private int timeout;
|
||||||
|
private final int initialTimeout;
|
||||||
|
private final int littleTimeout;
|
||||||
private Runnable callback;
|
private Runnable callback;
|
||||||
private final LGGame game;
|
private final LGGame game;
|
||||||
@Getter private List<LGPlayer> participants, viewers;
|
@Getter private List<LGPlayer> participants, viewers;
|
||||||
|
|
|
@ -12,9 +12,9 @@ public class LGChat {
|
||||||
@Getter private final HashMap<LGPlayer, LGChatCallback> viewers = new HashMap<LGPlayer, LGChatCallback>();
|
@Getter private final HashMap<LGPlayer, LGChatCallback> viewers = new HashMap<LGPlayer, LGChatCallback>();
|
||||||
@Getter private final LGChatCallback defaultCallback;
|
@Getter private final LGChatCallback defaultCallback;
|
||||||
|
|
||||||
public static interface LGChatCallback{
|
public interface LGChatCallback{
|
||||||
public String receive(LGPlayer sender, String message);
|
String receive(LGPlayer sender, String message);
|
||||||
public default String send(LGPlayer sender, String message) {return null;};
|
default String send(LGPlayer sender, String message) {return null;}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(LGPlayer sender, String message) {
|
public void sendMessage(LGPlayer sender, String message) {
|
||||||
|
|
|
@ -15,6 +15,6 @@ public class LGPlayerGotKilledEvent extends LGEvent {
|
||||||
|
|
||||||
@Getter private final boolean endGame;
|
@Getter private final boolean endGame;
|
||||||
@Getter private final LGPlayer killed;
|
@Getter private final LGPlayer killed;
|
||||||
@Getter private Reason reason;
|
@Getter private final Reason reason;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class LGPlayerKilledEvent extends LGEvent implements Cancellable{
|
||||||
@Getter @Setter private Reason reason;
|
@Getter @Setter private Reason reason;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public static enum Reason{
|
public enum Reason{
|
||||||
LOUP_GAROU("§7§l%s§4 est mort pendant la nuit"),
|
LOUP_GAROU("§7§l%s§4 est mort pendant la nuit"),
|
||||||
GM_LOUP_GAROU("§7§l%s§4 est mort pendant la nuit"),
|
GM_LOUP_GAROU("§7§l%s§4 est mort pendant la nuit"),
|
||||||
LOUP_BLANC(LOUP_GAROU.getMessage()),
|
LOUP_BLANC(LOUP_GAROU.getMessage()),
|
||||||
|
|
|
@ -46,9 +46,9 @@ public class JoinListener implements Listener{
|
||||||
myTeam.sendPacket(player);
|
myTeam.sendPacket(player);
|
||||||
}
|
}
|
||||||
p.setFoodLevel(6);
|
p.setFoodLevel(6);
|
||||||
if(e.getJoinMessage() == null || !e.getJoinMessage().equals("joinall"))
|
if (e.getJoinMessage() == null || !e.getJoinMessage().equals("joinall")) {
|
||||||
p.getPlayer().setResourcePack("http://leomelki.fr/mcgames/ressourcepacks/v32/loup_garou.zip");
|
p.getPlayer().setResourcePack("http://leomelki.fr/mcgames/ressourcepacks/v32/loup_garou.zip");
|
||||||
else {
|
} else {
|
||||||
LGPlayer lgp = LGPlayer.thePlayer(e.getPlayer());
|
LGPlayer lgp = LGPlayer.thePlayer(e.getPlayer());
|
||||||
lgp.showView();
|
lgp.showView();
|
||||||
lgp.join(MainLg.getInstance().getCurrentGame());
|
lgp.join(MainLg.getInstance().getCurrentGame());
|
||||||
|
|
|
@ -223,7 +223,7 @@ public class RCupidon extends Role{
|
||||||
if(!e.getWinners().contains(lgp))
|
if(!e.getWinners().contains(lgp))
|
||||||
e.getWinners().add(lgp);
|
e.getWinners().add(lgp);
|
||||||
} else {
|
} else {
|
||||||
LGPlayer player2 = lgp.getCache().<LGPlayer>get("inlove");
|
LGPlayer player2 = lgp.getCache().get("inlove");
|
||||||
boolean winEnCouple = (lgp.getRoleType() == RoleType.LOUP_GAROU) != (player2.getRoleType() == RoleType.LOUP_GAROU) || lgp.getRoleWinType() == RoleWinType.SEUL || player2.getRoleWinType() == RoleWinType.SEUL;
|
boolean winEnCouple = (lgp.getRoleType() == RoleType.LOUP_GAROU) != (player2.getRoleType() == RoleType.LOUP_GAROU) || lgp.getRoleWinType() == RoleWinType.SEUL || player2.getRoleWinType() == RoleWinType.SEUL;
|
||||||
if(winEnCouple) {
|
if(winEnCouple) {
|
||||||
System.out.println(lgp.getName()+" ne peut pas gagner car il était en couple !");
|
System.out.println(lgp.getName()+" ne peut pas gagner car il était en couple !");
|
||||||
|
|
|
@ -29,8 +29,8 @@ import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||||
import fr.leomelki.loupgarou.events.LGVoteEvent;
|
import fr.leomelki.loupgarou.events.LGVoteEvent;
|
||||||
|
|
||||||
public class RDictateur extends Role{
|
public class RDictateur extends Role{
|
||||||
static private ItemStack[] items = new ItemStack[9];
|
static private final ItemStack[] items = new ItemStack[9];
|
||||||
static private Inventory inventory;
|
static private final Inventory inventory;
|
||||||
static {
|
static {
|
||||||
items[3] = new ItemStack(Material.IRON_NUGGET);
|
items[3] = new ItemStack(Material.IRON_NUGGET);
|
||||||
ItemMeta meta = items[3].getItemMeta();
|
ItemMeta meta = items[3].getItemMeta();
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class REnfantSauvage extends Role{
|
||||||
}
|
}
|
||||||
}, player);
|
}, player);
|
||||||
}
|
}
|
||||||
private static Random random = new Random();
|
private static final Random random = new Random();
|
||||||
@Override
|
@Override
|
||||||
protected void onNightTurnTimeout(LGPlayer player) {
|
protected void onNightTurnTimeout(LGPlayer player) {
|
||||||
player.stopChoosing();
|
player.stopChoosing();
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class RFaucheur extends Role{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Random random = new Random();
|
private static final Random random = new Random();
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onKill(LGPlayerKilledEvent e) {
|
public void onKill(LGPlayerKilledEvent e) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class RGarde extends Role{
|
||||||
//player.sendMessage("§cVous n'avez protégé personne cette nuit.");
|
//player.sendMessage("§cVous n'avez protégé personne cette nuit.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Reason> reasonsProtected = Arrays.asList(Reason.LOUP_GAROU, Reason.LOUP_BLANC, Reason.GM_LOUP_GAROU, Reason.ASSASSIN);
|
private static final List<Reason> reasonsProtected = Arrays.asList(Reason.LOUP_GAROU, Reason.LOUP_BLANC, Reason.GM_LOUP_GAROU, Reason.ASSASSIN);
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerKill(LGNightPlayerPreKilledEvent e) {
|
public void onPlayerKill(LGNightPlayerPreKilledEvent e) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class RLoupGarou extends Role{
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter private LGChat chat = new LGChat((sender, message) -> {
|
@Getter private final LGChat chat = new LGChat((sender, message) -> {
|
||||||
return "§c"+sender.getName()+" §6» §f"+message;
|
return "§c"+sender.getName()+" §6» §f"+message;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
||||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||||
|
|
||||||
public class RLoupGarouBlanc extends Role{
|
public class RLoupGarouBlanc extends Role{
|
||||||
private static ItemStack skip;
|
private static final ItemStack skip;
|
||||||
static {
|
static {
|
||||||
skip = new ItemStack(Material.IRON_NUGGET);
|
skip = new ItemStack(Material.IRON_NUGGET);
|
||||||
ItemMeta meta = skip.getItemMeta();
|
ItemMeta meta = skip.getItemMeta();
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class RMontreurDOurs extends Role{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Random random = new Random();
|
private static final Random random = new Random();
|
||||||
private int lastNight = -1;
|
private int lastNight = -1;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class RPyromane extends Role{
|
||||||
@Override
|
@Override
|
||||||
protected void onNightTurnTimeout(LGPlayer player) {
|
protected void onNightTurnTimeout(LGPlayer player) {
|
||||||
if(first != null) {
|
if(first != null) {
|
||||||
List<LGPlayer> liste = player.getCache().<List<LGPlayer>>get("pyromane_essence");
|
List<LGPlayer> liste = player.getCache().get("pyromane_essence");
|
||||||
LGPyromaneGasoilEvent event = new LGPyromaneGasoilEvent(getGame(), first);
|
LGPyromaneGasoilEvent event = new LGPyromaneGasoilEvent(getGame(), first);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if(event.isCancelled())
|
if(event.isCancelled())
|
||||||
|
@ -172,7 +172,7 @@ public class RPyromane extends Role{
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
closeInventory(player);
|
closeInventory(player);
|
||||||
if(lgp.getCache().<List<LGPlayer>>get("pyromane_essence").size() != 0) {
|
if(lgp.getCache().<List<LGPlayer>>get("pyromane_essence").size() != 0) {
|
||||||
List<LGPlayer> liste = lgp.getCache().<List<LGPlayer>>get("pyromane_essence");
|
List<LGPlayer> liste = lgp.getCache().get("pyromane_essence");
|
||||||
for(LGPlayer scndPlayer : liste) {
|
for(LGPlayer scndPlayer : liste) {
|
||||||
if(!scndPlayer.isDead() && scndPlayer.getPlayer() != null) {
|
if(!scndPlayer.isDead() && scndPlayer.getPlayer() != null) {
|
||||||
getGame().kill(scndPlayer, Reason.PYROMANE);
|
getGame().kill(scndPlayer, Reason.PYROMANE);
|
||||||
|
@ -203,7 +203,7 @@ public class RPyromane extends Role{
|
||||||
lgp.sendMessage("§cTu as déjà versé du gasoil sur §7§l"+choosen.getName()+"§6.");
|
lgp.sendMessage("§cTu as déjà versé du gasoil sur §7§l"+choosen.getName()+"§6.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<LGPlayer> liste = lgp.getCache().<List<LGPlayer>>get("pyromane_essence");
|
List<LGPlayer> liste = lgp.getCache().get("pyromane_essence");
|
||||||
if(liste.contains(choosen)) {
|
if(liste.contains(choosen)) {
|
||||||
lgp.sendMessage("§7§l"+choosen.getName()+"§c est déjà recouvert de gasoil.");
|
lgp.sendMessage("§7§l"+choosen.getName()+"§c est déjà recouvert de gasoil.");
|
||||||
return;
|
return;
|
||||||
|
@ -266,8 +266,8 @@ public class RPyromane extends Role{
|
||||||
if(e.getGame() == getGame())
|
if(e.getGame() == getGame())
|
||||||
for(LGPlayer lgp : getPlayers())
|
for(LGPlayer lgp : getPlayers())
|
||||||
if(lgp.getCache().has("pyromane_essence")) {
|
if(lgp.getCache().has("pyromane_essence")) {
|
||||||
List<LGPlayer> liste = lgp.getCache().<List<LGPlayer>>get("pyromane_essence");
|
List<LGPlayer> liste = lgp.getCache().get("pyromane_essence");
|
||||||
if(liste.contains(e.getKilled()))//Au cas où le mec soit rez
|
//Au cas où le mec soit rez
|
||||||
liste.remove(e.getKilled());
|
liste.remove(e.getKilled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import fr.leomelki.loupgarou.classes.LGPlayer;
|
||||||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||||
|
|
||||||
public class RSorciere extends Role{
|
public class RSorciere extends Role{
|
||||||
private static ItemStack[] items = new ItemStack[4];
|
private static final ItemStack[] items = new ItemStack[4];
|
||||||
private static ItemStack cancel;
|
private static final ItemStack cancel;
|
||||||
static {
|
static {
|
||||||
items[0] = new ItemStack(Material.PURPLE_DYE, 1);
|
items[0] = new ItemStack(Material.PURPLE_DYE, 1);
|
||||||
ItemMeta meta = items[0].getItemMeta();
|
ItemMeta meta = items[0].getItemMeta();
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class RVampire extends Role{
|
||||||
return nextCanInfect < getGame().getNight() && super.hasPlayersLeft();
|
return nextCanInfect < getGame().getNight() && super.hasPlayersLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter private LGChat chat = new LGChat((sender, message) -> {
|
@Getter private final LGChat chat = new LGChat((sender, message) -> {
|
||||||
return "§5"+sender.getName()+" §6» §f"+message;
|
return "§5"+sender.getName()+" §6» §f"+message;
|
||||||
});
|
});
|
||||||
int nextCanInfect = 0;
|
int nextCanInfect = 0;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import lombok.Setter;
|
||||||
|
|
||||||
public abstract class Role implements Listener{
|
public abstract class Role implements Listener{
|
||||||
@Getter @Setter private int waitedPlayers;
|
@Getter @Setter private int waitedPlayers;
|
||||||
@Getter private ArrayList<LGPlayer> players = new ArrayList<LGPlayer>();
|
@Getter private final ArrayList<LGPlayer> players = new ArrayList<LGPlayer>();
|
||||||
@Getter private final LGGame game;
|
@Getter private final LGGame game;
|
||||||
|
|
||||||
public Role(LGGame game) {
|
public Role(LGGame game) {
|
||||||
|
|
|
@ -21,5 +21,5 @@ public enum RoleSort {
|
||||||
Pirate,
|
Pirate,
|
||||||
Bouffon,
|
Bouffon,
|
||||||
Sorciere,
|
Sorciere,
|
||||||
Corbeau;
|
Corbeau
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ public enum RoleType {
|
||||||
VILLAGER,
|
VILLAGER,
|
||||||
LOUP_GAROU,
|
LOUP_GAROU,
|
||||||
VAMPIRE,
|
VAMPIRE,
|
||||||
NEUTRAL;
|
NEUTRAL
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,5 @@ public enum RoleWinType {
|
||||||
VILLAGE,
|
VILLAGE,
|
||||||
LOUP_GAROU,
|
LOUP_GAROU,
|
||||||
VAMPIRE,
|
VAMPIRE,
|
||||||
NONE;
|
NONE
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class CustomScoreboardEntry {
|
public class CustomScoreboardEntry {
|
||||||
private static WrappedChatComponent nullComponent = WrappedChatComponent.fromText("");
|
private static final WrappedChatComponent nullComponent = WrappedChatComponent.fromText("");
|
||||||
|
|
||||||
//setter car flemme de modifier le systeme pour le rendre plus logique
|
//setter car flemme de modifier le systeme pour le rendre plus logique
|
||||||
@Getter @Setter private int score;
|
@Getter @Setter private int score;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class MultipleValueMap<K, V> {
|
public class MultipleValueMap<K, V> {
|
||||||
private HashMap<K, List<V>> map = new HashMap<>();
|
private final HashMap<K, List<V>> map = new HashMap<>();
|
||||||
public void put(K key, V value) {
|
public void put(K key, V value) {
|
||||||
List<V> list = map.get(key);
|
List<V> list = map.get(key);
|
||||||
if(list == null)
|
if(list == null)
|
||||||
|
@ -56,7 +56,7 @@ public class MultipleValueMap<K, V> {
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class MultipleValueKeyEntry<K, V> implements Entry<K, V>{
|
public static class MultipleValueKeyEntry<K, V> implements Entry<K, V>{
|
||||||
@Getter
|
@Getter
|
||||||
private K key;
|
private final K key;
|
||||||
@Getter
|
@Getter
|
||||||
private V value;
|
private V value;
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,10 +3,10 @@ package fr.leomelki.loupgarou.utils;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class VariableCache {
|
public class VariableCache {
|
||||||
private HashMap<String, Object> cache = new HashMap<String, Object>();
|
private final HashMap<String, Object> cache = new HashMap<String, Object>();
|
||||||
public boolean getBoolean(String key) {
|
public boolean getBoolean(String key) {
|
||||||
Object object = get(key);
|
Object object = get(key);
|
||||||
return object == null ? false : (boolean)object;
|
return object != null && (boolean) object;
|
||||||
}
|
}
|
||||||
public void set(String key, Object value) {
|
public void set(String key, Object value) {
|
||||||
if(cache.containsKey(key))
|
if(cache.containsKey(key))
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class VariousUtils {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static char[] hex = "0123456789abcdef".toCharArray();
|
private static final char[] hex = "0123456789abcdef".toCharArray();
|
||||||
public static char toHex(int i) {
|
public static char toHex(int i) {
|
||||||
return hex[i];
|
return hex[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@ main: fr.leomelki.loupgarou.MainLg
|
||||||
depend: [ProtocolLib]
|
depend: [ProtocolLib]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
lg:
|
ww:
|
Loading…
Reference in a new issue