Adding 1.8 Version Support
Dieser Commit ist enthalten in:
Ursprung
e068a72f49
Commit
cc42c86549
42
FightSystem_12/pom.xml
Normale Datei
42
FightSystem_12/pom.xml
Normale Datei
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>FightSystem</artifactId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>FightSystem_12</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>FightSystem_8</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot</artifactId>
|
||||
<version>1.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,11 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
class Countdown_12 {
|
||||
private Countdown_12(){}
|
||||
|
||||
static Sound getSound(String sound){
|
||||
return Sound.valueOf(sound);
|
||||
}
|
||||
}
|
45
FightSystem_12/src/de/steamwar/fightsystem/fight/FightTeam_12.java
Normale Datei
45
FightSystem_12/src/de/steamwar/fightsystem/fight/FightTeam_12.java
Normale Datei
@ -0,0 +1,45 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class FightTeam_12 {
|
||||
private FightTeam_12(){}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final int COLOR_TO_REPLACE = DyeColor.PINK.getWoolData();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock CONCRETE = new BaseBlock(Material.CONCRETE.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock CONCRETE_POWDER = new BaseBlock(Material.CONCRETE_POWDER.getId(), COLOR_TO_REPLACE);
|
||||
|
||||
private static final Set<BaseBlock> CONCRETE_SET = Collections.singleton(CONCRETE);
|
||||
private static final Set<BaseBlock> CONCRETE_POWDER_SET = Collections.singleton(CONCRETE_POWDER);
|
||||
|
||||
static void setTeamColor(Team team, ChatColor color){
|
||||
team.setColor(color);
|
||||
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
static void replaceTeamColor(EditSession e, DyeColor c, CuboidRegion region){
|
||||
FightTeam_8.replaceTeamColor(e, c, region);
|
||||
try {
|
||||
e.replaceBlocks(region, CONCRETE_SET, new BaseBlock(CONCRETE.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, CONCRETE_POWDER_SET, new BaseBlock(CONCRETE_POWDER.getId(), c.getWoolData()));
|
||||
} catch (MaxChangedBlocksException ex) {
|
||||
// ignore, will never occur
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class BasicListener_12 {
|
||||
private BasicListener_12(){}
|
||||
|
||||
static void toActionbar(Player player, BaseComponent... components){
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, components);
|
||||
}
|
||||
|
||||
static void setAttackSpeed(Player player){
|
||||
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
|
||||
attribute.setBaseValue(16);
|
||||
}
|
||||
}
|
15
FightSystem_12/src/de/steamwar/fightsystem/utils/TechHider_v12.java
Normale Datei
15
FightSystem_12/src/de/steamwar/fightsystem/utils/TechHider_v12.java
Normale Datei
@ -0,0 +1,15 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
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;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class TechHider_v12 {
|
||||
private TechHider_v12(){}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
37
FightSystem_8/pom.xml
Normale Datei
37
FightSystem_8/pom.xml
Normale Datei
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>FightSystem</artifactId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>FightSystem_8</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot</artifactId>
|
||||
<version>1.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
20
FightSystem_8/src/de/steamwar/fightsystem/countdown/Countdown_8.java
Normale Datei
20
FightSystem_8/src/de/steamwar/fightsystem/countdown/Countdown_8.java
Normale Datei
@ -0,0 +1,20 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
class Countdown_8 {
|
||||
private Countdown_8(){}
|
||||
|
||||
static Sound getSound(String sound){
|
||||
switch(sound){
|
||||
case "ENTITY_WITHER_DEATH":
|
||||
return Sound.WITHER_DEATH;
|
||||
case "BLOCK_NOTE_BASS":
|
||||
return Sound.NOTE_BASS;
|
||||
case "BLOCK_NOTE_PLING":
|
||||
return Sound.NOTE_PLING;
|
||||
default:
|
||||
return Sound.valueOf(sound);
|
||||
}
|
||||
}
|
||||
}
|
52
FightSystem_8/src/de/steamwar/fightsystem/fight/FightTeam_8.java
Normale Datei
52
FightSystem_8/src/de/steamwar/fightsystem/fight/FightTeam_8.java
Normale Datei
@ -0,0 +1,52 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.scoreboard.NameTagVisibility;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
class FightTeam_8 {
|
||||
private FightTeam_8(){}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final int COLOR_TO_REPLACE = DyeColor.PINK.getWoolData();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock WOOL = new BaseBlock(Material.WOOL.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock GLASS = new BaseBlock(Material.STAINED_GLASS.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock CLAY = new BaseBlock(Material.CLAY.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock GLASS_PANE = new BaseBlock(Material.STAINED_GLASS_PANE.getId(), COLOR_TO_REPLACE);
|
||||
|
||||
private static final Set<BaseBlock> WOOL_SET = Collections.singleton(WOOL);
|
||||
private static final Set<BaseBlock> CLAY_SET = Collections.singleton(CLAY);
|
||||
private static final Set<BaseBlock> GLASS_SET = Collections.singleton(GLASS);
|
||||
private static final Set<BaseBlock> GLASS_PANE_SET = Collections.singleton(GLASS_PANE);
|
||||
|
||||
static void setTeamColor(Team team, ChatColor color){
|
||||
team.setPrefix("§" + color.getChar());
|
||||
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
static void replaceTeamColor(EditSession e, DyeColor c, CuboidRegion region){
|
||||
try {
|
||||
e.replaceBlocks(region, WOOL_SET, new BaseBlock(WOOL.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, CLAY_SET, new BaseBlock(CLAY.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, GLASS_SET, new BaseBlock(GLASS.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, GLASS_PANE_SET, new BaseBlock(GLASS_PANE.getId(), c.getWoolData()));
|
||||
} catch (MaxChangedBlocksException ex) {
|
||||
// ignore, will never occur
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class BasicListener_8 {
|
||||
private BasicListener_8(){}
|
||||
|
||||
static void toActionbar(Player player, BaseComponent... components){
|
||||
player.spigot().sendMessage(components);
|
||||
}
|
||||
}
|
15
FightSystem_8/src/de/steamwar/fightsystem/utils/TechHider_v8.java
Normale Datei
15
FightSystem_8/src/de/steamwar/fightsystem/utils/TechHider_v8.java
Normale Datei
@ -0,0 +1,15 @@
|
||||
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;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class TechHider_v8 {
|
||||
private TechHider_v8(){}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
67
FightSystem_Main/pom.xml
Normale Datei
67
FightSystem_Main/pom.xml
Normale Datei
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>FightSystem</artifactId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>FightSystem_Main</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot</artifactId>
|
||||
<version>1.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>FightSystem_8</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>FightSystem_12</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,5 +1,6 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -21,9 +22,9 @@ public abstract class Countdown {
|
||||
abstract String countdownCounting();
|
||||
abstract void countdownFinished();
|
||||
|
||||
Countdown(int time, Sound sound, boolean level) {
|
||||
Countdown(int time, String sound, boolean level) {
|
||||
this.time = time;
|
||||
this.sound = sound;
|
||||
this.sound = getSound(sound);
|
||||
this.level = level;
|
||||
countdowns.add(this);
|
||||
|
||||
@ -31,6 +32,18 @@ public abstract class Countdown {
|
||||
this.taskID = bukkitScheduler.scheduleSyncRepeatingTask(FightSystem.getPlugin(), this::count, 0, 20);
|
||||
}
|
||||
|
||||
public static Sound getSound(String sound){
|
||||
if(sound == null)
|
||||
return null;
|
||||
|
||||
switch (Core.getVersion()){
|
||||
case 8:
|
||||
return Countdown_8.getSound(sound);
|
||||
default:
|
||||
return Countdown_12.getSound(sound);
|
||||
}
|
||||
}
|
||||
|
||||
public static void cancelAllTimers() {
|
||||
while (!countdowns.isEmpty()) {
|
||||
countdowns.get(0).cancelTimer();
|
@ -3,12 +3,11 @@ package de.steamwar.fightsystem.countdown;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class EnternCountdown extends Countdown {
|
||||
|
||||
public EnternCountdown() {
|
||||
super(Config.EnterPhaseBegin, Sound.BLOCK_NOTE_PLING, false);
|
||||
super(Config.EnterPhaseBegin, "BLOCK_NOTE_PLING", false);
|
||||
}
|
||||
|
||||
@Override
|
@ -1,13 +1,12 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import org.bukkit.Sound;
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
|
||||
public class EventStartCountdown extends Countdown {
|
||||
|
||||
public EventStartCountdown() {
|
||||
super(Config.SetupDuration, Sound.BLOCK_NOTE_PLING, false);
|
||||
super(Config.SetupDuration, "BLOCK_NOTE_PLING", false);
|
||||
}
|
||||
|
||||
@Override
|
@ -2,12 +2,11 @@ package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class PreRunningCountdown extends Countdown {
|
||||
|
||||
public PreRunningCountdown() {
|
||||
super(Config.PreFightDuration, Sound.BLOCK_NOTE_PLING, true);
|
||||
super(Config.PreFightDuration, "BLOCK_NOTE_PLING", true);
|
||||
}
|
||||
|
||||
@Override
|
@ -2,12 +2,11 @@ package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class SpectateOverCountdown extends Countdown {
|
||||
|
||||
public SpectateOverCountdown() {
|
||||
super(Config.SpectatorDuration, Sound.BLOCK_NOTE_PLING, false);
|
||||
super(Config.SpectatorDuration, "BLOCK_NOTE_PLING", false);
|
||||
}
|
||||
|
||||
@Override
|
@ -5,14 +5,13 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.winconditions.WinconditionTechKO;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class TechKOCountdown extends Countdown {
|
||||
|
||||
private final FightTeam team;
|
||||
|
||||
public TechKOCountdown(FightTeam team) {
|
||||
super(WinconditionTechKO.TECH_KO_COUNTDOWN_TIME, Sound.BLOCK_NOTE_PLING, false);
|
||||
super(WinconditionTechKO.TECH_KO_COUNTDOWN_TIME, "BLOCK_NOTE_PLING", false);
|
||||
this.team = team;
|
||||
}
|
||||
|
@ -3,12 +3,11 @@ package de.steamwar.fightsystem.countdown;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class TimeOverCountdown extends Countdown {
|
||||
|
||||
public TimeOverCountdown() {
|
||||
super(Config.TimeoutTime, Sound.BLOCK_NOTE_BASS, false);
|
||||
super(Config.TimeoutTime, "BLOCK_NOTE_BASS", false);
|
||||
}
|
||||
|
||||
@Override
|
@ -2,13 +2,12 @@ package de.steamwar.fightsystem.fight;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.kit.KitManager;
|
||||
import de.steamwar.fightsystem.utils.*;
|
||||
@ -23,35 +22,15 @@ import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
public class FightTeam {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final int COLOR_TO_REPLACE = DyeColor.PINK.getWoolData();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock WOOL = new BaseBlock(Material.WOOL.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock GLASS = new BaseBlock(Material.STAINED_GLASS.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock CLAY = new BaseBlock(Material.CLAY.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock GLASS_PANE = new BaseBlock(Material.STAINED_GLASS_PANE.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock CONCRETE = new BaseBlock(Material.CONCRETE.getId(), COLOR_TO_REPLACE);
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final BaseBlock CONCRETE_POWDER = new BaseBlock(Material.CONCRETE_POWDER.getId(), COLOR_TO_REPLACE);
|
||||
|
||||
private static final Set<BaseBlock> WOOL_SET = Collections.singleton(WOOL);
|
||||
private static final Set<BaseBlock> CONCRETE_SET = Collections.singleton(CONCRETE);
|
||||
private static final Set<BaseBlock> CLAY_SET = Collections.singleton(CLAY);
|
||||
private static final Set<BaseBlock> GLASS_SET = Collections.singleton(GLASS);
|
||||
private static final Set<BaseBlock> GLASS_PANE_SET = Collections.singleton(GLASS_PANE);
|
||||
private static final Set<BaseBlock> CONCRETE_POWDER_SET = Collections.singleton(CONCRETE_POWDER);
|
||||
|
||||
private FightPlayer leader;
|
||||
private final UUID designatedLeader;
|
||||
private final Set<FightPlayer> players = new HashSet<>();
|
||||
@ -84,9 +63,18 @@ public class FightTeam {
|
||||
team = FightScoreboard.getScoreboard().registerNewTeam(name);
|
||||
else
|
||||
team = FightScoreboard.getScoreboard().getTeam(name);
|
||||
team.setColor(color);
|
||||
setTeamColor(team, color);
|
||||
team.setAllowFriendlyFire(false);
|
||||
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
||||
}
|
||||
|
||||
private void setTeamColor(Team team, ChatColor color){
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
FightTeam_8.setTeamColor(team, color);
|
||||
break;
|
||||
default:
|
||||
FightTeam_12.setTeamColor(team, color);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canbeLeader(Player p){
|
||||
@ -256,21 +244,16 @@ public class FightTeam {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), this::teleportToSpawn,40);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void replaceTeamColor(EditSession e){
|
||||
CuboidRegion region = new CuboidRegion(corner, corner.add(Config.Schemsize));
|
||||
|
||||
DyeColor c = ColorConverter.chat2dye(color);
|
||||
|
||||
try {
|
||||
e.replaceBlocks(region, WOOL_SET, new BaseBlock(WOOL.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, CONCRETE_SET, new BaseBlock(CONCRETE.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, CONCRETE_POWDER_SET, new BaseBlock(CONCRETE_POWDER.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, CLAY_SET, new BaseBlock(CLAY.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, GLASS_SET, new BaseBlock(GLASS.getId(), c.getWoolData()));
|
||||
e.replaceBlocks(region, GLASS_PANE_SET, new BaseBlock(GLASS_PANE.getId(), c.getWoolData()));
|
||||
} catch (MaxChangedBlocksException ex) {
|
||||
// ignore, will never occur
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
FightTeam_8.replaceTeamColor(e, c, region);
|
||||
break;
|
||||
default:
|
||||
FightTeam_12.replaceTeamColor(e, c, region);
|
||||
}
|
||||
|
||||
e.flushQueue();
|
@ -1,8 +1,10 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightState;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -42,4 +44,23 @@ public abstract class BasicListener implements Listener {
|
||||
HandlerList.unregisterAll(this);
|
||||
listeners.remove(this);
|
||||
}
|
||||
|
||||
void toActionbar(Player player, BaseComponent... components){
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
BasicListener_8.toActionbar(player, components);
|
||||
break;
|
||||
default:
|
||||
BasicListener_12.toActionbar(player, components);
|
||||
}
|
||||
}
|
||||
|
||||
void setAttackSpeed(Player player){
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
break;
|
||||
default:
|
||||
BasicListener_12.setAttackSpeed(player);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -15,7 +14,7 @@ public class BlockListener extends BasicListener {
|
||||
|
||||
if(notRunning() || notFighting(player)){
|
||||
event.setCancelled(true);
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cDu darfst erst nach Fightbeginn Blöcke abbauen!"));
|
||||
toActionbar(player, TextComponent.fromLegacyText("§cDu darfst erst nach Fightbeginn Blöcke abbauen!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +24,7 @@ public class BlockListener extends BasicListener {
|
||||
|
||||
if(notRunning() || notFighting(player)) {
|
||||
event.setCancelled(true);
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cDu darfst erst nach Fightbeginn Blöcke setzen!"));
|
||||
toActionbar(player, TextComponent.fromLegacyText("§cDu darfst erst nach Fightbeginn Blöcke setzen!"));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -63,7 +62,7 @@ public class EntityDamageListener extends BasicListener {
|
||||
|
||||
if(Fight.getPlayerTeam(player) == Fight.getPlayerTeam(damager)) {
|
||||
event.setCancelled(true);
|
||||
damager.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cDu darfst deinen Teamkollegen keinen Schaden zufügen!"));
|
||||
toActionbar(damager, TextComponent.fromLegacyText("§cDu darfst deinen Teamkollegen keinen Schaden zufügen!"));
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package de.steamwar.fightsystem.listener;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
|
||||
public class FoodLevelChangeListener extends BasicListener {
|
||||
|
||||
@ -10,5 +11,8 @@ public class FoodLevelChangeListener extends BasicListener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onWeatherChange(WeatherChangeEvent event){
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -8,8 +8,6 @@ import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
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;
|
||||
@ -25,8 +23,7 @@ public class PlayerConnectionListener extends BasicListener{
|
||||
Player player = event.getPlayer();
|
||||
player.setHealth(20);
|
||||
player.setFoodLevel(20);
|
||||
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
|
||||
attribute.setBaseValue(16);
|
||||
setAttackSpeed(player);
|
||||
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
|
@ -1,11 +1,11 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -26,6 +26,6 @@ public class PlayerDeathListener extends BasicListener {
|
||||
fightTeam.getFightPlayer(player).setOut();
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
player.teleport(fightTeam.getSpawn());
|
||||
Fight.playSound(Sound.ENTITY_WITHER_DEATH, 100.0F, 1.0F);
|
||||
Fight.playSound(Countdown.getSound("ENTITY_WITHER_DEATH"), 100.0F, 1.0F);
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ import de.steamwar.fightsystem.fight.FightState;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.utils.Config;
|
||||
import de.steamwar.fightsystem.utils.Region;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -74,6 +73,6 @@ public class PlayerMoveListener extends BasicListener {
|
||||
private void reset(PlayerMoveEvent event, String message){
|
||||
Player player = event.getPlayer();
|
||||
player.teleport(event.getFrom());
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
|
||||
toActionbar(player, TextComponent.fromLegacyText(message));
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
@ -11,7 +10,7 @@ public class PlayerTeleportListener extends BasicListener {
|
||||
public void onTpGM3(PlayerTeleportEvent e) {
|
||||
if (e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cDu darfst diese Teleportfunktion nicht benutzen!"));
|
||||
toActionbar(e.getPlayer(), TextComponent.fromLegacyText("§cDu darfst diese Teleportfunktion nicht benutzen!"));
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.FightState;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -16,7 +15,7 @@ public class ProjectileLaunchListener extends BasicListener {
|
||||
event.setCancelled(true);
|
||||
if(event.getEntity().getShooter() instanceof Player){
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cDu darfst den Bogen erst nach Fightbeginn nutzen!"));
|
||||
toActionbar(player, TextComponent.fromLegacyText("§cDu darfst den Bogen erst nach Fightbeginn nutzen!"));
|
||||
}
|
||||
}
|
||||
}
|
@ -13,18 +13,16 @@ import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
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.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
@ -77,6 +75,7 @@ public class TechHider {
|
||||
if(Config.event())
|
||||
threadMultiplier = 4;
|
||||
|
||||
if(Core.getVersion() > 8){
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ITEM) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
@ -87,6 +86,7 @@ public class TechHider {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ENTITY) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
@ -360,11 +360,21 @@ public class TechHider {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
for(Pair<Integer, Integer> chunk : chunksToReload){
|
||||
if(bypass(p, chunk.getKey(), chunk.getValue()))
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), 65535));
|
||||
reloadChunk(p, chunk);
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
|
||||
private static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
TechHider_v8.reloadChunk(p, chunk);
|
||||
break;
|
||||
default:
|
||||
TechHider_v12.reloadChunk(p, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean disabled(){
|
||||
return Config.event() && Config.OnlyPublicSchematics;
|
||||
}
|
31
pom.xml
31
pom.xml
@ -4,11 +4,11 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>de.steamwar</groupId>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>FightSystem</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<url>https://maven.apache.org</url>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -22,35 +22,26 @@
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<modules>
|
||||
<module>FightSystem_8</module>
|
||||
<module>FightSystem_12</module>
|
||||
<module>FightSystem_Main</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>SpigotCore</artifactId>
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren