rework of countdown sounds
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
6aac93dc64
Commit
f72c5b224a
@ -97,7 +97,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
getCommand("ready").setExecutor(new ReadyCommand());
|
getCommand("ready").setExecutor(new ReadyCommand());
|
||||||
getCommand("kit").setExecutor(new KitCommand());
|
getCommand("kit").setExecutor(new KitCommand());
|
||||||
|
|
||||||
Countdown countdown = new Countdown(Config.NoPlayerOnlineDuration, new FinishNoPlayersOnline(), null);
|
Countdown countdown = new Countdown(Config.NoPlayerOnlineDuration, new FinishNoPlayersOnline(), null, false);
|
||||||
countdown.startTimer(getPlugin());
|
countdown.startTimer(getPlugin());
|
||||||
|
|
||||||
TechHider.init();
|
TechHider.init();
|
||||||
@ -133,7 +133,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
fightState = FightState.PRE_RUNNING;
|
fightState = FightState.PRE_RUNNING;
|
||||||
Countdown.cancelAllTimers();
|
Countdown.cancelAllTimers();
|
||||||
|
|
||||||
Countdown countdown = new Countdown(Config.PreFightDuration, new FinishPreRunning(), Sound.BLOCK_NOTE_PLING);
|
Countdown countdown = new Countdown(Config.PreFightDuration, new FinishPreRunning(), Sound.BLOCK_NOTE_PLING, true);
|
||||||
countdown.startTimer(this);
|
countdown.startTimer(this);
|
||||||
for(FightPlayer allFightPlayers : Fight.getBlueTeam().getPlayers()) {
|
for(FightPlayer allFightPlayers : Fight.getBlueTeam().getPlayers()) {
|
||||||
allFightPlayers.getPlayer().getInventory().clear();
|
allFightPlayers.getPlayer().getInventory().clear();
|
||||||
@ -210,7 +210,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Countdown countdown = new Countdown(Config.SpectatorDuration, new FinishSpectateOver(), Sound.BLOCK_NOTE_PLING);
|
Countdown countdown = new Countdown(Config.SpectatorDuration, new FinishSpectateOver(), Sound.BLOCK_NOTE_PLING, false);
|
||||||
countdown.startTimer(FightSystem.getPlugin());
|
countdown.startTimer(FightSystem.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package me.yaruma.fightsystem.fight;
|
package me.yaruma.fightsystem.fight;
|
||||||
|
|
||||||
import me.yaruma.fightsystem.utils.Config;
|
import me.yaruma.fightsystem.utils.Config;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Fight {
|
public class Fight {
|
||||||
@ -48,4 +50,16 @@ public class Fight {
|
|||||||
public static FightTeam getBlueTeam() {
|
public static FightTeam getBlueTeam() {
|
||||||
return blueTeam;
|
return blueTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void playSound(Sound sound, float volume, float pitch) {
|
||||||
|
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
player.playSound(player.getLocation(), sound, volume, pitch); //volume: max. 100, pitch: max. 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLevel(int level) {
|
||||||
|
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
player.setLevel(level);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,11 +323,4 @@ public class FightTeam {
|
|||||||
player.spigot().sendMessage(beforePage);
|
player.spigot().sendMessage(beforePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(Sound sound, float volume, float pitch) {
|
|
||||||
for(FightPlayer fightPlayer : players) {
|
|
||||||
Player player = fightPlayer.getPlayer();
|
|
||||||
player.playSound(player.getLocation(), sound, volume, pitch); //volume: max. 100, pitch: max. 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import me.yaruma.fightsystem.fight.Fight;
|
|||||||
import me.yaruma.fightsystem.fight.FightTeam;
|
import me.yaruma.fightsystem.fight.FightTeam;
|
||||||
import me.yaruma.fightsystem.utils.Config;
|
import me.yaruma.fightsystem.utils.Config;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -27,6 +28,8 @@ public class PlayerDeathListener implements Listener {
|
|||||||
player.teleport(Config.TeamRedSpawn);
|
player.teleport(Config.TeamRedSpawn);
|
||||||
else
|
else
|
||||||
player.teleport(Config.TeamBlueSpawn);
|
player.teleport(Config.TeamBlueSpawn);
|
||||||
|
|
||||||
|
Fight.playSound(Sound.ENTITY_WITHER_DEATH, 100.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class PlayerJoinListener implements Listener {
|
|||||||
if(Fight.getRedTeam().hasTeamLeader() && Fight.getBlueTeam().hasTeamLeader() && FightSystem.getFightState() == FightState.SETUP
|
if(Fight.getRedTeam().hasTeamLeader() && Fight.getBlueTeam().hasTeamLeader() && FightSystem.getFightState() == FightState.SETUP
|
||||||
&& (Fight.getRedTeam().getLeader().getPlayer() == player || Fight.getBlueTeam().getLeader().getPlayer() == player)) {
|
&& (Fight.getRedTeam().getLeader().getPlayer() == player || Fight.getBlueTeam().getLeader().getPlayer() == player)) {
|
||||||
Countdown.cancelTimerType(CountdownType.NO_PLAYERS_ONLINE);
|
Countdown.cancelTimerType(CountdownType.NO_PLAYERS_ONLINE);
|
||||||
new Countdown(Config.SetupDuration, new FinishSetupOver(), null).startTimer(FightSystem.getPlugin());
|
new Countdown(Config.SetupDuration, new FinishSetupOver(), null, false).startTimer(FightSystem.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
FightSystem.getPlugin().getScoreboard().setAutoScoreboard(20*10, player);
|
FightSystem.getPlugin().getScoreboard().setAutoScoreboard(20*10, player);
|
||||||
|
@ -16,11 +16,13 @@ public class Countdown {
|
|||||||
private final CountdownCallback countdownCallback;
|
private final CountdownCallback countdownCallback;
|
||||||
private int taskID;
|
private int taskID;
|
||||||
private Sound sound;
|
private Sound sound;
|
||||||
|
private boolean level;
|
||||||
|
|
||||||
public Countdown(int time, CountdownCallback countdownCallback, Sound sound) {
|
public Countdown(int time, CountdownCallback countdownCallback, Sound sound, boolean level) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.countdownCallback = countdownCallback;
|
this.countdownCallback = countdownCallback;
|
||||||
this.sound = sound;
|
this.sound = sound;
|
||||||
|
this.level = level;
|
||||||
countdowns.add(this);
|
countdowns.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,28 +36,28 @@ public class Countdown {
|
|||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time / 60 + " §7Minuten " + countdownCallback.countdownCounting());
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time / 60 + " §7Minuten " + countdownCallback.countdownCounting());
|
||||||
break;
|
break;
|
||||||
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
|
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
|
||||||
if(this.sound != null) {
|
if(this.sound != null)
|
||||||
Fight.getBlueTeam().playSound(this.sound, 100.0F, 1.0F);
|
Fight.playSound(this.sound, 100.0F, 1.0F);
|
||||||
Fight.getRedTeam().playSound(this.sound, 100.0F, 1.0F);
|
|
||||||
}
|
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time + " §7Sekunden " + countdownCallback.countdownCounting());
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time + " §7Sekunden " + countdownCallback.countdownCounting());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if(this.sound != null) {
|
if(this.sound != null)
|
||||||
Fight.getBlueTeam().playSound(this.sound, 100.0F, 1.0F);
|
Fight.playSound(this.sound, 100.0F, 1.0F);
|
||||||
Fight.getRedTeam().playSound(this.sound, 100.0F, 1.0F);
|
|
||||||
}
|
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §aeine §7Sekunde " + countdownCallback.countdownCounting());
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §aeine §7Sekunde " + countdownCallback.countdownCounting());
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
if(this.sound != null) {
|
if(this.sound != null)
|
||||||
Fight.getBlueTeam().playSound(this.sound, 100.0F, 2.0F);
|
Fight.playSound(this.sound, 100.0F, 2.0F);
|
||||||
Fight.getRedTeam().playSound(this.sound, 100.0F, 2.0F);
|
|
||||||
}
|
|
||||||
cancelTimer();
|
cancelTimer();
|
||||||
countdownCallback.countdownFinished();
|
countdownCallback.countdownFinished();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(this.level)
|
||||||
|
Fight.setLevel(time);
|
||||||
|
|
||||||
time--;
|
time--;
|
||||||
if(countdownCallback instanceof FinishTimeOver) FightSystem.setFightTime(time);
|
if(countdownCallback instanceof FinishTimeOver) FightSystem.setFightTime(time);
|
||||||
}, 0, 20);
|
}, 0, 20);
|
||||||
|
@ -13,7 +13,7 @@ public class WinconditionEntern {
|
|||||||
public static void entern() {
|
public static void entern() {
|
||||||
if(!Config.Entern) return;
|
if(!Config.Entern) return;
|
||||||
|
|
||||||
Countdown countdownTimeOver = new Countdown(Config.EnterPhaseBegin, new FinishNoneEntern(), Sound.BLOCK_NOTE_PLING);
|
Countdown countdownTimeOver = new Countdown(Config.EnterPhaseBegin, new FinishNoneEntern(), Sound.BLOCK_NOTE_PLING, false);
|
||||||
countdownTimeOver.startTimer(instance);
|
countdownTimeOver.startTimer(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public class WinconditionTimeout {
|
|||||||
public static void timeout() {
|
public static void timeout() {
|
||||||
if(!Config.Timeout) return;
|
if(!Config.Timeout) return;
|
||||||
|
|
||||||
Countdown countdownTimeOver = new Countdown(Config.TimeoutTime, new FinishTimeOver(), Sound.BLOCK_NOTE_BASS);
|
Countdown countdownTimeOver = new Countdown(Config.TimeoutTime, new FinishTimeOver(), Sound.BLOCK_NOTE_BASS, false);
|
||||||
countdownTimeOver.startTimer(instance);
|
countdownTimeOver.startTimer(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren