SteamWar/FightSystem
Archiviert
13
1

Fixes, Fixes, Fixes

Dieser Commit ist enthalten in:
lixfel 2019-03-26 12:00:56 +01:00
Ursprung d22ab0669e
Commit 9b9da7ff6c
18 geänderte Dateien mit 137 neuen und 80 gelöschten Zeilen

1
.gitignore vendored
Datei anzeigen

@ -1,3 +1,2 @@
.idea
pom.xml
*.iml

78
pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>me.yaruma</groupId>
<artifactId>FightSystem</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<url>https://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>maven</id>
<url>https://warking.de:81/maven/</url>
</repository>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.kt</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>warking</groupId>
<artifactId>SpigotCore</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>warking</groupId>
<artifactId>WorldEdit</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>warking</groupId>
<artifactId>FAWE</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -3,7 +3,6 @@ Times:
SetupDuration: 0
PreFightDuration: 0
SpectatorDuration: 0
Arena:
Schemsize:
x: 0
@ -22,30 +21,25 @@ Arena:
z: 0
underArenaBorder: 0
BorderFromSchematic: 0
Output:
TeamRedColor: &c
TeamBlueColor: &3
TeamRedName: Team1
TeamBlueName: Team2
GameName: AirWargear
GameName: AirShip
TeamChatDetection: +
WinConditions:
Timeout: boolean
AllDead: boolean
CaptainDead: boolean
PercentSystem: boolean
Entern: boolean
WinConditionParams:
TimeoutTime: 0
EnterPhaseBegin: 0
PercentWin: 0
Fight:
OnlyPublicSchematics: boolean
Money:
Win: 0
Lose: 0

Datei anzeigen

