SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into personalKit

# Conflicts:
#	FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java
#	FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java
#	FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java
Dieser Commit ist enthalten in:
Lixfel 2020-01-27 06:31:41 +01:00
Commit 61ff397458
28 geänderte Dateien mit 173 neuen und 87 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,5 @@
package de.steamwar.fightsystem.utils;
import javafx.util.Pair;
import net.minecraft.server.v1_10_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_10_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
@ -9,7 +8,7 @@ import org.bukkit.entity.Player;
class TechHider_10 {
private TechHider_10(){}
static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), 65535));
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
}

Datei anzeigen

@ -12,7 +12,6 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.IFightSystem;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import javafx.util.Pair;
import net.minecraft.server.v1_12_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_12_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
@ -27,8 +26,8 @@ class TechHider_12 {
private static final short obfuscateShift4 = (short)(Config.ObfuscateWith << 4);
static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), 65535));
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
static void start(){

Datei anzeigen

@ -12,7 +12,6 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.IFightSystem;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import javafx.util.Pair;
import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_14_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
@ -25,8 +24,8 @@ import static de.steamwar.fightsystem.utils.ITechHider.bypass;
public class TechHider_14 {
private TechHider_14(){}
static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), 65535));
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
static void start(){

Datei anzeigen

@ -1,6 +1,5 @@
package de.steamwar.fightsystem.utils;
import javafx.util.Pair;
import net.minecraft.server.v1_15_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_15_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
@ -9,8 +8,8 @@ import org.bukkit.entity.Player;
public class TechHider_15 {
private TechHider_15(){}
static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), 65535));
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
static void start(){

Datei anzeigen

@ -1,6 +1,5 @@
package de.steamwar.fightsystem.utils;
import javafx.util.Pair;
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_8_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
@ -9,7 +8,7 @@ import org.bukkit.entity.Player;
class TechHider_8 {
private TechHider_8(){}
static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), true, 65535));
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), true, 65535));
}
}

Datei anzeigen

@ -1,6 +1,5 @@
package de.steamwar.fightsystem.utils;
import javafx.util.Pair;
import net.minecraft.server.v1_9_R2.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_9_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
@ -9,7 +8,7 @@ import org.bukkit.entity.Player;
class TechHider_9 {
private TechHider_9(){}
static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), 65535));
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
}

Datei anzeigen

@ -61,6 +61,7 @@ public class Config {
//schematic parameter
public static final boolean OnlyPublicSchematics;
public static final boolean IgnorePublicOnly;
public static final de.steamwar.sql.SchematicType SchematicType;
public static final boolean TeamRedRotate;
public static final boolean TeamBlueRotate;
@ -151,6 +152,7 @@ public class Config {
WaterDepth = worldconfig.getInt("Arena.WaterDepth");
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
boolean rotate = config.getBoolean("Schematic.Rotate");
ReplaceObsidian = config.getBoolean("Schematic.ReplaceObsidian");
ReplaceBedrock = config.getBoolean("Schematic.ReplaceBedrock");

Datei anzeigen

@ -136,4 +136,22 @@ public class ITechHider {
} while (value != 0);
return Bytes.toArray(buffer);
}
public static class ChunkPos{
final int x;
final int z;
ChunkPos(int x, int z){
this.x = x;
this.z = z;
}
final int x(){
return x;
}
final int z(){
return z;
}
}
}

Datei anzeigen

