Skip to content

Commit

Permalink
Update to latest PGM
Browse files Browse the repository at this point in the history
Signed-off-by: Austin L Mayes <[email protected]>
  • Loading branch information
AustinLMayes authored and mattarnold98 committed Jan 1, 2021
1 parent bdb9ddd commit 6460162
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<dependency>
<groupId>tc.oc.pgm</groupId>
<artifactId>core</artifactId>
<version>0.10-SNAPSHOT</version>
<version>0.11-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>tc.oc.pgm</groupId>
<artifactId>util</artifactId>
<version>0.10-SNAPSHOT</version>
<version>0.11-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package dev.pgm.events.format.rounds.veto;

import static tc.oc.pgm.lib.net.kyori.adventure.text.Component.text;

import dev.pgm.events.team.TournamentTeam;
import java.time.Duration;
import java.util.Optional;
import net.md_5.bungee.api.chat.BaseComponent;
import tc.oc.pgm.api.match.Match;
import tc.oc.pgm.countdowns.MatchCountdown;
import tc.oc.pgm.lib.net.kyori.text.Component;
import tc.oc.pgm.lib.net.kyori.text.TextComponent;
import tc.oc.pgm.lib.net.kyori.adventure.text.Component;

public class VetoCountdown extends MatchCountdown {

Expand All @@ -25,7 +26,7 @@ public VetoCountdown(

@Override
protected Component formatText() {
return TextComponent.of(message);
return text(message);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package dev.pgm.events.format.shutdown;

import static tc.oc.pgm.lib.net.kyori.adventure.key.Key.key;
import static tc.oc.pgm.lib.net.kyori.adventure.text.Component.text;

import dev.pgm.events.utils.TimeFormatter;
import java.time.Duration;
import org.bukkit.Bukkit;
import tc.oc.pgm.api.match.Match;
import tc.oc.pgm.countdowns.MatchCountdown;
import tc.oc.pgm.lib.net.kyori.text.Component;
import tc.oc.pgm.lib.net.kyori.text.TextComponent;
import tc.oc.pgm.lib.net.kyori.text.format.TextColor;
import tc.oc.pgm.util.chat.Sound;
import tc.oc.pgm.lib.net.kyori.adventure.sound.Sound;
import tc.oc.pgm.lib.net.kyori.adventure.text.Component;
import tc.oc.pgm.lib.net.kyori.adventure.text.format.NamedTextColor;

public class ShutdownCountdown extends MatchCountdown {

protected static final Sound COUNT_SOUND = new Sound("note.pling", 1f, 1.19f);
protected static final Sound COUNT_SOUND =
Sound.sound(key("note.pling"), Sound.Source.MASTER, 1f, 1.19f);

public ShutdownCountdown(Match match) {
super(match);
Expand All @@ -32,8 +35,8 @@ protected boolean showTitle() {

@Override
protected Component formatText() {
return TextComponent.of(
"Server will shut down in " + TimeFormatter.seconds(remaining), TextColor.AQUA);
return text(
"Server will shut down in " + TimeFormatter.seconds(remaining), NamedTextColor.AQUA);
}

@Override
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/dev/pgm/events/listeners/PlayerJoinListen.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.pgm.events.listeners;

import static tc.oc.pgm.lib.net.kyori.adventure.text.Component.text;

import dev.pgm.events.team.TournamentTeamManager;
import java.util.Optional;
import org.bukkit.Bukkit;
Expand All @@ -13,8 +15,7 @@
import tc.oc.pgm.blitz.BlitzMatchModule;
import tc.oc.pgm.events.PlayerParticipationStartEvent;
import tc.oc.pgm.events.PlayerParticipationStopEvent;
import tc.oc.pgm.lib.net.kyori.text.TextComponent;
import tc.oc.pgm.lib.net.kyori.text.format.TextColor;
import tc.oc.pgm.lib.net.kyori.adventure.text.format.NamedTextColor;
import tc.oc.pgm.teams.Team;

public class PlayerJoinListen implements Listener {
Expand Down Expand Up @@ -86,15 +87,15 @@ public void onParticipate(PlayerParticipationStartEvent event) {
if (!isFull(team)) return;
}

event.cancel(TextComponent.of("You may not join in a tournament setting!", TextColor.RED));
event.cancel(text("You may not join in a tournament setting!", NamedTextColor.RED));
}

@EventHandler
public void onLeaveParticipate(PlayerParticipationStopEvent event) {
Optional<Team> playerTeam = manager.playerTeam(event.getPlayer().getId());
// check if the player is on one of the teams
if (playerTeam.isPresent())
event.cancel(TextComponent.of("You may not leave in a tournament setting!", TextColor.RED));
event.cancel(text("You may not leave in a tournament setting!", NamedTextColor.RED));

BlitzMatchModule blitz = event.getMatch().getModule(BlitzMatchModule.class);
if (blitz != null) {
Expand Down

0 comments on commit 6460162

Please sign in to comment.