SteamWar/FightSystem
Archiviert
13
1

Various quality of life improvements
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-10-26 07:20:44 +02:00
Ursprung 436a1949e4
Commit 4f2d1cb41d
15 geänderte Dateien mit 187 neuen und 102 gelöschten Zeilen

Datei anzeigen

@ -84,17 +84,20 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
} }
@Override @Override
public Material onBreak(Material type) { public ItemStack onBreak(Block block) {
Material type = block.getType();
switch(type){ switch(type){
case REDSTONE_WIRE: case REDSTONE_WIRE:
return Material.REDSTONE; type = Material.REDSTONE;
break;
case PISTON_HEAD: case PISTON_HEAD:
return Material.PISTON; type = Material.PISTON;
break;
case ICE: case ICE:
return Material.AIR; type = Material.AIR;
default: break;
return type;
} }
return new ItemStack(type);
} }
@Override @Override

Datei anzeigen

@ -63,17 +63,8 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
} }
@Override @Override
public Material onBreak(Material type) { public ItemStack onBreak(Block block) {
switch(type){ return block.getDrops().stream().findAny().orElse(new ItemStack(Material.AIR));
case REDSTONE_WIRE:
return Material.REDSTONE;
case PISTON_EXTENSION:
return Material.PISTON_BASE;
case ICE:
return Material.AIR;
default:
return type;
}
} }
@Override @Override

Datei anzeigen