@ -9,13 +9,9 @@ import de.steamwar.fightsystem.kit.KitManager;
import de.steamwar.fightsystem.listener.*;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.FightScoreboard;
import de.steamwar.fightsystem.utils.PersonalKitCreator;
import de.steamwar.fightsystem.utils.TechHider;
import de.steamwar.fightsystem.utils.WaterRemover;
import de.steamwar.fightsystem.utils.*;
import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.sql.EventFight;
import javafx.util.Pair;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@ -160,6 +156,7 @@ public class FightSystem extends JavaPlugin {
if(Config.Entern)
mainCountdown = new EnternCountdown();
FightStatistics.start();
WaterRemover.init();
Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!");
}
@ -169,8 +166,8 @@ public class FightSystem extends JavaPlugin {
throw new SecurityException(fightState.name());
setFightState(FightState.ENTERN);
final List<Pair<Integer, Integer>> chunksBlue = TechHider.prepareChunkReload(Fight.getBlueTeam().getPlayers().iterator().next().getPlayer());
final List<Pair<Integer, Integer>> chunksRed = TechHider.prepareChunkReload(Fight.getRedTeam().getPlayers().iterator().next().getPlayer());
final List<ITechHider.ChunkPos> chunksBlue = TechHider.prepareChunkReload(Fight.getBlueTeam().getPlayers().iterator().next().getPlayer());
final List<ITechHider.ChunkPos> chunksRed = TechHider.prepareChunkReload(Fight.getRedTeam().getPlayers().iterator().next().getPlayer());
IFightSystem.setEntern(true);
for(FightPlayer player : Fight.getBlueTeam().getPlayers()){
TechHider.reloadChunks(player.getPlayer(), chunksBlue);
@ -180,7 +177,7 @@ public class FightSystem extends JavaPlugin {
}
}
public static void setSpectateState(FightTeam winFightTeam) {
public static void setSpectateState(FightTeam winFightTeam, String windescription) {
if(!fightState.ingame())
throw new SecurityException(fightState.name());
setFightState(FightState.SPECTATE);
@ -207,8 +204,10 @@ public class FightSystem extends JavaPlugin {
getEventFight().setErgebnis(2);
}
if(!Config.test())
if(!Config.test()){
new SpectateOverCountdown();
FightStatistics.saveStats(winFightTeam, windescription);
}
}
public static void setFightTime(int fightTime) {

Datei anzeigen

@ -14,7 +14,6 @@ import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
import javafx.util.Pair;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -49,26 +48,26 @@ public class GUI {
}
public static void chooseInvitation(Player p){
List<Pair<SWItem, UUID>> players = SWListInv.createPlayerList(p);
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getValue())) != null);
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler einladen", (ClickType click, UUID player) -> {
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getObject())) != null);
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler einladen", players, (ClickType click, UUID player) -> {
Commands.invite(p, SteamwarUser.get(player).getUserName());
p.closeInventory();
}, players);
});
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
inv.open();
}
public static void chooseRemove(Player p){
List<Pair<SWItem, UUID>> players = SWListInv.createPlayerList(p);
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
FightTeam team = Fight.getPlayerTeam(p);
if(team == null)
return;
players.removeIf(swItemUUIDPair -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(swItemUUIDPair.getValue()))));
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler rauswerfen", (ClickType click, UUID player) -> {
players.removeIf(swItemUUIDPair -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(swItemUUIDPair.getObject()))));
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler rauswerfen", players, (ClickType click, UUID player) -> {
Commands.kick(p, SteamwarUser.get(player).getUserName());
p.closeInventory();
}, players);
});
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
inv.open();
}
@ -83,14 +82,14 @@ public class GUI {
return;
}
List<Pair<SWItem, Kit>> iconList = new ArrayList<>();
List<SWListInv.SWListEntry<Kit>> iconList = new ArrayList<>();
List<Kit> kitList = KitManager.getKits(fightPlayer.isLeader());
for(Kit k : kitList){
iconList.add(new Pair<>(new SWItem(Material.LEATHER_CHESTPLATE, k.getName(), null, !k.isMemberAllowed(), null), k));
iconList.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, k.getName(), null, !k.isMemberAllowed(), null), k));
}
SWListInv<Kit> inv = new SWListInv<>(p, "Kitauswahl", (ClickType click, Kit k) -> k.preview(p), iconList);
SWListInv<Kit> inv = new SWListInv<>(p, "Kitauswahl", iconList, (ClickType click, Kit k) -> k.preview(p));
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
inv.open();
}
@ -115,20 +114,21 @@ public class GUI {
}
private static void schemDialog(Player p, boolean publicSchems){
List<Pair<SWItem, Schematic>> schems;
List<SWListInv.SWListEntry<Schematic>> schems;
if(publicSchems)
schems = SWListInv.getSchemList(0, Config.SchematicType);
schems = SWListInv.getSchemList(Config.SchematicType, 0);
else if(Config.test())
schems = SWListInv.getSchemList(SteamwarUser.get(p.getUniqueId()).getId(), null);
schems = SWListInv.getSchemList(null, SteamwarUser.get(p.getUniqueId()).getId());
else
schems = SWListInv.getSchemList(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType);
SWListInv<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", (ClickType click, Schematic s) -> {
schems = SWListInv.getSchemList(Config.SchematicType, SteamwarUser.get(p.getUniqueId()).getId());
SWListInv<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", schems, (ClickType click, Schematic s) -> {
FightTeam fightTeam = Fight.getPlayerTeam(p);
if(fightTeam == null)
return;
fightTeam.setSchematic(s);
p.closeInventory();
}, schems);
});
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
inv.open();
}

Datei anzeigen

