Bugfixes
Dieser Commit ist enthalten in:
Ursprung
b9a26c768f
Commit
d3adc79f0f
@ -21,5 +21,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: warking:SpigotCore:1.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: warking:WorldEdit:1.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: warking:FAWE:1.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: warking:ProtocolLib:1.0" level="project" />
|
||||
</component>
|
||||
</module>
|
6
pom.xml
6
pom.xml
@ -74,5 +74,11 @@
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>warking</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -31,7 +31,7 @@ public class FightSystem extends JavaPlugin {
|
||||
private Scoreboard scoreboard;
|
||||
private WaterRemover waterRemover;
|
||||
|
||||
private FightState fightState;
|
||||
private static FightState fightState;
|
||||
public int fightTime = 0;
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ public class FightSystem extends JavaPlugin {
|
||||
private final File kits = new File("plugins/" + this.getName(), "kits.data");
|
||||
private final FileConfiguration getKitData = YamlConfiguration.loadConfiguration(kits);
|
||||
|
||||
public void saveKitData() {
|
||||
private void saveKitData() {
|
||||
try { getKitData.save(kits); } catch (Exception ignored) { }
|
||||
}
|
||||
|
||||
@ -65,6 +65,13 @@ public class FightSystem extends JavaPlugin {
|
||||
fightState = FightState.SETUP;
|
||||
Countdown countdown = new Countdown(Config.NoPlayerOnlineDuration, new FinishNoPlayersOnline());
|
||||
countdown.startTimer(getPlugin());
|
||||
|
||||
/*ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.MAP_CHUNK) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent e) {
|
||||
e.getPacket();
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
@ -109,11 +116,7 @@ public class FightSystem extends JavaPlugin {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public FightState getCurrentFightState() {
|
||||
return fightState;
|
||||
}
|
||||
|
||||
public FightState getFightState() {
|
||||
public static FightState getFightState() {
|
||||
return fightState;
|
||||
}
|
||||
|
||||
@ -126,9 +129,9 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void setPreRunningState() {
|
||||
if(this.fightState != FightState.SETUP)
|
||||
if(fightState != FightState.SETUP)
|
||||
return;
|
||||
this.fightState = FightState.PRE_RUNNING;
|
||||
fightState = FightState.PRE_RUNNING;
|
||||
Countdown.cancelAllTimers();
|
||||
|
||||
Countdown countdown = new Countdown(Config.PreFightDuration, new FinishPreRunning());
|
||||
@ -169,9 +172,9 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void setRunningState() {
|
||||
if(this.fightState != FightState.PRE_RUNNING)
|
||||
if(fightState != FightState.PRE_RUNNING)
|
||||
return;
|
||||
this.fightState = FightState.RUNNING;
|
||||
fightState = FightState.RUNNING;
|
||||
Countdown.cancelAllTimers();
|
||||
|
||||
getWaterRemover().start();
|
||||
@ -185,18 +188,15 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void setSpectateState(FightTeam winFightTeam) {
|
||||
if(this.fightState != FightState.RUNNING)
|
||||
if(fightState != FightState.RUNNING)
|
||||
return;
|
||||
this.fightState = FightState.SPECTATE;
|
||||
fightState = FightState.SPECTATE;
|
||||
Countdown.cancelAllTimers();
|
||||
Bukkit.getScheduler().cancelTask(WinconditionTechKO.taskID);
|
||||
|
||||
setAllPlayersGM(GameMode.SPECTATOR);
|
||||
for(FightPlayer team1 : winFightTeam.getPlayers()) {
|
||||
team1.getPlayer().getInventory().clear();
|
||||
}
|
||||
for(FightPlayer team2 : Fight.getOpposite(winFightTeam).getPlayers()) {
|
||||
team2.getPlayer().getInventory().clear();
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
p.getInventory().clear();
|
||||
}
|
||||
Bukkit.broadcastMessage(" ");
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class PlayerMoveListener implements Listener {
|
||||
if(fightTeam == null){
|
||||
player.teleport(from);
|
||||
player.sendMessage(FightSystem.PREFIX + "§cDu darfst die Arena nicht verlassen!");
|
||||
}else if(instance.getCurrentFightState() == FightState.RUNNING)
|
||||
}else if(FightSystem.getFightState() == FightState.RUNNING)
|
||||
player.damage(2);
|
||||
else if(fightTeam == Fight.redTeam)
|
||||
player.teleport(Config.TeamRedSpawn);
|
||||
|
@ -13,10 +13,12 @@ public class ProjectileLaunchListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
if(instance.getFightState() != FightState.RUNNING) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(FightSystem.PREFIX + "§cDu kannst den Bogen erst nach Fightbeginn nutzen!");
|
||||
if(event.getEntity().getShooter() instanceof Player){
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
player.sendMessage(FightSystem.PREFIX + "§cDu kannst den Bogen erst nach Fightbeginn nutzen!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class WinconditionCaptainDead implements Listener {
|
||||
@EventHandler
|
||||
public void handlePlayerDeath(PlayerDeathEvent event) {
|
||||
if(!Config.CaptainDead) return;
|
||||
if(instance.getFightState() != FightState.PRE_RUNNING && instance.getFightState() != FightState.RUNNING) return;
|
||||
if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) return;
|
||||
Player player = event.getEntity().getPlayer();
|
||||
if(Fight.getPlayerTeam(player) == null) return;
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
@ -35,7 +35,7 @@ public class WinconditionCaptainDead implements Listener {
|
||||
@EventHandler
|
||||
public void handlePlayerQuit(PlayerQuitEvent event) {
|
||||
if(!Config.CaptainDead) return;
|
||||
if(instance.getFightState() != FightState.PRE_RUNNING && instance.getFightState() != FightState.RUNNING) return;
|
||||
if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) return;
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.getPlayerTeam(player) == null) return;
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
@ -44,7 +44,6 @@ public class WinconditionCaptainDead implements Listener {
|
||||
if(fightTeam.isPlayerLeader(player)) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!");
|
||||
instance.setSpectateState(Fight.getOpposite(fightTeam));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,9 @@ package me.yaruma.fightsystem.winconditions;
|
||||
|
||||
import me.yaruma.fightsystem.FightSystem;
|
||||
import me.yaruma.fightsystem.fight.Fight;
|
||||
import me.yaruma.fightsystem.fight.FightState;
|
||||
import me.yaruma.fightsystem.utils.Config;
|
||||
import me.yaruma.fightsystem.utils.Region;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -27,6 +27,7 @@ public class WinconditionPercentSystem implements Listener {
|
||||
@EventHandler
|
||||
public void handleEntityExplode(EntityExplodeEvent event) {
|
||||
if(!Config.PercentSystem) return;
|
||||
if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) return;
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
//Team Blue
|
||||
|
@ -2,6 +2,7 @@ package me.yaruma.fightsystem.winconditions;
|
||||
|
||||
import me.yaruma.fightsystem.FightSystem;
|
||||
import me.yaruma.fightsystem.fight.Fight;
|
||||
import me.yaruma.fightsystem.fight.FightState;
|
||||
import me.yaruma.fightsystem.utils.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -12,12 +13,13 @@ import java.util.Iterator;
|
||||
|
||||
public class WinconditionTechKO {
|
||||
|
||||
public static HashSet<Location> teamRedWater = new HashSet<>();
|
||||
public static HashSet<Location> teamBlueWater = new HashSet<>();
|
||||
private static HashSet<Location> teamRedWater = new HashSet<>();
|
||||
private static HashSet<Location> teamBlueWater = new HashSet<>();
|
||||
public static int taskID;
|
||||
|
||||
public static void addWater() {
|
||||
if(!Config.TechKO) return;
|
||||
if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) return;
|
||||
|
||||
teamRedWater.clear();
|
||||
teamBlueWater.clear();
|
||||
@ -71,12 +73,11 @@ public class WinconditionTechKO {
|
||||
FightSystem.getPlugin().setSpectateState(Fight.getRedTeam());
|
||||
FightSystem.getPlugin().getWaterRemover().stop();
|
||||
}
|
||||
System.out.println("RedList: " + teamRedWater.size());
|
||||
System.out.println("BlueList: " + teamBlueWater.size());
|
||||
}
|
||||
|
||||
public static void removeWater() {
|
||||
if(!Config.TechKO) return;
|
||||
if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) return;
|
||||
|
||||
//Team Red
|
||||
Iterator itrRed = teamRedWater.iterator();
|
||||
@ -84,7 +85,6 @@ public class WinconditionTechKO {
|
||||
Location location = (Location) itrRed.next();
|
||||
if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) {
|
||||
itrRed.remove();
|
||||
System.out.println("red remove" + teamRedWater.size());
|
||||
}
|
||||
}
|
||||
if(teamRedWater.isEmpty()) {
|
||||
@ -100,7 +100,6 @@ public class WinconditionTechKO {
|
||||
Location location = (Location) itrBlue.next();
|
||||
if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) {
|
||||
itrBlue.remove();
|
||||
System.out.println("blue remove" + teamBlueWater.size());
|
||||
}
|
||||
}
|
||||
if(teamBlueWater.isEmpty()) {
|
||||
@ -113,7 +112,7 @@ public class WinconditionTechKO {
|
||||
|
||||
public static void startAutoChecker() {
|
||||
if(!Config.TechKO) return;
|
||||
taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(FightSystem.getPlugin(), () -> addWater(), 0, 20*20);
|
||||
taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(FightSystem.getPlugin(), WinconditionTechKO::addWater, 0, 20*20);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ name: FightSystem
|
||||
version: 1.0
|
||||
author: [Yaruma3341, Lixfel]
|
||||
main: me.yaruma.fightsystem.FightSystem
|
||||
depend: [CoreSystem, WorldEdit, FastAsyncWorldEdit]
|
||||
depend: [CoreSystem, WorldEdit, FastAsyncWorldEdit, ProtocolLib]
|
||||
|
||||
commands:
|
||||
ak:
|
In neuem Issue referenzieren
Einen Benutzer sperren