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
|
||||
|
||||
# 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/)
|
||||
|
||||
### 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:
|
||||
- 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)
|
||||
- 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`
|
||||
|
|
138
pom.xml
138
pom.xml
|
@ -1,91 +1,97 @@
|
|||
<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>
|
||||
<groupId>fr.leomelki</groupId>
|
||||
<artifactId>LoupGarou</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
<build>
|
||||
<finalName>LoupGarou</finalName>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${project.java.version}</source>
|
||||
<target>${project.java.version}</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
<repositories>
|
||||
<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>
|
||||
<groupId>fr.leomelki</groupId>
|
||||
<artifactId>LoupGarou</artifactId>
|
||||
<version>1.0.1</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<finalName>LoupGarou</finalName>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>http://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||
</repository>
|
||||
<!--Bungeecord Repo-->
|
||||
<!--Only include if using the Spigot API dependency-->
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.15.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20180813</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
|
@ -70,7 +70,7 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
|||
/**
|
||||
* 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.
|
||||
|
|
|
@ -87,8 +87,8 @@ import lombok.Setter;
|
|||
|
||||
public class MainLg extends JavaPlugin{
|
||||
private static MainLg instance;
|
||||
@Getter private HashMap<String, Constructor<? extends Role>> roles = new HashMap<String, Constructor<? extends Role>>();
|
||||
@Getter private static String prefix = ""/*"§7[§9Loup-Garou§7] "*/;
|
||||
@Getter private final HashMap<String, Constructor<? extends Role>> roles = new HashMap<String, Constructor<? extends Role>>();
|
||||
@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)
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class LGCustomItems {
|
|||
}
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public static enum LGCustomItemsConstraints{
|
||||
public enum LGCustomItemsConstraints{
|
||||
INFECTED("infecte"),
|
||||
MAYOR("maire"),
|
||||
VAMPIRE_INFECTE("vampire-infecte"),
|
||||
|
|
|
@ -70,13 +70,13 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
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 int maxPlayers;
|
||||
@Getter private ArrayList<LGPlayer> inGame = new ArrayList<LGPlayer>();
|
||||
@Getter private ArrayList<Role> roles = new ArrayList<Role>();
|
||||
@Getter private final ArrayList<LGPlayer> inGame = new ArrayList<LGPlayer>();
|
||||
@Getter private final ArrayList<Role> roles = new ArrayList<Role>();
|
||||
|
||||
@Getter private boolean started;
|
||||
@Getter private int night = 0;
|
||||
|
@ -84,12 +84,12 @@ public class LGGame implements Listener{
|
|||
@Getter @Setter private int waitTicks;
|
||||
@Getter private boolean day;
|
||||
@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;
|
||||
});
|
||||
@Getter private LGChat dayChat = new LGChat((sender, message) -> {
|
||||
@Getter private final LGChat dayChat = new LGChat((sender, message) -> {
|
||||
return "§e"+sender.getName()+" §6» §f"+message;
|
||||
});
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class LGGame implements Listener{
|
|||
}
|
||||
|
||||
@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) {
|
||||
WrapperPlayServerChat chat = new WrapperPlayServerChat();
|
||||
|
@ -173,8 +173,8 @@ public class LGGame implements Listener{
|
|||
}.runTaskTimer(MainLg.getInstance(), 0, 1);
|
||||
}
|
||||
|
||||
public static interface TextGenerator{
|
||||
public String generate(LGPlayer player, int secondsLeft);
|
||||
public interface TextGenerator{
|
||||
String generate(LGPlayer player, int secondsLeft);
|
||||
}
|
||||
public void cancelWait() {
|
||||
if(waitTask != null) {
|
||||
|
@ -551,8 +551,7 @@ public class LGGame implements Listener{
|
|||
killed.getPlayer().getWorld().strikeLightningEffect(killed.getPlayer().getLocation());
|
||||
|
||||
for(Role role : getRoles())
|
||||
if(role.getPlayers().contains(killed))
|
||||
role.getPlayers().remove(killed);
|
||||
role.getPlayers().remove(killed);
|
||||
|
||||
killed.setDead(true);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import net.minecraft.server.v1_15_R1.PacketPlayOutRespawn;
|
|||
import net.minecraft.server.v1_15_R1.WorldType;
|
||||
|
||||
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) {
|
||||
LGPlayer lgp = cachedPlayers.get(player);
|
||||
if(lgp == null) {
|
||||
|
@ -60,7 +60,7 @@ public class LGPlayer {
|
|||
@Setter @Getter private Role role;
|
||||
private LGChooseCallback chooseCallback;
|
||||
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 String latestObjective;
|
||||
@Getter private CustomScoreboard scoreboard;
|
||||
|
@ -148,8 +148,8 @@ public class LGPlayer {
|
|||
this.chooseCallback = null;
|
||||
}
|
||||
|
||||
public static interface LGChooseCallback{
|
||||
public void callback(LGPlayer choosen);
|
||||
public interface LGChooseCallback{
|
||||
void callback(LGPlayer choosen);
|
||||
}
|
||||
|
||||
public void showView() {
|
||||
|
|
|
@ -44,7 +44,9 @@ import net.minecraft.server.v1_15_R1.PacketPlayOutEntityMetadata;
|
|||
|
||||
public class LGVote {
|
||||
@Getter LGPlayer choosen;
|
||||
private int timeout, initialTimeout, littleTimeout;
|
||||
private int timeout;
|
||||
private final int initialTimeout;
|
||||
private final int littleTimeout;
|
||||
private Runnable callback;
|
||||
private final LGGame game;
|
||||
@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 LGChatCallback defaultCallback;
|
||||
|
||||
public static interface LGChatCallback{
|
||||
public String receive(LGPlayer sender, String message);
|
||||
public default String send(LGPlayer sender, String message) {return null;};
|
||||
public interface LGChatCallback{
|
||||
String receive(LGPlayer sender, String message);
|
||||
default String send(LGPlayer sender, String message) {return null;}
|
||||
}
|
||||
|
||||
public void sendMessage(LGPlayer sender, String message) {
|
||||
|
|
|
@ -15,6 +15,6 @@ public class LGPlayerGotKilledEvent extends LGEvent {
|
|||
|
||||
@Getter private final boolean endGame;
|
||||
@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;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public static enum Reason{
|
||||
public enum Reason{
|
||||
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()),
|
||||
|
|
|
@ -25,30 +25,30 @@ public class JoinListener implements Listener{
|
|||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
|
||||
|
||||
WrapperPlayServerScoreboardTeam myTeam = new WrapperPlayServerScoreboardTeam();
|
||||
myTeam.setName(p.getName());
|
||||
myTeam.setPrefix(WrappedChatComponent.fromText(""));
|
||||
myTeam.setPlayers(Arrays.asList(p.getName()));
|
||||
myTeam.setMode(0);
|
||||
boolean noSpec = p.getGameMode() != GameMode.SPECTATOR;
|
||||
for(Player player : Bukkit.getOnlinePlayers())
|
||||
if(player != p) {
|
||||
if(player.getGameMode() != GameMode.SPECTATOR)
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
if (player != p) {
|
||||
if (player.getGameMode() != GameMode.SPECTATOR)
|
||||
player.hidePlayer(p);
|
||||
WrapperPlayServerScoreboardTeam team = new WrapperPlayServerScoreboardTeam();
|
||||
team.setName(player.getName());
|
||||
team.setPrefix(WrappedChatComponent.fromText(""));
|
||||
team.setPlayers(Arrays.asList(player.getName()));
|
||||
team.setMode(0);
|
||||
|
||||
|
||||
team.sendPacket(p);
|
||||
myTeam.sendPacket(player);
|
||||
}
|
||||
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");
|
||||
else {
|
||||
} else {
|
||||
LGPlayer lgp = LGPlayer.thePlayer(e.getPlayer());
|
||||
lgp.showView();
|
||||
lgp.join(MainLg.getInstance().getCurrentGame());
|
||||
|
@ -62,12 +62,12 @@ public class JoinListener implements Listener{
|
|||
}
|
||||
@EventHandler
|
||||
public void onResoucePack(PlayerResourcePackStatusEvent e) {
|
||||
if(e.getStatus() == Status.SUCCESSFULLY_LOADED) {
|
||||
if (e.getStatus() == Status.SUCCESSFULLY_LOADED) {
|
||||
Player p = e.getPlayer();
|
||||
LGPlayer lgp = LGPlayer.thePlayer(p);
|
||||
lgp.showView();
|
||||
lgp.join(MainLg.getInstance().getCurrentGame());
|
||||
}else if(e.getStatus() == Status.DECLINED || e.getStatus() == Status.FAILED_DOWNLOAD)
|
||||
} 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
|
||||
|
|
|
@ -223,7 +223,7 @@ public class RCupidon extends Role{
|
|||
if(!e.getWinners().contains(lgp))
|
||||
e.getWinners().add(lgp);
|
||||
} 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;
|
||||
if(winEnCouple) {
|
||||
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;
|
||||
|
||||
public class RDictateur extends Role{
|
||||
static private ItemStack[] items = new ItemStack[9];
|
||||
static private Inventory inventory;
|
||||
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();
|
||||
|
|
|
@ -80,7 +80,7 @@ public class REnfantSauvage extends Role{
|
|||
}
|
||||
}, player);
|
||||
}
|
||||
private static Random random = new Random();
|
||||
private static final Random random = new Random();
|
||||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
player.stopChoosing();
|
||||
|
|
|
@ -54,7 +54,7 @@ public class RFaucheur extends Role{
|
|||
return -1;
|
||||
}
|
||||
|
||||
private static Random random = new Random();
|
||||
private static final Random random = new Random();
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onKill(LGPlayerKilledEvent e) {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class RGarde extends Role{
|
|||
//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
|
||||
public void onPlayerKill(LGNightPlayerPreKilledEvent e) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class RLoupGarou extends Role{
|
|||
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;
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import fr.leomelki.loupgarou.events.LGGameEndEvent;
|
|||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
|
||||
public class RLoupGarouBlanc extends Role{
|
||||
private static ItemStack skip;
|
||||
private static final ItemStack skip;
|
||||
static {
|
||||
skip = new ItemStack(Material.IRON_NUGGET);
|
||||
ItemMeta meta = skip.getItemMeta();
|
||||
|
|
|
@ -55,7 +55,7 @@ public class RMontreurDOurs extends Role{
|
|||
return -1;
|
||||
}
|
||||
|
||||
private static Random random = new Random();
|
||||
private static final Random random = new Random();
|
||||
private int lastNight = -1;
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
|
|
@ -130,7 +130,7 @@ public class RPyromane extends Role{
|
|||
@Override
|
||||
protected void onNightTurnTimeout(LGPlayer player) {
|
||||
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);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(event.isCancelled())
|
||||
|
@ -172,7 +172,7 @@ public class RPyromane extends Role{
|
|||
e.setCancelled(true);
|
||||
closeInventory(player);
|
||||
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) {
|
||||
if(!scndPlayer.isDead() && scndPlayer.getPlayer() != null) {
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
List<LGPlayer> liste = lgp.getCache().<List<LGPlayer>>get("pyromane_essence");
|
||||
List<LGPlayer> liste = lgp.getCache().get("pyromane_essence");
|
||||
if(liste.contains(choosen)) {
|
||||
lgp.sendMessage("§7§l"+choosen.getName()+"§c est déjà recouvert de gasoil.");
|
||||
return;
|
||||
|
@ -266,9 +266,9 @@ public class RPyromane extends Role{
|
|||
if(e.getGame() == getGame())
|
||||
for(LGPlayer lgp : getPlayers())
|
||||
if(lgp.getCache().has("pyromane_essence")) {
|
||||
List<LGPlayer> liste = lgp.getCache().<List<LGPlayer>>get("pyromane_essence");
|
||||
if(liste.contains(e.getKilled()))//Au cas où le mec soit rez
|
||||
liste.remove(e.getKilled());
|
||||
List<LGPlayer> liste = lgp.getCache().get("pyromane_essence");
|
||||
//Au cas où le mec soit rez
|
||||
liste.remove(e.getKilled());
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
|
|
|
@ -24,8 +24,8 @@ import fr.leomelki.loupgarou.classes.LGPlayer;
|
|||
import fr.leomelki.loupgarou.events.LGPlayerKilledEvent.Reason;
|
||||
|
||||
public class RSorciere extends Role{
|
||||
private static ItemStack[] items = new ItemStack[4];
|
||||
private static ItemStack cancel;
|
||||
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();
|
||||
|
|
|
@ -82,7 +82,7 @@ public class RVampire extends Role{
|
|||
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;
|
||||
});
|
||||
int nextCanInfect = 0;
|
||||
|
|
|
@ -17,7 +17,7 @@ import lombok.Setter;
|
|||
|
||||
public abstract class Role implements Listener{
|
||||
@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;
|
||||
|
||||
public Role(LGGame game) {
|
||||
|
|
|
@ -21,5 +21,5 @@ public enum RoleSort {
|
|||
Pirate,
|
||||
Bouffon,
|
||||
Sorciere,
|
||||
Corbeau;
|
||||
Corbeau
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ public enum RoleType {
|
|||
VILLAGER,
|
||||
LOUP_GAROU,
|
||||
VAMPIRE,
|
||||
NEUTRAL;
|
||||
NEUTRAL
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ public enum RoleWinType {
|
|||
VILLAGE,
|
||||
LOUP_GAROU,
|
||||
VAMPIRE,
|
||||
NONE;
|
||||
NONE
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
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
|
||||
@Getter @Setter private int score;
|
||||
|
|
|
@ -10,7 +10,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
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) {
|
||||
List<V> list = map.get(key);
|
||||
if(list == null)
|
||||
|
@ -56,7 +56,7 @@ public class MultipleValueMap<K, V> {
|
|||
@AllArgsConstructor
|
||||
public static class MultipleValueKeyEntry<K, V> implements Entry<K, V>{
|
||||
@Getter
|
||||
private K key;
|
||||
private final K key;
|
||||
@Getter
|
||||
private V value;
|
||||
@Override
|
||||
|
|
|
@ -3,10 +3,10 @@ package fr.leomelki.loupgarou.utils;
|
|||
import java.util.HashMap;
|
||||
|
||||
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) {
|
||||
Object object = get(key);
|
||||
return object == null ? false : (boolean)object;
|
||||
return object != null && (boolean) object;
|
||||
}
|
||||
public void set(String key, Object value) {
|
||||
if(cache.containsKey(key))
|
||||
|
|
|
@ -40,7 +40,7 @@ public class VariousUtils {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private static char[] hex = "0123456789abcdef".toCharArray();
|
||||
private static final char[] hex = "0123456789abcdef".toCharArray();
|
||||
public static char toHex(int i) {
|
||||
return hex[i];
|
||||
}
|
||||
|
|
|
@ -5,4 +5,4 @@ main: fr.leomelki.loupgarou.MainLg
|
|||
depend: [ProtocolLib]
|
||||
api-version: 1.13
|
||||
commands:
|
||||
lg:
|
||||
ww:
|
Loading…
Reference in a new issue