Full 1.8 compilation support
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
765a9e4f6c
Commit
f61c6cbf6d
@ -20,6 +20,9 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
@ -33,4 +36,9 @@ public class WorldOfColorWrapper12 implements WorldOfColorWrapper.IWorldOfColorW
|
||||
public boolean isInBlock(Arrow e) {
|
||||
return e.isInBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(Location location, Sound sound, String soundCategory, float volume, float pitch) {
|
||||
location.getWorld().playSound(location, sound, SoundCategory.valueOf(soundCategory), volume, pitch);
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,15 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||
import de.steamwar.fightsystem.listener.Recording;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.minecraft.server.v1_8_R3.ChatComponentText;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -66,4 +71,19 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
|
||||
public Listener newDenyHandSwapListener() {
|
||||
return new Listener() {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordHandItems(Player player) {
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(player.getInventory().getItemInHand()), "MAINHAND");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newHandSwapRecorder() {
|
||||
return new Listener() {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(World world, String particleName, double x, double y, double z) {
|
||||
world.playEffect(new Location(world, x, y, z), Effect.valueOf(particleName), 1);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
@ -33,4 +35,9 @@ public class WorldOfColorWrapper8 implements WorldOfColorWrapper.IWorldOfColorWr
|
||||
public boolean isInBlock(Arrow e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(Location location, Sound sound, String soundCategory, float volume, float pitch) {
|
||||
location.getWorld().playSound(location, sound, volume, pitch);
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,18 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||
import de.steamwar.fightsystem.listener.Recording;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
@ -79,4 +84,30 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordHandItems(Player player) {
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(player.getInventory().getItemInMainHand()), "MAINHAND");
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(player.getInventory().getItemInOffHand()), "OFFHAND");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newHandSwapRecorder() {
|
||||
return new Listener() {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemSwap(PlayerSwapHandItemsEvent e){
|
||||
if(Recording.isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
Player player = e.getPlayer();
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(e.getMainHandItem()), "MAINHAND");
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(e.getOffHandItem()), "OFFHAND");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(World world, String particleName, double x, double y, double z) {
|
||||
world.spawnParticle(Particle.valueOf(particleName), x, y, z, 1);
|
||||
}
|
||||
}
|
||||
|
@ -129,8 +129,8 @@ public class FightSystem extends JavaPlugin {
|
||||
new LiveRecorder();
|
||||
new FileRecorder();
|
||||
|
||||
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.PreRunning, () -> Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!"));
|
||||
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.Running, () -> Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!"));
|
||||
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.PreRunning, () -> FightSystem.broadcast("§aDer Kampf beginnt!"));
|
||||
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.Running, () -> FightSystem.broadcast("§aArena freigegeben!"));
|
||||
new OneShotStateDependent(ArenaMode.AntiTest, FightState.Running, FightStatistics::start);
|
||||
|
||||
try {
|
||||
@ -187,9 +187,9 @@ public class FightSystem extends JavaPlugin {
|
||||
public static void setSpectateState(FightTeam winFightTeam, String windescription) {
|
||||
if(!PacketProcessor.isReplaying()){
|
||||
if(winFightTeam != null) {
|
||||
Bukkit.broadcastMessage(PREFIX + "§aDas Team " + winFightTeam.getColoredName() + " §ahat gewonnen!");
|
||||
FightSystem.broadcast("§aDas Team " + winFightTeam.getColoredName() + " §ahat gewonnen!");
|
||||
} else {
|
||||
Bukkit.broadcastMessage(PREFIX + "§aKein Team hat gewonnen!");
|
||||
FightSystem.broadcast("§aKein Team hat gewonnen!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,11 +231,16 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
public static void shutdown(String reason){
|
||||
if(reason != null)
|
||||
Bukkit.broadcastMessage(reason);
|
||||
FightSystem.broadcast(reason);
|
||||
//Staggered kick to prevent lobby overloading
|
||||
kickNext();
|
||||
}
|
||||
|
||||
public static void broadcast(String message) {
|
||||
Bukkit.broadcastMessage(PREFIX + message);
|
||||
GlobalRecorder.getInstance().systemChat(PREFIX + message);
|
||||
}
|
||||
|
||||
private static void kickNext(){
|
||||
if(Bukkit.getOnlinePlayers().isEmpty()){
|
||||
Bukkit.shutdown();
|
||||
|
@ -5,7 +5,6 @@ import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -35,13 +34,13 @@ public class WinCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase(Fight.getBlueTeam().getName())){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
|
||||
FightSystem.broadcast("§cDer Kampfleiter hat den Kampf entschieden!");
|
||||
FightSystem.setSpectateState(Fight.getBlueTeam(), "Referee");
|
||||
}else if(args[0].equalsIgnoreCase(Fight.getRedTeam().getName())){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
|
||||
FightSystem.broadcast("§cDer Kampfleiter hat den Kampf entschieden!");
|
||||
FightSystem.setSpectateState(Fight.getRedTeam(), "Referee");
|
||||
}else if(args[0].equalsIgnoreCase("tie")){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Kampfleiter hat den Kampf entschieden!");
|
||||
FightSystem.broadcast("§cDer Kampfleiter hat den Kampf entschieden!");
|
||||
FightSystem.setSpectateState(null, "Referee");
|
||||
}
|
||||
return false;
|
||||
|
@ -86,7 +86,7 @@ public abstract class Countdown {
|
||||
countdown.show();
|
||||
}
|
||||
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aBeide Teams waren damit einverstanden, zum nächsten Event zu beschleunigen!");
|
||||
FightSystem.broadcast("§aBeide Teams waren damit einverstanden, zum nächsten Event zu beschleunigen!");
|
||||
}
|
||||
|
||||
private void broadcast(String message){
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class TimeOverCountdown extends Countdown {
|
||||
|
||||
@ -40,7 +39,7 @@ public class TimeOverCountdown extends Countdown {
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX +"§aZeit abgelaufen!");
|
||||
FightSystem.broadcast("§aZeit abgelaufen!");
|
||||
timeOver.run();
|
||||
}
|
||||
}
|
||||
|
@ -63,10 +63,10 @@ public class HellsBells {
|
||||
|
||||
public void startCountdown() {
|
||||
if (current == State.PRE) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + (startMessages.get(random.nextInt(startMessages.size()))));
|
||||
FightSystem.broadcast(startMessages.get(random.nextInt(startMessages.size())));
|
||||
current = current.getNext();
|
||||
} else if (current != State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + (stateSwapMessages.get(random.nextInt(stateSwapMessages.size()))));
|
||||
FightSystem.broadcast(stateSwapMessages.get(random.nextInt(stateSwapMessages.size())));
|
||||
currentDrops = 0;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class FightSchematic extends StateDependent {
|
||||
replaceTeamColor(clipboard);
|
||||
WorldeditWrapper.impl.pasteSchematic(clipboard, region, rotate);
|
||||
} catch (WorldEditException e) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cFehler beim Pasten der Schematic");
|
||||
FightSystem.broadcast("§cFehler beim Pasten der Schematic");
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), FightSystem::setPreSchemState);
|
||||
throw new SecurityException("Could not paste schematic", e);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public class FightTeam {
|
||||
this.leader = null;
|
||||
if(!players.isEmpty()) {
|
||||
setLeader(players.values().iterator().next());
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §e" + this.leader.getPlayer().getName() + " §aist nun Leader von Team " + getColoredName() + "§a!");
|
||||
FightSystem.broadcast("§aDer Spieler §e" + this.leader.getPlayer().getName() + " §aist nun Leader von Team " + getColoredName() + "§a!");
|
||||
}else if(FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)){
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), FightSystem::setPreLeaderState, 1);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.utils.BountifulWrapper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -28,15 +29,19 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
|
||||
public class FreezeWorld implements Listener {
|
||||
|
||||
private final Listener denyHandSwap = BountifulWrapper.impl.newDenyHandSwapListener();
|
||||
|
||||
public FreezeWorld(){
|
||||
Bukkit.getPluginManager().registerEvents(this, FightSystem.getPlugin());
|
||||
Bukkit.getPluginManager().registerEvents(denyHandSwap, FightSystem.getPlugin());
|
||||
}
|
||||
|
||||
public void disable(){
|
||||
HandlerList.unregisterAll(this);
|
||||
HandlerList.unregisterAll(denyHandSwap);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -79,11 +84,6 @@ public class FreezeWorld implements Listener {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent event) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||
event.setCancelled(true);
|
||||
|
@ -21,14 +21,13 @@ package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -52,7 +51,7 @@ public class IngameDeath implements Listener {
|
||||
if(team == null)
|
||||
return;
|
||||
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + team.getPrefix() + player.getName() + " §cist gestorben!");
|
||||
FightSystem.broadcast("§cDer Spieler " + team.getPrefix() + player.getName() + " §cist gestorben!");
|
||||
Fight.playSound(SWSound.ENTITY_WITHER_DEATH.getSound(), 100.0F, 1.0F);
|
||||
team.getFightPlayer(player).setOut();
|
||||
}
|
||||
@ -68,7 +67,7 @@ public class IngameDeath implements Listener {
|
||||
|
||||
FightPlayer fightPlayer = team.getFightPlayer(player);
|
||||
if(fightPlayer.isLiving()) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + team.getPrefix() + player.getName() + " §chat den Kampf verlassen!");
|
||||
FightSystem.broadcast("§cDer Spieler " + team.getPrefix() + player.getName() + " §chat den Kampf verlassen!");
|
||||
team.getFightPlayer(player).setOut();
|
||||
GlobalRecorder.getInstance().entityDespawns(player);
|
||||
}
|
||||
|
@ -38,7 +38,10 @@ import de.steamwar.fightsystem.states.StateDependentTask;
|
||||
import de.steamwar.fightsystem.utils.BountifulWrapper;
|
||||
import de.steamwar.fightsystem.utils.FlatteningWrapper;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
@ -50,7 +53,6 @@ import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.server.BroadcastMessageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Random;
|
||||
@ -83,8 +85,20 @@ public class Recording implements Listener {
|
||||
}
|
||||
};
|
||||
|
||||
public static ItemStack disarmNull(ItemStack stack){
|
||||
if(stack == null)
|
||||
return new ItemStack(Material.AIR);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static boolean isNotSent(Player p){
|
||||
FightPlayer fp = Fight.getFightPlayer(p);
|
||||
return fp == null || !fp.isLiving() || FightState.getFightState() == FightState.SPECTATE;
|
||||
}
|
||||
|
||||
public Recording() {
|
||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.All, this);
|
||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.All, BountifulWrapper.impl.newHandSwapRecorder());
|
||||
new StateDependent(ArenaMode.AntiReplay, FightState.Ingame){
|
||||
@Override
|
||||
public void enable() {
|
||||
@ -143,11 +157,6 @@ public class Recording implements Listener {
|
||||
GlobalRecorder.getInstance().entityDespawns(e.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBroadcast(BroadcastMessageEvent e){
|
||||
GlobalRecorder.getInstance().systemChat(e.getMessage());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockPhysics(BlockPhysicsEvent e){
|
||||
if(FlatteningWrapper.impl.doRecord(e))
|
||||
@ -213,7 +222,7 @@ public class Recording implements Listener {
|
||||
|
||||
Location loc = e.getLocation();
|
||||
GlobalRecorder.getInstance().entityDespawns(e.getEntity());
|
||||
GlobalRecorder.getInstance().particle(loc.getX(), loc.getY(), loc.getZ(), Particle.EXPLOSION_HUGE.name());
|
||||
GlobalRecorder.getInstance().particle(loc.getX(), loc.getY(), loc.getZ(), "EXPLOSION_HUGE");
|
||||
GlobalRecorder.getInstance().sound(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), SWSound.ENTITY_GENERIC_EXPLODE, EnumWrappers.SoundCategory.BLOCKS.name(), 4.0F, (1.0F + (random.nextFloat() - random.nextFloat()) * 0.2F) * 0.7F);
|
||||
}
|
||||
|
||||
@ -225,16 +234,6 @@ public class Recording implements Listener {
|
||||
GlobalRecorder.getInstance().item(e.getPlayer(), disarmNull(e.getPlayer().getInventory().getItem(e.getNewSlot())), "MAINHAND");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemSwap(PlayerSwapHandItemsEvent e){
|
||||
if(isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
Player player = e.getPlayer();
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(e.getMainHandItem()), "MAINHAND");
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(e.getOffHandItem()), "OFFHAND");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onProjectileSpawn(ProjectileLaunchEvent e){
|
||||
if(e.getEntityType() == EntityType.FIREBALL)
|
||||
@ -277,8 +276,7 @@ public class Recording implements Listener {
|
||||
continue;
|
||||
|
||||
Player player = fp.getPlayer();
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getItemInMainHand()), "MAINHAND");
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getItemInOffHand()), "OFFHAND");
|
||||
BountifulWrapper.impl.recordHandItems(player);
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getHelmet()), "HEAD");
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getChestplate()), "CHEST");
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getLeggings()), "LEGS");
|
||||
@ -286,12 +284,6 @@ public class Recording implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack disarmNull(ItemStack stack){
|
||||
if(stack == null)
|
||||
return new ItemStack(Material.AIR);
|
||||
return stack;
|
||||
}
|
||||
|
||||
private void despawnTeam(FightTeam team){
|
||||
for(FightPlayer player : team.getPlayers()){
|
||||
if(player.isLiving())
|
||||
@ -303,9 +295,4 @@ public class Recording implements Listener {
|
||||
for(TNTPrimed tnt : Bukkit.getWorlds().get(0).getEntitiesByClass(TNTPrimed.class))
|
||||
GlobalRecorder.getInstance().entityDespawns(tnt);
|
||||
}
|
||||
|
||||
private boolean isNotSent(Player p){
|
||||
FightPlayer fp = Fight.getFightPlayer(p);
|
||||
return fp == null || !fp.isLiving() || FightState.getFightState() == FightState.SPECTATE;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package de.steamwar.fightsystem.record;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.VersionedRunnable;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
@ -34,12 +33,16 @@ import de.steamwar.fightsystem.listener.FightScoreboard;
|
||||
import de.steamwar.fightsystem.utils.BlockIdWrapper;
|
||||
import de.steamwar.fightsystem.utils.BountifulWrapper;
|
||||
import de.steamwar.fightsystem.utils.TechHider;
|
||||
import de.steamwar.fightsystem.utils.WorldOfColorWrapper;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.Team;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@ -296,10 +299,9 @@ public class PacketProcessor {
|
||||
double x = source.readDouble();
|
||||
double y = source.readDouble();
|
||||
double z = source.readDouble();
|
||||
|
||||
String particleName = source.readUTF();
|
||||
|
||||
execSync(() -> world.spawnParticle(Particle.valueOf(particleName), x, y, z, 1));
|
||||
execSync(() -> BountifulWrapper.impl.spawnParticle(world, particleName, x, y, z));
|
||||
}
|
||||
|
||||
private void sound() throws IOException {
|
||||
@ -314,9 +316,8 @@ public class PacketProcessor {
|
||||
float pitch = source.readFloat();
|
||||
|
||||
Sound sound = Sound.valueOf(soundName);
|
||||
SoundCategory sCategory = SoundCategory.valueOf(soundCategory);
|
||||
|
||||
execSync(() -> world.playSound(new Location(world, x, y, z), sound, sCategory, volume, pitch));
|
||||
execSync(() -> WorldOfColorWrapper.impl.playSound(new Location(world, x, y, z), sound, soundCategory, volume, pitch));
|
||||
}
|
||||
|
||||
private void soundAtPlayer() throws IOException {
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.fightsystem.utils;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||
import de.steamwar.fightsystem.VersionDependent;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
@ -43,5 +44,10 @@ public class BountifulWrapper {
|
||||
|
||||
Listener newDenyArrowPickupListener();
|
||||
Listener newDenyHandSwapListener();
|
||||
|
||||
void recordHandItems(Player player);
|
||||
Listener newHandSwapRecorder();
|
||||
|
||||
void spawnParticle(World world, String particleName, double x, double y, double z);
|
||||
}
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ public class FightStatistics {
|
||||
int newRedElo = (int) Math.round(redElo + K * (1 - blueResult - redWinExpectation));
|
||||
Elo.setElo(blueLeader, gameMode, newBlueElo);
|
||||
Elo.setElo(redLeader, gameMode, newRedElo);
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getBlueTeam().getPrefix() + SteamwarUser.get(blueLeader).getUserName() + "§8: §7" + blueElo + "§8»§e" + newBlueElo);
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getRedTeam().getPrefix() + SteamwarUser.get(redLeader).getUserName() + "§8: §7" + redElo + "§8»§e" + newRedElo);
|
||||
FightSystem.broadcast("§7ELO von " + Fight.getBlueTeam().getPrefix() + SteamwarUser.get(blueLeader).getUserName() + "§8: §7" + blueElo + "§8»§e" + newBlueElo);
|
||||
FightSystem.broadcast("§7ELO von " + Fight.getRedTeam().getPrefix() + SteamwarUser.get(redLeader).getUserName() + "§8: §7" + redElo + "§8»§e" + newRedElo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.fightsystem.VersionDependent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
@ -32,5 +34,7 @@ public class WorldOfColorWrapper {
|
||||
public interface IWorldOfColorWrapper {
|
||||
void setTeamColor(Team team, ChatColor color);
|
||||
boolean isInBlock(Arrow e);
|
||||
|
||||
void playSound(Location location, Sound sound, String soundCategory, float volume, float pitch);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependent;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class EventTeamOffWincondition extends Wincondition{
|
||||
|
||||
@ -35,7 +34,7 @@ public class EventTeamOffWincondition extends Wincondition{
|
||||
@Override
|
||||
public void enable() {
|
||||
if(Fight.getBlueTeam().allPlayersOut() && Fight.getRedTeam().allPlayersOut()){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cBeide Teams sind offline!");
|
||||
FightSystem.broadcast("§cBeide Teams sind offline!");
|
||||
win(null);
|
||||
}else{
|
||||
teamOff(Fight.getBlueTeam());
|
||||
@ -52,7 +51,7 @@ public class EventTeamOffWincondition extends Wincondition{
|
||||
|
||||
private void teamOff(FightTeam team){
|
||||
if(team.allPlayersOut()){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDas Team " + team.getColoredName() + " §cist offline!");
|
||||
FightSystem.broadcast("§cDas Team " + team.getColoredName() + " §cist offline!");
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -46,7 +45,7 @@ public class RankedPlayerLeftWincondition extends Wincondition implements Listen
|
||||
return;
|
||||
|
||||
if(team.isPlayerLeader(player)) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + team.getColoredName() + " §chat den Kampf verlassen!");
|
||||
FightSystem.broadcast("§cDer Leader von " + team.getColoredName() + " §chat den Kampf verlassen!");
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -54,7 +53,7 @@ public class WinconditionAllDead extends Wincondition implements Listener {
|
||||
return;
|
||||
|
||||
if(team.allPlayersOut()) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + team.getColoredName() + message);
|
||||
FightSystem.broadcast("§cDer letzte Spieler aus " + team.getColoredName() + message);
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -54,7 +53,7 @@ public class WinconditionCaptainDead extends Wincondition implements Listener {
|
||||
return;
|
||||
|
||||
if(team.isPlayerLeader(player)) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + team.getColoredName() + message);
|
||||
FightSystem.broadcast("§cDer Leader von " + team.getColoredName() + message);
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import de.steamwar.fightsystem.countdown.TimeOverCountdown;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class WinconditionHeartRatioTimeout extends Wincondition {
|
||||
|
||||
@ -41,13 +40,13 @@ public class WinconditionHeartRatioTimeout extends Wincondition {
|
||||
double redHeartRatio = Fight.getRedTeam().getHeartRatio();
|
||||
|
||||
if(blueHeartRatio > redHeartRatio) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDie Zeit ist abgelaufen, und Team " + Fight.getBlueTeam().getColoredName() + " §chatte mehr verbleibende Leben!");
|
||||
FightSystem.broadcast("§cDie Zeit ist abgelaufen, und Team " + Fight.getBlueTeam().getColoredName() + " §chatte mehr verbleibende Leben!");
|
||||
win(Fight.getBlueTeam());
|
||||
}else if(blueHeartRatio < redHeartRatio){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDie Zeit ist abgelaufen, und Team " + Fight.getRedTeam().getColoredName() + " §chatte mehr verbleibende Leben!");
|
||||
FightSystem.broadcast("§cDie Zeit ist abgelaufen, und Team " + Fight.getRedTeam().getColoredName() + " §chatte mehr verbleibende Leben!");
|
||||
win(Fight.getRedTeam());
|
||||
}else{
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDie Zeit ist abgelaufen, und beide Teams hatten die gleiche Anzahl an verbleibenden Leben!");
|
||||
FightSystem.broadcast("§cDie Zeit ist abgelaufen, und beide Teams hatten die gleiche Anzahl an verbleibenden Leben!");
|
||||
win(null);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
@ -93,7 +92,7 @@ public class WinconditionPercentSystem extends Wincondition implements Listener,
|
||||
destroyedBlocks += event.blockList().size();
|
||||
percent = (double)destroyedBlocks * 100 / volume;
|
||||
if(percent >= Config.PercentWin) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cTeam " + team.getColoredName() + " §chat zu viel Schaden erlitten!");
|
||||
FightSystem.broadcast("§cTeam " + team.getColoredName() + " §chat zu viel Schaden erlitten!");
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import de.steamwar.fightsystem.countdown.TimeOverCountdown;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class WinconditionPercentTimeout extends Wincondition {
|
||||
|
||||
@ -41,13 +40,13 @@ public class WinconditionPercentTimeout extends Wincondition {
|
||||
double redPercent = Wincondition.percentWincondition.getPercent(Fight.getRedTeam());
|
||||
|
||||
if(bluePercent > redPercent) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDie Zeit ist abgelaufen, und Team " + Fight.getRedTeam().getColoredName() + " §chat weniger Schaden erlitten!");
|
||||
FightSystem.broadcast("§cDie Zeit ist abgelaufen, und Team " + Fight.getRedTeam().getColoredName() + " §chat weniger Schaden erlitten!");
|
||||
win(Fight.getRedTeam());
|
||||
}else if(bluePercent < redPercent){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDie Zeit ist abgelaufen, und Team " + Fight.getBlueTeam().getColoredName() + " §chat weniger Schaden erlitten!");
|
||||
FightSystem.broadcast("§cDie Zeit ist abgelaufen, und Team " + Fight.getBlueTeam().getColoredName() + " §chat weniger Schaden erlitten!");
|
||||
win(Fight.getBlueTeam());
|
||||
}else{
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDie Zeit ist abgelaufen, und beide Teams hatten gleichen Schaden erlitten!");
|
||||
FightSystem.broadcast("§cDie Zeit ist abgelaufen, und beide Teams hatten gleichen Schaden erlitten!");
|
||||
win(null);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependent;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -71,13 +70,13 @@ public class WinconditionPoints extends Wincondition implements PrintableWincond
|
||||
int bluePoints = teamMap.get(Fight.getBlueTeam()).getPoints();
|
||||
|
||||
if(bluePoints < redPoints) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDas Team " + Fight.getRedTeam().getColoredName() + " §chat mehr Punkte!");
|
||||
FightSystem.broadcast("§cDas Team " + Fight.getRedTeam().getColoredName() + " §chat mehr Punkte!");
|
||||
win(Fight.getRedTeam());
|
||||
}else if(bluePoints > redPoints){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDas Team " + Fight.getBlueTeam().getColoredName() + " §chat mehr Punkte!");
|
||||
FightSystem.broadcast("§cDas Team " + Fight.getBlueTeam().getColoredName() + " §chat mehr Punkte!");
|
||||
win(Fight.getBlueTeam());
|
||||
}else{
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cBeide Teams haben gleich viele Punkte!");
|
||||
FightSystem.broadcast("§cBeide Teams haben gleich viele Punkte!");
|
||||
win(null);
|
||||
}
|
||||
}
|
||||
@ -100,7 +99,7 @@ public class WinconditionPoints extends Wincondition implements PrintableWincond
|
||||
TeamPoints enemy = teamMap.get(Fight.getOpposite(team));
|
||||
if(team.isPlayerLeader(player)) {
|
||||
enemy.points += 500;
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + team.getColoredName() + message);
|
||||
FightSystem.broadcast("§cDer Leader von " + team.getColoredName() + message);
|
||||
timeOver();
|
||||
}else if(team.getPlayers().size() <= 5)
|
||||
enemy.points += 300;
|
||||
|
@ -77,7 +77,7 @@ public class WinconditionPumpkinTechKO extends Wincondition implements Printable
|
||||
});
|
||||
|
||||
if(pumpkins == 0) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDas Team " + team.getColoredName() + " §cist Tech K.O.!");
|
||||
FightSystem.broadcast("§cDas Team " + team.getColoredName() + " §cist Tech K.O.!");
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class WinconditionRelativePercent extends Wincondition implements Printab
|
||||
return;
|
||||
|
||||
if(getPercent() >= Config.PercentWin){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cTeam " + team.getColoredName() + " §chat zu viel Schaden erlitten!");
|
||||
FightSystem.broadcast("§cTeam " + team.getColoredName() + " §chat zu viel Schaden erlitten!");
|
||||
FightSystem.setSpectateState(Fight.getOpposite(team), "RelativePercent");
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class WinconditionTimeTechKO extends Wincondition {
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cTeam " + team.getColoredName() + " §chat zu lange nicht geschossen!");
|
||||
FightSystem.broadcast("§cTeam " + team.getColoredName() + " §chat zu lange nicht geschossen!");
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.TimeOverCountdown;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class WinconditionTimeout extends Wincondition {
|
||||
|
||||
@ -36,7 +35,7 @@ public class WinconditionTimeout extends Wincondition {
|
||||
}
|
||||
|
||||
protected void timeOver() {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDie Zeit ist abgelaufen!");
|
||||
FightSystem.broadcast("§cDie Zeit ist abgelaufen!");
|
||||
win(null);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class WinconditionWaterTechKO extends Wincondition implements PrintableWi
|
||||
});
|
||||
|
||||
if(water == 0){
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cTeam " + team.getColoredName() + " §cwurde Tech K.O. gesetzt!");
|
||||
FightSystem.broadcast("§cTeam " + team.getColoredName() + " §cwurde Tech K.O. gesetzt!");
|
||||
win(Fight.getOpposite(team));
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren