Skip to content

Commit

Permalink
⬆️Upgrade to hyrame 1.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Caliix committed Feb 2, 2023
1 parent 7c4b122 commit 5e0b1ff
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 30 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ 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")
}
}
}

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 {
Expand All @@ -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"
}
}
}
5 changes: 3 additions & 2 deletions src/main/java/fr/hyriode/lasergame/HyriLaserGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -103,7 +104,7 @@ public void onEnable() {
e.printStackTrace();
}

HyriAPI.get().getServer().setState(IHyriServer.State.READY);
HyriAPI.get().getServer().setState(HyggServer.State.READY);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/fr/hyriode/lasergame/game/LGGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<LGGamePlayer> {
Expand All @@ -63,7 +61,6 @@ public LGGame(IHyrame hyrame, HyriLaserGame plugin) {

for (ELGGameTeam team : ELGGameTeam.values())
this.registerTeam(this.createTeam(team));

}

@Override
Expand Down Expand Up @@ -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<String> rewards = new ArrayList<>();

rewards.add(ChatColor.LIGHT_PURPLE + String.valueOf(hyris) + " Hyris");
Expand Down Expand Up @@ -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){
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/fr/hyriode/lasergame/game/LGGameTeam.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/fr/hyriode/lasergame/game/LGGameType.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class LGLaserGun extends HyriItem<HyriLaserGame> {
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;
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/fr/hyriode/lasergame/game/player/LGGamePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(){
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5e0b1ff

Please sign in to comment.