@ -49,6 +49,7 @@ public class FightSystem extends JavaPlugin {
private static Player eventLeiter; private static Player eventLeiter;
private Message message; private Message message;
private FightTeam lastWinner;
@Override @Override
public void onLoad() { public void onLoad() {
@ -71,6 +72,7 @@ public class FightSystem extends JavaPlugin {
new InFightDamage(); new InFightDamage();
new InFightInventory(); new InFightInventory();
new DenyWorldInteraction(); new DenyWorldInteraction();
new DenyInventoryMovement();
new EventJoin(); new EventJoin();
new Recording(); new Recording();
//new ResourcePack(); //new ResourcePack();
@ -81,6 +83,7 @@ public class FightSystem extends JavaPlugin {
new TestJoin(); new TestJoin();
new NormalJoin(); new NormalJoin();
new RankedJoin(); new RankedJoin();
new RunningWorldInteraction();
new PersonalKitCreator(); new PersonalKitCreator();
new ArrowStopper(); new ArrowStopper();
new ArrowPickup(); new ArrowPickup();
@ -186,6 +189,7 @@ public class FightSystem extends JavaPlugin {
} }
public static void setSpectateState(FightTeam winFightTeam, String winreason, String subtitle, Object... params) { public static void setSpectateState(FightTeam winFightTeam, String winreason, String subtitle, Object... params) {
plugin.lastWinner = winFightTeam;
FightUI.printWin(winFightTeam, subtitle, params); FightUI.printWin(winFightTeam, subtitle, params);
FightState.setFightState(FightState.SPECTATE); FightState.setFightState(FightState.SPECTATE);
@ -233,6 +237,10 @@ public class FightSystem extends JavaPlugin {
return plugin.message; return plugin.message;
} }
public static FightTeam getLastWinner() {
return plugin.lastWinner;
}
public static void shutdown() { public static void shutdown() {
//Staggered kick to prevent lobby overloading //Staggered kick to prevent lobby overloading
if(Bukkit.getOnlinePlayers().isEmpty()){ if(Bukkit.getOnlinePlayers().isEmpty()){

Datei anzeigen

@ -193,6 +193,8 @@ BAR_RUNNING1={1} {3} {5} {0} {6} {4} {2}
BAR_RUNNING2={1} {3} {5} {7} {0} {6} {8} {4} {2} BAR_RUNNING2={1} {3} {5} {7} {0} {6} {8} {4} {2}
BAR_RUNNING3={1} {3} {5} {7} {9} {0} {6} {8} {10} {4} {2} BAR_RUNNING3={1} {3} {5} {7} {9} {0} {6} {8} {10} {4} {2}
BAR_SPECTATE={1} §7Kampf vorbei {0} {2} BAR_SPECTATE={1} §7Kampf vorbei {0} {2}
BAR_TIE={1} §7Unentschieden {0} {2}
BAR_WIN={1} §7Sieg {3} {0} {2}
BAR_POINTS={0} §8Punkte BAR_POINTS={0} §8Punkte
BAR_PERCENT={0}§8% BAR_PERCENT={0}§8%
BAR_CANNONS={0} §8Kanonen BAR_CANNONS={0} §8Kanonen

Datei anzeigen

@ -61,6 +61,7 @@ public class FightPlayer {
if(enternCountdown != null){ if(enternCountdown != null){
enternCountdown.disable(); enternCountdown.disable();
} }
enternCountdown = null;
} }
public Player getPlayer() { public Player getPlayer() {

Datei anzeigen

@ -66,6 +66,7 @@ public class FightTeam {
private final Region schemRegion; private final Region schemRegion;
private final Region extendRegion; private final Region extendRegion;
@SuppressWarnings("deprecation")
public FightTeam(String name, String prefix, Location spawn, Region schemRegion, Region extendRegion, boolean rotate, boolean blue, UUID designatedLeader) { public FightTeam(String name, String prefix, Location spawn, Region schemRegion, Region extendRegion, boolean rotate, boolean blue, UUID designatedLeader) {
this.spawn = spawn; this.spawn = spawn;
this.schemRegion = schemRegion; this.schemRegion = schemRegion;
@ -87,7 +88,6 @@ public class FightTeam {
assert team != null; assert team != null;
WorldOfColorWrapper.impl.setTeamColor(team, color); WorldOfColorWrapper.impl.setTeamColor(team, color);
BountifulWrapper.impl.setNametagVisibility(team); BountifulWrapper.impl.setNametagVisibility(team);
//noinspection deprecation
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS); team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
team.setAllowFriendlyFire(false); team.setAllowFriendlyFire(false);
} }
@ -167,10 +167,10 @@ public class FightTeam {
if(leaderBackup != null){ if(leaderBackup != null){
playerSet.remove(leaderBackup.getPlayer()); playerSet.remove(leaderBackup.getPlayer());
addMember(leaderBackup.getPlayer()); addMember(leaderBackup.getPlayer(), true);
} }
playerSet.forEach(this::addMember); playerSet.forEach(p -> addMember(p, true));
if(ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()){ if(ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()){
for(Player player : Bukkit.getOnlinePlayers()){ for(Player player : Bukkit.getOnlinePlayers()){
@ -195,6 +195,10 @@ public class FightTeam {
} }
public void addMember(Player player) { public void addMember(Player player) {
addMember(player, false);
}
public void addMember(Player player, boolean silent) {
final List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player, false); final List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player, false);
FightPlayer fightPlayer = new FightPlayer(player, this); FightPlayer fightPlayer = new FightPlayer(player, this);
players.put(player, fightPlayer); players.put(player, fightPlayer);
@ -214,8 +218,8 @@ public class FightTeam {
TechHider.reloadChunks(player, chunksToReload, false); TechHider.reloadChunks(player, chunksToReload, false);
if(isLeaderless()) if(isLeaderless())
setLeader(fightPlayer); setLeader(fightPlayer, silent);
else else if(!silent)
FightUI.addSubtitle("UI_PLAYER_JOINS", prefix, player.getName()); FightUI.addSubtitle("UI_PLAYER_JOINS", prefix, player.getName());
} }
@ -257,13 +261,13 @@ public class FightTeam {
private void removeLeader() { private void removeLeader() {
this.leader = null; this.leader = null;
if(!players.isEmpty()) { if(!players.isEmpty()) {
setLeader(players.values().iterator().next()); setLeader(players.values().iterator().next(), false);
}else if(FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)){ }else if(FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)){
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), FightSystem::setPreLeaderState, 1); Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), FightSystem::setPreLeaderState, 1);
} }
} }
private void setLeader(FightPlayer leader) { private void setLeader(FightPlayer leader, boolean silent) {
PersonalKitCreator.closeIfInKitCreator(leader.getPlayer()); PersonalKitCreator.closeIfInKitCreator(leader.getPlayer());
this.leader = leader; this.leader = leader;
@ -271,6 +275,7 @@ public class FightTeam {
if(ready) if(ready)
setReady(false); setReady(false);
if(!silent)
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getPlayer().getName()); FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getPlayer().getName());
Optional<Integer> maxRank = Schematic.getSchemsOfType(leader.getPlayer().getUniqueId(), Config.SchematicType).stream().map(Schematic::getRank).max(Integer::compare); Optional<Integer> maxRank = Schematic.getSchemsOfType(leader.getPlayer().getUniqueId(), Config.SchematicType).stream().map(Schematic::getRank).max(Integer::compare);

Datei anzeigen

@ -0,0 +1,51 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2021 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.BountifulWrapper;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
public class DenyInventoryMovement implements Listener {
public DenyInventoryMovement() {
new StateDependentListener(ArenaMode.AntiTest, FightState.AntiIngame, this);
Listener listener = BountifulWrapper.impl.newDenyHandSwapListener();
new StateDependentListener(ArenaMode.AntiTest, FightState.AntiIngame, listener);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
event.setCancelled(true);
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
event.setCancelled(true);
}
}

Datei anzeigen

@ -23,7 +23,6 @@ import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.BountifulWrapper;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -32,8 +31,6 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerKickEvent;
public class DenyWorldInteraction implements Listener { public class DenyWorldInteraction implements Listener {
@ -41,10 +38,6 @@ public class DenyWorldInteraction implements Listener {
public DenyWorldInteraction() { public DenyWorldInteraction() {
new StateDependentListener(ArenaMode.Test, FightState.PreRunning, this); new StateDependentListener(ArenaMode.Test, FightState.PreRunning, this);
new StateDependentListener(ArenaMode.AntiTest, FightState.AntiRunning, this); new StateDependentListener(ArenaMode.AntiTest, FightState.AntiRunning, this);
Listener listener = BountifulWrapper.impl.newDenyHandSwapListener();
new StateDependentListener(ArenaMode.Test, FightState.PreRunning, listener);
new StateDependentListener(ArenaMode.AntiTest, FightState.AntiRunning, listener);
} }
@EventHandler @EventHandler
@ -72,18 +65,6 @@ public class DenyWorldInteraction implements Listener {
e.setCancelled(true); e.setCancelled(true);
} }
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
event.setCancelled(true);
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
event.setCancelled(true);
}
@EventHandler @EventHandler
public void handleProjectileLaunch(ProjectileLaunchEvent event) { public void handleProjectileLaunch(ProjectileLaunchEvent event) {
event.setCancelled(true); event.setCancelled(true);

Datei anzeigen

@ -20,19 +20,12 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDispenseEvent; import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
@ -42,7 +35,7 @@ import org.bukkit.inventory.ItemStack;
public class InFightInventory implements Listener { public class InFightInventory implements Listener {
public InFightInventory() { public InFightInventory() {
new StateDependentListener(ArenaMode.AntiReplay, FightState.Running, this); new StateDependentListener(ArenaMode.AntiReplay, FightState.Ingame, this);
} }
@EventHandler @EventHandler
@ -79,44 +72,6 @@ public class InFightInventory implements Listener {
} }
} }
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Inventory inventory = event.getPlayer().getInventory();
Material type = FlatteningWrapper.impl.onBreak(event.getBlock().getType());
ItemStack itemStack;
for (int i = 0; i <= 35; i++) { //35 is the last normal inventory slot
itemStack = inventory.getItem(i);
if (itemStack != null && itemStack.getType().equals(type) && itemStack.getAmount() != itemStack.getMaxStackSize()) {
itemStack.setType(type);
itemStack.setAmount(itemStack.getAmount() + 1);
inventory.setItem(i, itemStack);
event.getPlayer().updateInventory();
return;
}
}
for (int i = 0; i <= 35; i++) { //35 is the last normal inventory slot
itemStack = inventory.getItem(i);
if (itemStack == null || itemStack.getType().equals(Material.AIR)) {
itemStack = new ItemStack(type, 1);
inventory.setItem(i, itemStack);
event.getPlayer().updateInventory();
return;
}
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
FightPlayer fp = Fight.getFightPlayer(e.getPlayer());
if(fp != null && !fp.getKit().isTnt() && e.getBlockPlaced().getType() == Material.TNT){
FightSystem.getMessage().sendPrefixless("NO_TNT_PLACE", e.getPlayer(), ChatMessageType.ACTION_BAR);
e.setCancelled(true);
}
}
@EventHandler @EventHandler
public void onBlockDispense(BlockDispenseEvent e) { public void onBlockDispense(BlockDispenseEvent e) {
if(e.getItem().getType() == Material.TNT) if(e.getItem().getType() == Material.TNT)

Datei anzeigen

@ -0,0 +1,78 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2021 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class RunningWorldInteraction implements Listener {
public RunningWorldInteraction() {
new StateDependentListener(ArenaMode.AntiReplay, FightState.Running, this);
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Inventory inventory = event.getPlayer().getInventory();
ItemStack stack = FlatteningWrapper.impl.onBreak(event.getBlock());
for (int i = 0; i <= 35; i++) { //35 is the last normal inventory slot
ItemStack itemStack = inventory.getItem(i);
if (itemStack != null && itemStack.isSimilar(stack) && itemStack.getAmount() != itemStack.getMaxStackSize()) {
itemStack.setAmount(itemStack.getAmount() + 1);
inventory.setItem(i, itemStack);
event.getPlayer().updateInventory();
return;
}
}
for (int i = 0; i <= 35; i++) { //35 is the last normal inventory slot
ItemStack itemStack = inventory.getItem(i);
if (itemStack == null || itemStack.getType().equals(Material.AIR)) {
inventory.setItem(i, stack);
event.getPlayer().updateInventory();
return;
}
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
FightPlayer fp = Fight.getFightPlayer(e.getPlayer());
if(fp != null && !fp.getKit().isTnt() && e.getBlockPlaced().getType() == Material.TNT){
FightSystem.getMessage().sendPrefixless("NO_TNT_PLACE", e.getPlayer(), ChatMessageType.ACTION_BAR);
e.setCancelled(true);
}
}
}

Datei anzeigen

@ -38,13 +38,18 @@ public class FileSource extends PacketSource {
return; return;
} }
InputStream input = de.steamwar.sql.Fight.getReplay(Config.ReplayID); de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> {
try { try {
Files.copy( Files.copy(
input, input,
FileRecorder.getFile().toPath(), FileRecorder.getFile().toPath(),
StandardCopyOption.REPLACE_EXISTING); StandardCopyOption.REPLACE_EXISTING);
input.close(); } catch (IOException e) {
throw new SecurityException("Could not start replay", e);
}
});
try {
new FileSource(FileRecorder.getFile()); new FileSource(FileRecorder.getFile());
} catch (IOException e) { } catch (IOException e) {
throw new SecurityException("Could not start replay", e); throw new SecurityException("Could not start replay", e);

Datei anzeigen

@ -44,6 +44,7 @@ public enum FightState {
public static final Set<FightState> Schem = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP))); public static final Set<FightState> Schem = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP)));
public static final Set<FightState> Recording = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, SPECTATE))); public static final Set<FightState> Recording = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_LEADER_SETUP, PRE_SCHEM_SETUP, SPECTATE)));
public static final Set<FightState> AntiRunning = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(RUNNING))); public static final Set<FightState> AntiRunning = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(RUNNING)));
public static final Set<FightState> AntiIngame = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_RUNNING, RUNNING)));
public static final Set<FightState> AntiSpectate = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(SPECTATE))); public static final Set<FightState> AntiSpectate = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(SPECTATE)));
private static final Map<IStateDependent, Boolean> stateDependentFeatures = new HashMap<>(); private static final Map<IStateDependent, Boolean> stateDependentFeatures = new HashMap<>();