@ -24,8 +24,8 @@ import java.io.File;
public class FightSystem extends JavaPlugin {
public static String PREFIX = "[FightSystem] ";
public static String NOPERM = PREFIX + "§4Du darfst das nicht!";
public static final String PREFIX = "§6Arena§8» ";
public static final String NOPERM = PREFIX + "§cDu darfst das nicht!";
private static FightSystem plugin;
private FileManager fileManager;
@ -171,14 +171,10 @@ public class FightSystem extends JavaPlugin {
int setupDuration = fileManager.getIntegerFromConfig("Times.NoPlayersOnlineDuration");
Countdown countdown = new Countdown(setupDuration, new FinishNoPlayersOnline());
countdown.startTimer(getPlugin());
System.out.println(PREFIX + "§aPlugin gestartet!");
}
public void onDisable() {
System.out.println(PREFIX + "§cPlugin deaktiviert!");
}
private void init() {
@ -276,9 +272,7 @@ public class FightSystem extends JavaPlugin {
WorldEdit.replace(Fight.getBlueTeam().getLeader().getPlayer(), team1cornerX, team1cornerY, team1cornerZ, team1cornerX + schemsizeX, team1cornerY + schemsizeY, team1cornerZ + schemsizeZ);
WorldEdit.replace(Fight.getRedTeam().getLeader().getPlayer(), team2cornerX, team2cornerY, team2cornerZ, team2cornerX + schemsizeX, team2cornerY + schemsizeY, team2cornerZ + schemsizeZ);
Bukkit.broadcastMessage(" ");
Bukkit.broadcastMessage("§aDer Fight beginnt!");
Bukkit.broadcastMessage(" ");
Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!");
}
private void setAllPlayersGM(GameMode gm) {
@ -303,7 +297,7 @@ public class FightSystem extends JavaPlugin {
WinconditionTimeout.timeout();
WinconditionEntern.entern();
Bukkit.broadcastMessage("§aArena freigegeben!");
Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!");
}
public void setSpectateState(FightTeam winFightTeam) {
@ -316,8 +310,7 @@ public class FightSystem extends JavaPlugin {
Bukkit.broadcastMessage(" ");
if(winFightTeam != null) {
Bukkit.broadcastMessage(PREFIX + "§aDas Team von §6" + winFightTeam.getLeader().getPlayer().getName() + " §ahat gewonnen!");
Bukkit.broadcastMessage(PREFIX + "§aDas Team " + winFightTeam.getPrefix() + winFightTeam.getName() + " §ahat gewonnen!");
plugin.getFightManager().teleportAllToFightSpawn();
for(FightPlayer fightPlayer : winFightTeam.getPlayers()) {
@ -328,17 +321,17 @@ public class FightSystem extends JavaPlugin {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Lose"));
}
} else {
//Keine Message! Wird in FinishTimeOver gesendet!
for(FightPlayer fightPlayer : winFightTeam.getPlayers()) {
Bukkit.broadcastMessage(PREFIX + "§aKein Team hat gewonnen!");
for(FightPlayer fightPlayer : Fight.getBlueTeam().getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Undecided"));
}
for(FightPlayer fightPlayer : Fight.getOpposite(winFightTeam).getPlayers()) {
for(FightPlayer fightPlayer : Fight.getRedTeam().getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Undecided"));
}
}
Countdown countdown = new Countdown(20*60, new FinishSpectateOver());
Countdown countdown = new Countdown(fileManager.getIntegerFromConfig("Times.SpectatorDuration"), new FinishSpectateOver());
countdown.startTimer(FightSystem.getPlugin());
}

Datei anzeigen

@ -6,6 +6,7 @@ import me.yaruma.fightsystem.fight.FightTeam;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
@ -13,13 +14,13 @@ public class PlayerDeathListener implements Listener {
FightSystem instance = FightSystem.getPlugin();
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public void handlePlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity().getPlayer();
if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player);
fightTeam.getFightPlayer(player).setOut(true);
event.setDeathMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §cist gestorben!");
fightTeam.getFightPlayer(player).setOut(true);
}

Datei anzeigen

@ -26,8 +26,8 @@ public class PlayerQuitListener implements Listener {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Kampf verlassen!");
if(fightTeam.allPlayersOut() && FightSystem.getPlugin().getFightState() == FightState.SETUP) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von §6" + fightTeam.getLeader().getPlayer() + " §chaben den Kampf verlassen! \n §4Stoppe Server in 30 Sekunden...");
Countdown countdown = new Countdown(30*20, new FinishNoPlayersOnline());
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team " + fightTeam.getPrefix() + fightTeam.getName() + " §chaben den Kampf verlassen!");
Countdown countdown = new Countdown(30, new FinishNoPlayersOnline());
countdown.startTimer(FightSystem.getPlugin());
}
}

Datei anzeigen

@ -18,26 +18,22 @@ public class Countdown {
this.time = time;
this.countdownCallback = countdownCallback;
countdowns.add(this);
if(countdownCallback instanceof FinishTimeOver) FightSystem.getPlugin().fightTime = time;
}
public void startTimer(FightSystem plugin) {
BukkitScheduler bukkitScheduler = Bukkit.getServer().getScheduler();
this.taskID = bukkitScheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
this.taskID = bukkitScheduler.scheduleSyncRepeatingTask(plugin, () -> {
switch (time) {
case 600: case 300:
Bukkit.broadcastMessage("§6Noch §a" + time / 60 + " §6Minuten " + countdownCallback.countdownCounting());
case 900: case 600: case 300: case 180: case 120:
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time / 60 + " §7Minuten " + countdownCallback.countdownCounting());
break;
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
Bukkit.broadcastMessage("§6Noch §a" + time + " §6Sekunden " + countdownCallback.countdownCounting());
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time + " §7Sekunden " + countdownCallback.countdownCounting());
break;
case 1:
Bukkit.broadcastMessage("§6Noch §aeine §6Sekunde " + countdownCallback.countdownCounting());
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §aeine §7Sekunde " + countdownCallback.countdownCounting());
break;
case 0:
cancelTimer();
@ -45,7 +41,7 @@ public class Countdown {
break;
}
time--;
}
if(countdownCallback instanceof FinishTimeOver) FightSystem.getPlugin().fightTime = time;
}, 0, 20);
}
@ -53,10 +49,10 @@ public class Countdown {
try {
Bukkit.getScheduler().cancelTask(this.taskID);
countdowns.remove(this);
} catch (AssertionError ex) {
ex.printStackTrace();
}
countdowns.remove(this);
}
public static void cancelAllTimers() {

Datei anzeigen

@ -11,7 +11,6 @@ public class FinishNoPlayersOnline implements CountdownCallback {
@Override
public void countdownFinished() {
Bukkit.broadcastMessage("§aStoppe Server...");
Bukkit.getServer().shutdown();
}

Datei anzeigen

@ -13,7 +13,7 @@ public class FinishNoneEntern implements CountdownCallback {
@Override
public void countdownFinished() {
FightSystem.getPlugin().entern = true;
Bukkit.broadcastMessage("§aEntern ist nun erlaubt!");
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!");
}
@Override

Datei anzeigen

@ -1,5 +1,6 @@
package me.yaruma.fightsystem.utils.countdown;
import me.yaruma.fightsystem.FightSystem;
import org.bukkit.Bukkit;
public class FinishSetupOver implements CountdownCallback {
@ -11,7 +12,7 @@ public class FinishSetupOver implements CountdownCallback {
@Override
public void countdownFinished() {
Bukkit.broadcastMessage("Fight wird abgebrochen! \n Stoppe Server...");
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cKampf wird abgebrochen!");
Bukkit.getServer().shutdown();
}

Datei anzeigen

@ -11,7 +11,6 @@ public class FinishSpectateOver implements CountdownCallback {
@Override
public void countdownFinished() {
Bukkit.broadcastMessage("§aStoppe Server...");
Bukkit.getServer().shutdown();
}

Datei anzeigen

@ -12,7 +12,7 @@ public class FinishTimeOver implements CountdownCallback {
@Override
public void countdownFinished() {
Bukkit.broadcastMessage("§aZeit abgelaufen! Der Kampf ist vorbei...");
Bukkit.broadcastMessage(FightSystem.PREFIX +"§aZeit abgelaufen!");
FightSystem.getPlugin().setSpectateState(null);
}

Datei anzeigen

@ -37,7 +37,7 @@ public class Scoreboard {
scoreboard.registerNewObjective("AAA", "BBB");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName("§6Info " + fightTeam.getPrefix() + fightTeam.getName());
objective.setDisplayName(fightTeam.getPrefix() + fightTeam.getName());
for(FightPlayer fp : fightTeam.getPlayers()) {
objective.getScore(fightTeam.getPrefix() + fp.getPlayer().getName()).setScore((int) fp.getPlayer().getHealth());
@ -51,9 +51,15 @@ public class Scoreboard {
scoreboard.registerNewObjective("AAA", "BBB");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName("§6Fight Info");
objective.getScore("§7Zeit: §a" + FightSystem.getPlugin().getFightTime()).setScore(3);
if(Methods.isEnabled("Fight.Entern")) objective.getScore("§7Entern: " + (FightSystem.getPlugin().isEntern() ? "§aja" : "§cnein")).setScore(2);
objective.setDisplayName("§6Kampf");
if(Methods.isEnabled("WinConditions.Timeout")){
int fightTime = FightSystem.getPlugin().getFightTime();
if(fightTime >= 60)
objective.getScore("§7Zeit: §a" + fightTime/60 + "m " + fightTime%60 + "s" ).setScore(3);
else
objective.getScore("§7Zeit: §a" + fightTime + "s").setScore(3);
}
if(Methods.isEnabled("WinConditions.Entern")) objective.getScore("§7Entern: " + (FightSystem.getPlugin().isEntern() ? "§aja" : "§cnein")).setScore(2);
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden ROT: §c" + FightSystem.getPlugin().getDamageRed() + "%").setScore(1);
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden BLAU: §c" + FightSystem.getPlugin().getGetDamageBlue() + "%").setScore(0);
index = 0;

Datei anzeigen

@ -20,12 +20,10 @@ public class WinconditionAllDead implements Listener {
Player player = event.getEntity().getPlayer();
if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player);
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von " + fightTeam.getLeader().getPlayer().getName() + " §csind gestorben oder haben den Kampf verlassen!");
instance.setSpectateState(oppositeFightTeam);
return;
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!");
instance.setSpectateState(Fight.getOpposite(fightTeam));
}
}
@ -35,12 +33,10 @@ public class WinconditionAllDead implements Listener {
Player player = event.getPlayer();
if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player);
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von §6" + fightTeam.getLeader().getPlayer().getName() + " §csind gestorben oder haben den Kampf verlassen!");
instance.setSpectateState(oppositeFightTeam);
return;
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus §6" + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!");
instance.setSpectateState(Fight.getOpposite(fightTeam));
}
}

Datei anzeigen

@ -22,13 +22,10 @@ public class WinconditionCaptainDead implements Listener {
Player player = event.getEntity().getPlayer();
if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player);
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
String team = Fight.getRedTeam().isPlayerLeader(player) ? "Red" : "Blue";
if(fightTeam.isPlayerLeader(player)) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von Team " + fileManager.getStringFromConfig("Output.Team" + team + "Color") + fileManager.getStringFromConfig("Output.Team" + team + "Name") + " §cist gestorben!");
instance.setSpectateState(oppositeFightTeam);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!");
instance.setSpectateState(Fight.getOpposite(fightTeam));
return;
}
}
@ -39,12 +36,10 @@ public class WinconditionCaptainDead implements Listener {
Player player = event.getPlayer();
if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player);
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
String team = Fight.getRedTeam().isPlayerLeader(player) ? "Red" : "Blue";
if(fightTeam.isPlayerLeader(player)) {
instance.setSpectateState(oppositeFightTeam);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!");
instance.setSpectateState(Fight.getOpposite(fightTeam));
return;
}
}

Datei anzeigen

@ -3,7 +3,7 @@ package me.yaruma.fightsystem.winconditions;
import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.manager.FileManager;
import me.yaruma.fightsystem.utils.countdown.Countdown;
import me.yaruma.fightsystem.utils.countdown.FinishTimeOver;
import me.yaruma.fightsystem.utils.countdown.FinishNoneEntern;
public class WinconditionEntern {
@ -14,7 +14,7 @@ public class WinconditionEntern {
if(!Methods.isEnabled("WinConditions.Entern")) return;
int timeTimeOver = fileManager.getIntegerFromConfig("WinConditionParams.EnterPhaseBegin");
Countdown countdownTimeOver = new Countdown(timeTimeOver, new FinishTimeOver());
Countdown countdownTimeOver = new Countdown(timeTimeOver, new FinishNoneEntern());
countdownTimeOver.startTimer(instance);
}