@ -23,6 +23,6 @@ public class TechKOCountdown extends Countdown {
@Override
void countdownFinished() {
Bukkit.broadcastMessage(FightSystem.PREFIX + team.getColoredName() + "§7 ist §eTech K§8.§eO§8.!");
FightSystem.setSpectateState(Fight.getOpposite(team));
FightSystem.setSpectateState(Fight.getOpposite(team), "TechKO");
}
}

Datei anzeigen

@ -114,6 +114,16 @@ public class Fight {
}
public static void calcAvailibleSchemTypes() {
if(Config.IgnorePublicOnly){
onlyPublicSchems = false;
return;
}
if(Config.OnlyPublicSchematics){
onlyPublicSchems = true;
return;
}
if(redTeam.getLeader() == null || redTeam.getLeader().getPlayer() == null ||
blueTeam.getLeader() == null || blueTeam.getLeader().getPlayer() == null){
onlyPublicSchems = false;

Datei anzeigen

@ -11,6 +11,7 @@ public class FightPlayer {
private final FightTeam team;
private boolean isOut;
private Kit kit;
private int kills;
public void sendMessage(String message) {
if (this.player != null && this.player.isOnline())
@ -22,6 +23,7 @@ public class FightPlayer {
this.team = team;
this.isOut = false;
kit = KitManager.getKitByName(Config.MemberDefault);
kills = 0;
}
public void setOut() {
@ -52,4 +54,12 @@ public class FightPlayer {
public FightTeam getTeam(){
return team;
}
public int getKills(){
return kills;
}
public void addKill(){
kills++;
}
}

Datei anzeigen

@ -7,16 +7,12 @@ import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.IFightSystem;
import de.steamwar.fightsystem.kit.KitManager;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.utils.ColorConverter;
import de.steamwar.fightsystem.utils.FightScoreboard;
import de.steamwar.fightsystem.utils.ItemBuilder;
import de.steamwar.fightsystem.utils.TechHider;
import de.steamwar.fightsystem.utils.*;
import de.steamwar.inventory.SWItem;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.PersonalKit;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
import javafx.util.Pair;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
@ -144,7 +140,7 @@ public class FightTeam implements IFightTeam{
}
public FightPlayer addMember(Player player) {
final List<Pair<Integer, Integer>> chunksToReload = TechHider.prepareChunkReload(player);
final List<ITechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player);
FightPlayer fightPlayer = new FightPlayer(player, this);
players.add(fightPlayer);
invited.remove(player);
@ -162,7 +158,7 @@ public class FightTeam implements IFightTeam{
public void removePlayer(Player player) {
FightPlayer fightPlayer = getFightPlayer(player);
final List<Pair<Integer, Integer>> chunksToReload = TechHider.prepareChunkReload(player);
final List<ITechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player);
players.remove(fightPlayer);
team.removeEntry(player.getName());
fightPlayer.getPlayer().getInventory().clear();

Datei anzeigen

@ -85,6 +85,8 @@ public class Kit {
//36 = Inventargröße
for(int i = 0; i < 36; i++){
if(inventory[i] == null)
continue;
SWItem item = new SWItem();
item.setItemStack(inventory[i]);
inv.setItem(i, item);
@ -92,6 +94,8 @@ public class Kit {
if(armor != null){
for(int i = 0; i < 4; i++){
if(armor[i] == null)
continue;
SWItem item = new SWItem();
item.setItemStack(armor[i]);
inv.setItem(36 + i, item);

Datei anzeigen

@ -10,6 +10,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import java.util.EnumSet;
import java.util.Objects;
public class InFightDamageListener extends BasicListener {
@ -61,5 +62,9 @@ public class InFightDamageListener extends BasicListener {
event.setCancelled(true);
toActionbar(damager, TextComponent.fromLegacyText("§cDu darfst deinen Teamkollegen keinen Schaden zufügen!"));
}
if(player.getHealth() - event.getFinalDamage() <= 0){
Objects.requireNonNull(Fight.getFightPlayer(damager)).addKill();
}
}
}

Datei anzeigen

@ -0,0 +1,46 @@
package de.steamwar.fightsystem.utils;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import java.sql.Timestamp;
import java.time.Instant;
import static de.steamwar.sql.Fight.create;
public class FightStatistics {
private FightStatistics(){}
private static Timestamp starttime = Timestamp.from(Instant.now());
public static void start(){
starttime = Timestamp.from(Instant.now());
}
public static void saveStats(FightTeam winner, String windescription){
SteamwarUser blueLeader = SteamwarUser.get(Fight.getBlueTeam().getLeader().getPlayer().getUniqueId());
SteamwarUser redLeader = SteamwarUser.get(Fight.getRedTeam().getLeader().getPlayer().getUniqueId());
int win = 0;
if(winner == Fight.getBlueTeam())
win = 1;
else if(winner == Fight.getRedTeam())
win = 2;
int fightId = create(Config.SchematicType.toDB(), Bukkit.getWorlds().get(0).getName(), starttime, Config.TimeoutTime - FightSystem.getFightTime(),
blueLeader.getId(), redLeader.getId(), Fight.getBlueTeam().getSchematic().getSchemID(), Fight.getRedTeam().getSchematic().getSchemID(), win, windescription);
for(FightPlayer fp : Fight.getBlueTeam().getPlayers())
savePlayerStats(fp, fightId);
for(FightPlayer fp : Fight.getRedTeam().getPlayers())
savePlayerStats(fp, fightId);
}
private static void savePlayerStats(FightPlayer fp, int fightId){
SteamwarUser user = SteamwarUser.get(fp.getPlayer().getUniqueId());
de.steamwar.sql.FightPlayer.create(fightId, user.getId(), fp.getKit().getName(), fp.getKills(), !fp.isLiving());
}
}

Datei anzeigen

@ -14,7 +14,6 @@ import de.steamwar.core.Core;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.IFightSystem;
import javafx.util.Pair;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@ -168,29 +167,29 @@ public class TechHider {
});
}
public static List<Pair<Integer, Integer>> prepareChunkReload(Player p){
public static List<ITechHider.ChunkPos> prepareChunkReload(Player p){
if(disabled())
return Collections.emptyList();
List<Pair<Integer, Integer>> chunksToReload = new ArrayList<>();
List<ITechHider.ChunkPos> chunksToReload = new ArrayList<>();
for(int x = ITechHider.arenaMinX; x <= ITechHider.arenaMaxX; x++)
for(int z = ITechHider.arenaMinZ; z <= ITechHider.arenaMaxZ; z++)
if(!bypass(p, x, z))
chunksToReload.add(new Pair<>(x, z));
chunksToReload.add(new ITechHider.ChunkPos(x, z));
return chunksToReload;
}
public static void reloadChunks(Player p, List<Pair<Integer, Integer>> chunksToReload){
public static void reloadChunks(Player p, List<ITechHider.ChunkPos> chunksToReload){
if(disabled())
return;
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
for(Pair<Integer, Integer> chunk : chunksToReload){
if(bypass(p, chunk.getKey(), chunk.getValue()))
for(ITechHider.ChunkPos chunk : chunksToReload){
if(bypass(p, chunk.x(), chunk.z()))
reloadChunk(p, chunk);
}
}, 40);
}
private static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
private static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
switch(Core.getVersion()){
case 15:
TechHider_15.reloadChunk(p, chunk);

Datei anzeigen

@ -29,7 +29,7 @@ public class EventTeamOffWincondition extends Wincondition {
private void teamOff(FightTeam team){
if(team.allPlayersOut()){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + team.getColoredName() + " §6ist Offline!");
FightSystem.setSpectateState(Fight.getOpposite(team));
FightSystem.setSpectateState(Fight.getOpposite(team), "TeamOffline");
}
}
}

Datei anzeigen

@ -34,7 +34,7 @@ public class WinconditionAllDead extends PlayerWincondition {
assert fightTeam != null; // Checked with isTarget
if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + fightTeam.getColoredName() + message);
FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
FightSystem.setSpectateState(Fight.getOpposite(fightTeam), "AllDead");
}
}
}

Datei anzeigen

@ -34,7 +34,7 @@ public class WinconditionCaptainDead extends PlayerWincondition {
assert fightTeam != null; // Checked with isTarget
if(fightTeam.isPlayerLeader(player)) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getColoredName() + message);
FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
FightSystem.setSpectateState(Fight.getOpposite(fightTeam), "LeaderDead");
}
}
}

Datei anzeigen

@ -23,11 +23,11 @@ public class WinconditionHeartRatioTimeout extends Wincondition {
double redHeartRatio = Fight.getRedTeam().getHeartRatio();
if(blueHeartRatio > redHeartRatio)
FightSystem.setSpectateState(Fight.getBlueTeam());
FightSystem.setSpectateState(Fight.getBlueTeam(), "HeartTimeout");
else if(blueHeartRatio < redHeartRatio)
FightSystem.setSpectateState(Fight.getRedTeam());
FightSystem.setSpectateState(Fight.getRedTeam(), "HeartTimeout");
else
FightSystem.setSpectateState(null);
FightSystem.setSpectateState(null, "HeartTimeout");
});
}

Datei anzeigen

@ -37,7 +37,7 @@ public class WinconditionPercentSystem extends ListenerWincondition {
double destroyPercent = doubleBlueDestroyedBlocks * 100 / schematicSize;
bluePercent = destroyPercent;
if(destroyPercent >= Config.PercentWin) {
FightSystem.setSpectateState(Fight.redTeam);
FightSystem.setSpectateState(Fight.redTeam, "Percent");
}
//Team Red
}else if(Region.isInRange(entity.getLocation(), Config.TeamRedCornerX, Config.TeamRedCornerY, Config.TeamRedCornerZ, Config.SchemsizeX, Config.SchemsizeY, Config.SchemsizeZ, Config.BorderFromSchematic)) {
@ -46,7 +46,7 @@ public class WinconditionPercentSystem extends ListenerWincondition {
double destroyPercent = doubleRedDestroyedBlocks * 100 / schematicSize;
redPercent = destroyPercent;
if(destroyPercent >= Config.PercentWin) {
FightSystem.setSpectateState(Fight.blueTeam);
FightSystem.setSpectateState(Fight.blueTeam, "Percent");
}
}
}

Datei anzeigen

@ -80,11 +80,11 @@ public class WinconditionPoints extends PlayerWincondition {
private void fightEnds(){
if(red.getPoints() > blue.getPoints())
FightSystem.setSpectateState(blue.enemy);
FightSystem.setSpectateState(blue.enemy, "Points");
else if(red.getPoints() < blue.getPoints())
FightSystem.setSpectateState(red.enemy);
FightSystem.setSpectateState(red.enemy, "Points");
else
FightSystem.setSpectateState(null);
FightSystem.setSpectateState(null, "Points");
}
private TeamPoints getEnemyByTeam(FightTeam team){
@ -97,7 +97,7 @@ public class WinconditionPoints extends PlayerWincondition {
public static class TeamPoints {
private final FightTeam enemy;
private final WinconditionRelativePercent.TeamPercent enemyPercent;
private final double factor;
private double factor;
private static final int maxPoints = 2000;
private int points;
@ -107,18 +107,21 @@ public class WinconditionPoints extends PlayerWincondition {
this.enemyPercent = enemyPercent;
points = 0;
if(enemyPercent.getBlockCount() < ownPercent.getBlockCount())
this.factor = 10000; //Original mit 20 (20% = 0.2 ergeben 2000 Punkte
else{
double f = 10000.0 * ownPercent.getBlockCount() / enemyPercent.getBlockCount();
//Prevent NPE
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () ->{
if(enemyPercent.getBlockCount() < ownPercent.getBlockCount())
this.factor = 10000; //Original mit 20 (20% = 0.2 ergeben 2000 Punkte
else{
double f = 10000.0 * ownPercent.getBlockCount() / enemyPercent.getBlockCount();
if(f > 10000)
f = 10000;
else if(f < 4000)
f = 4000;
if(f > 10000)
f = 10000;
else if(f < 4000)
f = 4000;
this.factor = f;
}
this.factor = f;
}
});
}
public int getPoints(){

Datei anzeigen

@ -76,7 +76,7 @@ public class WinconditionPumpkinTechKO extends Wincondition {
private static void checkKO(FightTeam team, int pumpkins){
if(pumpkins == 0){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§eDas Team " + team.getColoredName() + " §eist Tech K.O.!");
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> FightSystem.setSpectateState(Fight.getOpposite(team)));
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> FightSystem.setSpectateState(Fight.getOpposite(team), "PumpkinTechKO"));
}
}
}

Datei anzeigen

@ -105,7 +105,7 @@ public class WinconditionRelativePercent extends Wincondition{
return;
if(getPercent() * 100 >= Config.PercentWin){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Schiff von " + team.getColoredName() + " §cwurde zu stark beschädigt!");
FightSystem.setSpectateState(Fight.getOpposite(team));
FightSystem.setSpectateState(Fight.getOpposite(team), "RelativePercent");
}
}
}

Datei anzeigen

@ -17,7 +17,7 @@ public class WinconditionTimeout extends Wincondition {
@Override
public void enable() {
countdown = new TimeOverCountdown(() -> FightSystem.setSpectateState(null));
countdown = new TimeOverCountdown(() -> FightSystem.setSpectateState(null, "Timeout"));
}
@Override

Datei anzeigen

@ -63,7 +63,7 @@ public class WinconditionWaterTechKO extends Wincondition {
private void checkEmpty(FightTeam team, Set<Location> teamWater){
if(teamWater.isEmpty()){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§eDas Team " + team.getColoredName() + " §eist Tech K.O.!");
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> FightSystem.setSpectateState(Fight.getOpposite(team)));
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> FightSystem.setSpectateState(Fight.getOpposite(team), "WaterTechKO"));
}
}