Datei anzeigen

@ -33,7 +33,7 @@ import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.nio.file.Files; import java.io.FileInputStream;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
import java.util.logging.Level; import java.util.logging.Level;
@ -97,9 +97,9 @@ public class FightStatistics {
for (FightPlayer fp : Fight.getRedTeam().getPlayers()) for (FightPlayer fp : Fight.getRedTeam().getPlayers())
savePlayerStats(fp, fightId); savePlayerStats(fp, fightId);
setReplay(fightId, Files.readAllBytes(FileRecorder.getFile().toPath())); setReplay(fightId, new FileInputStream(FileRecorder.getFile()));
if(ArenaMode.Event.contains(Config.mode)){ if(ArenaMode.Event.contains(Config.mode)) {
FightSystem.getEventFight().setFight(fightId); FightSystem.getEventFight().setFight(fightId);
} }
}catch(Exception e){ }catch(Exception e){

Datei anzeigen

@ -105,7 +105,12 @@ public class FightUI {
break; break;
case SPECTATE: case SPECTATE:
default: default:
generator = (l, r, lP, rP, lW, rW) -> new Message("BAR_SPECTATE", time, l.getColoredName(), r.getColoredName()); generator = (l, r, lP, rP, lW, rW) -> {
if(FightSystem.getLastWinner() == null)
return new Message("BAR_TIE", time, l.getColoredName(), r.getColoredName());
else
return new Message("BAR_WIN", time, l.getColoredName(), r.getColoredName(), FightSystem.getLastWinner().getColoredName());
};
break; break;
} }

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.fightsystem.utils;
import de.steamwar.fightsystem.VersionDependent; import de.steamwar.fightsystem.VersionDependent;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -43,7 +42,7 @@ public class FlatteningWrapper {
boolean containsBlockMeta(ItemMeta meta); boolean containsBlockMeta(ItemMeta meta);
boolean hasAttributeModifier(ItemStack stack); boolean hasAttributeModifier(ItemStack stack);
Material onBreak(Material type); ItemStack onBreak(Block type);
boolean doRecord(BlockPhysicsEvent e); boolean doRecord(BlockPhysicsEvent e);