code cleanup; reworked percent system
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
6bbe6ff5b3
Commit
5ce40e8149
@ -26,7 +26,6 @@ import java.io.File;
|
||||
public class FightSystem extends JavaPlugin {
|
||||
|
||||
public static final String PREFIX = "§6Arena§8» ";
|
||||
public static final String NOPERM = PREFIX + "§cDu darfst das nicht!";
|
||||
|
||||
private static FightSystem plugin;
|
||||
private Scoreboard scoreboard;
|
||||
@ -224,16 +223,6 @@ public class FightSystem extends JavaPlugin {
|
||||
return fightTime;
|
||||
}
|
||||
|
||||
public double getDamageRed() {
|
||||
double damageRed = 0D;
|
||||
return damageRed;
|
||||
}
|
||||
|
||||
public double getGetDamageBlue() {
|
||||
double getDamageBlue = 0D;
|
||||
return getDamageBlue;
|
||||
}
|
||||
|
||||
public boolean isEntern() {
|
||||
return entern;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import me.yaruma.fightsystem.fight.Fight;
|
||||
import me.yaruma.fightsystem.fight.FightPlayer;
|
||||
import me.yaruma.fightsystem.fight.FightTeam;
|
||||
import me.yaruma.fightsystem.utils.Config;
|
||||
import me.yaruma.fightsystem.winconditions.WinconditionPercentSystem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
@ -60,8 +61,8 @@ public class Scoreboard {
|
||||
if (Config.Entern)
|
||||
objective.getScore("§7Entern: " + (FightSystem.getPlugin().isEntern() ? "§aja" : "§cnein")).setScore(2);
|
||||
if (Config.PercentSystem){
|
||||
objective.getScore("§eSchaden ROT: §c" + FightSystem.getPlugin().getDamageRed() + "%").setScore(1);
|
||||
objective.getScore("§eSchaden BLAU: §c" + FightSystem.getPlugin().getGetDamageBlue() + "%").setScore(0);
|
||||
objective.getScore("§eSchaden ROT: §c" + (Math.round(100.0 * WinconditionPercentSystem.getRedPercent()) / 100) + "%").setScore(1);
|
||||
objective.getScore("§eSchaden BLAU: §c" + (Math.round(100.0 * WinconditionPercentSystem.getBluePercent()) / 100) + "%").setScore(0);
|
||||
}
|
||||
index = 0;
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
public class WinconditionPercentSystem implements Listener {
|
||||
|
||||
private static double bluePercent = 0D;
|
||||
private static double redPercent = 0D;
|
||||
|
||||
private static int blueDestroyedBlocks;
|
||||
private static int redDestroyedBlocks;
|
||||
|
||||
@ -26,22 +29,24 @@ public class WinconditionPercentSystem implements Listener {
|
||||
if(!Config.PercentSystem) return;
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
//Team 1 / Rot
|
||||
//Team Blue
|
||||
if(Region.isInRange(entity.getLocation(), Config.TeamBlueCornerX, Config.TeamBlueCornerY, Config.TeamBlueCornerZ, Config.SchemsizeX, Config.SchemsizeY, Config.SchemsizeZ, Config.BorderFromSchematic)){
|
||||
blueDestroyedBlocks = blueDestroyedBlocks + event.blockList().size();
|
||||
Bukkit.broadcastMessage("red");
|
||||
double destroyPercent = blueDestroyedBlocks * 100 / schematicSize;
|
||||
Bukkit.broadcastMessage(" " + destroyPercent);
|
||||
double doubleBlueDestroyedBlocks = blueDestroyedBlocks;
|
||||
double destroyPercent = doubleBlueDestroyedBlocks * 100 / schematicSize;
|
||||
bluePercent = destroyPercent;
|
||||
if(destroyPercent >= Config.PercentWin) {
|
||||
FightSystem.getPlugin().setSpectateState(Fight.blueTeam);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Team 2 / Blau
|
||||
//Team Red
|
||||
if(Region.isInRange(entity.getLocation(), Config.TeamRedCornerX, Config.TeamRedCornerY, Config.TeamRedCornerZ, Config.SchemsizeX, Config.SchemsizeY, Config.SchemsizeZ, Config.BorderFromSchematic)) {
|
||||
redDestroyedBlocks = redDestroyedBlocks + event.blockList().size();
|
||||
double destroyPercent = redDestroyedBlocks * 100 / schematicSize;
|
||||
double doubleRedDestroyedBlocks = redDestroyedBlocks;
|
||||
double destroyPercent = doubleRedDestroyedBlocks * 100 / schematicSize;
|
||||
redPercent = destroyPercent;
|
||||
if(destroyPercent >= Config.PercentWin) {
|
||||
FightSystem.getPlugin().setSpectateState(Fight.redTeam);
|
||||
}
|
||||
@ -49,5 +54,11 @@ public class WinconditionPercentSystem implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public static double getBluePercent() {
|
||||
return bluePercent;
|
||||
}
|
||||
|
||||
public static double getRedPercent() {
|
||||
return redPercent;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren