diff --git a/build.gradle b/build.gradle index 9728e1a..afaefe3 100644 --- a/build.gradle +++ b/build.gradle @@ -31,8 +31,8 @@ repositories { url = 'https://maven.pkg.github.com/Hyriode/Hyrame/' credentials { - username System.getenv("GITHUB_USERNAME") - password System.getenv("GITHUB_TOKEN") + username System.getenv("USERNAME") + password System.getenv("TOKEN") } } } @@ -40,7 +40,7 @@ repositories { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') shadow 'xyz.xenondevs:particle:1.7' - implementation 'fr.hyriode:hyrame:1.3.4' + implementation 'fr.hyriode:hyrame:1.3.5' } processResources { @@ -60,10 +60,11 @@ shadowJar { } task deploy(dependsOn: shadowJar) { + //delete "H:/Dev/dev Mc/Serveurs/hyriode/HyriLaserGame/plugins/HyriLaserGame-1.0.0-all.jar" doLast { copy { from "$buildDir/libs/HyriLaserGame-1.0.0-all.jar" - into "$buildDir/libs/TestServeur/plugins" + into "H:/Dev/dev Mc/Serveurs/hyriode/HyriLaserGame/plugins" } } } diff --git a/src/main/java/fr/hyriode/lasergame/HyriLaserGame.java b/src/main/java/fr/hyriode/lasergame/HyriLaserGame.java index 276d5bb..708410b 100644 --- a/src/main/java/fr/hyriode/lasergame/HyriLaserGame.java +++ b/src/main/java/fr/hyriode/lasergame/HyriLaserGame.java @@ -2,6 +2,7 @@ import fr.hyriode.api.HyriAPI; import fr.hyriode.api.server.IHyriServer; +import fr.hyriode.hyggdrasil.api.server.HyggServer; import fr.hyriode.hyrame.HyrameLoader; import fr.hyriode.hyrame.IHyrame; import fr.hyriode.hyrame.utils.LocationWrapper; @@ -85,7 +86,7 @@ public void onEnable() { new LocationWrapper(-3.5, 145, -17.5) ), Arrays.asList( - ), 20, false, 30); + ), 20, false, 60*5); // , "lasergame", LGGameType.FIVE_FIVE.getName(), "Nexus").whenComplete((aBoolean, throwable) -> System.out.println("ui " + aBoolean));//, "lasergame", LGGameType.FIVE_FIVE.getName(), "Evolution").whenComplete((aBoolean, throwable) -> System.out.println(aBoolean)); //// HyriAPI.get().getServer().setSlots(50); } @@ -103,7 +104,7 @@ public void onEnable() { e.printStackTrace(); } - HyriAPI.get().getServer().setState(IHyriServer.State.READY); + HyriAPI.get().getServer().setState(HyggServer.State.READY); } @Override diff --git a/src/main/java/fr/hyriode/lasergame/api/player/HyriLGPlayer.java b/src/main/java/fr/hyriode/lasergame/api/player/HyriLGPlayer.java index a133eb2..1c22e42 100644 --- a/src/main/java/fr/hyriode/lasergame/api/player/HyriLGPlayer.java +++ b/src/main/java/fr/hyriode/lasergame/api/player/HyriLGPlayer.java @@ -89,7 +89,7 @@ public long getCurrentWinStreak() { public void update(LGGamePlayer gamePlayer) { IHyriPlayer player = HyriAPI.get().getPlayerManager().getPlayer(gamePlayer.getUniqueId()); - this.addPlayedTime(gamePlayer.getPlayedTime()); + this.addPlayedTime(gamePlayer.getPlayTime()); this.addKills(gamePlayer.getKills()); this.addDeaths(gamePlayer.getDeaths()); this.setBestKillStreak(gamePlayer.getDeaths()); diff --git a/src/main/java/fr/hyriode/lasergame/game/LGGame.java b/src/main/java/fr/hyriode/lasergame/game/LGGame.java index e03d371..2d2f594 100644 --- a/src/main/java/fr/hyriode/lasergame/game/LGGame.java +++ b/src/main/java/fr/hyriode/lasergame/game/LGGame.java @@ -36,9 +36,7 @@ import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; public class LGGame extends HyriGame { @@ -63,7 +61,6 @@ public LGGame(IHyrame hyrame, HyriLaserGame plugin) { for (ELGGameTeam team : ELGGameTeam.values()) this.registerTeam(this.createTeam(team)); - } @Override @@ -256,15 +253,15 @@ public void win(HyriGameTeam winner) { continue; } - killsLines.add(line.replace("%player%", HyriAPI.get().getPlayerManager().getPlayer(endPlayer.getUniqueId()).getNameWithRank(true)) + killsLines.add(line.replace("%player%", HyriAPI.get().getPlayerManager().getPlayer(endPlayer.getUniqueId()).getNameWithRank()) .replace("%kills%", String.valueOf(endPlayer.getAllPoints()))); } final int kills = gamePlayer.getKills(); final boolean isWinner = winner.contains(gamePlayer); - final long hyris = HyriRewardAlgorithm.getHyris(kills, gamePlayer.getPlayedTime(), isWinner); - final long xp = HyriRewardAlgorithm.getXP(kills, gamePlayer.getPlayedTime(), isWinner); + final long hyris = HyriRewardAlgorithm.getHyris(kills, gamePlayer.getPlayTime(), isWinner); + final double xp = HyriRewardAlgorithm.getXP(kills, gamePlayer.getPlayTime(), isWinner); final List rewards = new ArrayList<>(); rewards.add(ChatColor.LIGHT_PURPLE + String.valueOf(hyris) + " Hyris"); @@ -350,7 +347,7 @@ private void kickPlayersInBase(Location locFirst, Location locSecond, Location s } private HyriGameTeam createTeam(ELGGameTeam gameTeam){ - return new LGGameTeam(this, this.plugin, gameTeam, ((LGGameType)this.type).getTeamsSize()); + return new LGGameTeam(this.plugin, gameTeam, ((LGGameType)this.type).getTeamsSize()); } private void doorAnimationOpen(Location locFirst, Location locSecond, BlockState blockk){ diff --git a/src/main/java/fr/hyriode/lasergame/game/LGGameTeam.java b/src/main/java/fr/hyriode/lasergame/game/LGGameTeam.java index 99294ff..b67860b 100644 --- a/src/main/java/fr/hyriode/lasergame/game/LGGameTeam.java +++ b/src/main/java/fr/hyriode/lasergame/game/LGGameTeam.java @@ -11,8 +11,8 @@ public class LGGameTeam extends HyriGameTeam { private final HyriLaserGame plugin; - public LGGameTeam(HyriGame game, HyriLaserGame plugin, ELGGameTeam color, int teamSize) { - super(game, color.getName(), color.getDisplayName().get(), color.getColor(), false, HyriScoreboardTeam.NameTagVisibility.NEVER, teamSize); + public LGGameTeam(HyriLaserGame plugin, ELGGameTeam color, int teamSize) { + super(color.getName(), color.getDisplayName().get(), color.getColor(), false, HyriScoreboardTeam.NameTagVisibility.NEVER, teamSize); this.plugin = plugin; this.initConfig(); } diff --git a/src/main/java/fr/hyriode/lasergame/game/LGGameType.java b/src/main/java/fr/hyriode/lasergame/game/LGGameType.java index 8aac6e0..a5297c8 100644 --- a/src/main/java/fr/hyriode/lasergame/game/LGGameType.java +++ b/src/main/java/fr/hyriode/lasergame/game/LGGameType.java @@ -1,9 +1,10 @@ package fr.hyriode.lasergame.game; +import fr.hyriode.api.HyriAPI; import fr.hyriode.hyrame.game.HyriGameType; public enum LGGameType implements HyriGameType { - FIVE_FIVE("5v5", 5, 6, 10), + FIVE_FIVE("5v5", 5, 2, 10), ; private final String name; @@ -14,7 +15,7 @@ public enum LGGameType implements HyriGameType { LGGameType(String name, int teamsSize, int minPlayers, int maxPlayers){ this.name = name; this.teamsSize = teamsSize; - this.minPlayers = minPlayers; + this.minPlayers = HyriAPI.get().getConfig().isDevEnvironment() ? 2 : minPlayers; this.maxPlayers = maxPlayers; } diff --git a/src/main/java/fr/hyriode/lasergame/game/item/LGLaserGun.java b/src/main/java/fr/hyriode/lasergame/game/item/LGLaserGun.java index d69962f..83cb2f2 100644 --- a/src/main/java/fr/hyriode/lasergame/game/item/LGLaserGun.java +++ b/src/main/java/fr/hyriode/lasergame/game/item/LGLaserGun.java @@ -37,7 +37,7 @@ public class LGLaserGun extends HyriItem { private boolean enable; public LGLaserGun(HyriLaserGame plugin) { - super(plugin, "lasergun", () -> HyriLanguageMessage.get("item.lasergun"), ArrayList::new, Material.IRON_HOE); + super(plugin, "lasergun", () -> HyriLanguageMessage.get("item.lasergun"), () -> HyriLanguageMessage.get("lore.lasergun"), Material.IRON_HOE); this.enable = false; } diff --git a/src/main/java/fr/hyriode/lasergame/game/player/LGGamePlayer.java b/src/main/java/fr/hyriode/lasergame/game/player/LGGamePlayer.java index 5834aa1..602768f 100644 --- a/src/main/java/fr/hyriode/lasergame/game/player/LGGamePlayer.java +++ b/src/main/java/fr/hyriode/lasergame/game/player/LGGamePlayer.java @@ -47,8 +47,8 @@ public class LGGamePlayer extends HyriGamePlayer { private int killStreak; - public LGGamePlayer(HyriGame game, Player player) { - super(game, player); + public LGGamePlayer(Player player) { + super(player); } public LGGamePlayer setPlugin(HyriLaserGame plugin) { @@ -98,7 +98,7 @@ public void run() { this.player.sendMessage(HyriLanguageMessage.get("player.death.title").getValue(this.player)); Bukkit.getScheduler().runTaskLaterAsynchronously(this.plugin, () -> { - if(this.game.getState() != HyriGameState.ENDED) { + if(this.plugin.getGame().getState() != HyriGameState.ENDED) { this.setNotDead(); this.playReviveSound(player); this.giveArmor(); @@ -115,12 +115,12 @@ public void playReviveSound(final Player player) { } public void giveArmor(){ - giveArmor(this.team.getColor().getDyeColor().getColor()); + giveArmor(this.getTeam().getColor().getDyeColor().getColor()); } public void giveInverseArmor(){ this.giveArmor(this.plugin.getGame().getTeams().stream() - .filter(hyriGameTeam -> hyriGameTeam.getColor() != team.getColor()).collect(Collectors.toList()).get(0) + .filter(hyriGameTeam -> hyriGameTeam.getColor() != this.getTeam().getColor()).collect(Collectors.toList()).get(0) .getColor().getDyeColor().getColor()); } diff --git a/src/main/java/fr/hyriode/lasergame/game/scoreboard/LGScoreboard.java b/src/main/java/fr/hyriode/lasergame/game/scoreboard/LGScoreboard.java index d81ed30..22668dc 100644 --- a/src/main/java/fr/hyriode/lasergame/game/scoreboard/LGScoreboard.java +++ b/src/main/java/fr/hyriode/lasergame/game/scoreboard/LGScoreboard.java @@ -3,7 +3,6 @@ import fr.hyriode.api.language.HyriLanguageMessage; import fr.hyriode.hyrame.game.HyriGameState; import fr.hyriode.hyrame.game.scoreboard.HyriGameScoreboard; -import fr.hyriode.hyrame.game.scoreboard.HyriScoreboardIpConsumer; import fr.hyriode.hyrame.game.team.HyriGameTeam; import fr.hyriode.hyrame.title.Title; import fr.hyriode.lasergame.HyriLaserGame; @@ -30,15 +29,15 @@ public LGScoreboard(HyriLaserGame plugin, LGGame game, Player player) { this.timeOriginSecond = plugin.getConfiguration().getTimeSecond(); this.setLine(0, this.getDateLine(), scoreboardLine -> scoreboardLine.setValue(this.getDateLine()), 20); - this.setLine(1, " "); + this.addBlankLine(1); this.setLine(2, this.getTeamLine()); this.setLine(3, this.getTimeLine(), line -> line.setValue(this.getTimeLine()), 20); this.setLine(4, this.getBonusLine(), line -> line.setValue(this.getBonusLine()), 1); - this.setLine(5, " "); + this.addBlankLine(5); this.setLine(6, this.getPointsLine(), line -> line.setValue(this.getPointsLine()), 2); this.setLine(7, this.getPointsAdverseLine(), line -> line.setValue(this.getPointsAdverseLine()), 2); - this.setLine(8, " "); - this.setLine(9, ChatColor.DARK_AQUA + "hyriode.fr", new HyriScoreboardIpConsumer("hyriode.fr"), 2); + this.addBlankLine(8); + this.addHostnameLine(); } private String getTeamLine(){ diff --git a/src/main/resources/lang/en.json b/src/main/resources/lang/en.json index 92e6749..76a496b 100644 --- a/src/main/resources/lang/en.json +++ b/src/main/resources/lang/en.json @@ -5,6 +5,7 @@ "red.display": "Red", "item.lasergun": "&4Laser Gun", + "lore.lasergun": "Shoot on everyone", "player.death.title": "&cYou are dead!", "player.death.subtitle": "&cYou will be able to shoot in %ss", diff --git a/src/main/resources/lang/fr.json b/src/main/resources/lang/fr.json index 60b8418..33e5a1b 100644 --- a/src/main/resources/lang/fr.json +++ b/src/main/resources/lang/fr.json @@ -5,6 +5,7 @@ "red.display": "Rouge", "item.lasergun": "&4Pistolet Laser", + "lore.lasergun": "&7Tirez sur vos ennemis", "player.death.title": "&cVous ĂȘtes mort!", "player.death.subtitle": "&cVous pourrez tirer dans %ss",