SteamWar/FightSystem
Archiviert
13
1

Adding 1.9 and 1.10 support, also refactoring Multiversion Support to current norm

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2019-12-27 11:05:12 +01:00
Ursprung 6582b9a5c4
Commit 692cd609bc
32 geänderte Dateien mit 468 neuen und 58 gelöschten Zeilen

53
FightSystem_10/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,53 @@
<?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_10</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_9</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>FightSystem_API</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>WorldEdit</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.fightsystem.countdown;
import org.bukkit.Sound;
class Countdown_10 {
private Countdown_10(){}
static Sound getSound(SWSound sound){
return Countdown_9.getSound(sound);
}
}

Datei anzeigen

@ -0,0 +1,26 @@
package de.steamwar.fightsystem.fight;
import com.sk89q.worldedit.EditSession;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.scoreboard.Team;
import java.io.IOException;
class FightTeam_10 {
private FightTeam_10(){}
static void setTeamColor(Team team, ChatColor color) {
FightTeam_8.setTeamColor(team, color);
}
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
}
static EditSession pasteSchematic(Schematic schematic, int pasteX, int pasteY, int pasteZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
return FightTeam_8.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
}
}

Datei anzeigen

@ -0,0 +1,20 @@
package de.steamwar.fightsystem.listener;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.entity.Player;
class BasicListener_10 {
private BasicListener_10(){}
static void toActionbar(Player player, BaseComponent... components){
BasicListener_9.toActionbar(player, components);
}
static void toChat(Player player, BaseComponent... components){
BasicListener_9.toChat(player, components);
}
static void setAttackSpeed(Player player){
BasicListener_9.setAttackSpeed(player);
}
}

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.fightsystem.utils;
import org.bukkit.DyeColor;
class ColorConverter_10 {
private ColorConverter_10(){}
static DyeColor getSilver(){
return ColorConverter_8.getSilver();
}
}

Datei anzeigen

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

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.fightsystem.utils;
import org.bukkit.Material;
class WaterRemover_10 {
private WaterRemover_10(){}
static boolean isWater(Material type){
return WaterRemover_8.isWater(type);
}
}

Datei anzeigen

@ -29,7 +29,7 @@
<dependencies>
<dependency>
<groupId>steamwar</groupId>
<artifactId>FightSystem_8</artifactId>
<artifactId>FightSystem_10</artifactId>
<version>1.0</version>
</dependency>
<dependency>
@ -37,12 +37,6 @@
<artifactId>FightSystem_API</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>FAWE</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>WorldEdit</artifactId>

Datei anzeigen

@ -6,15 +6,6 @@ class Countdown_12 {
private Countdown_12(){}
static Sound getSound(SWSound sound){
switch(sound){
case ENTITY_WITHER_DEATH:
return Sound.ENTITY_WITHER_DEATH;
case BLOCK_NOTE_BASS:
return Sound.BLOCK_NOTE_BASS;
case BLOCK_NOTE_PLING:
return Sound.BLOCK_NOTE_PLING;
default:
return null;
}
return Countdown_9.getSound(sound);
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.fightsystem.fight;
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.regions.CuboidRegion;
@ -16,7 +17,7 @@ import java.io.IOException;
import java.util.Collections;
import java.util.Set;
public class FightTeam_12 {
class FightTeam_12 {
private FightTeam_12(){}
@SuppressWarnings("deprecation")
@ -32,7 +33,6 @@ public class FightTeam_12 {
static void setTeamColor(Team team, ChatColor color){
team.setColor(color);
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
}
@ -41,8 +41,12 @@ public class FightTeam_12 {
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
Vector corner = new Vector(cornerX, cornerY, cornerZ);
CuboidRegion region = new CuboidRegion(corner, corner.add(Config.SchemsizeX, Config.SchemsizeY, Config.SchemsizeZ));
e.replaceBlocks(region, CONCRETE_SET, new BaseBlock(CONCRETE.getId(), c.getWoolData()));
e.replaceBlocks(region, CONCRETE_POWDER_SET, new BaseBlock(CONCRETE_POWDER.getId(), c.getWoolData()));
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) {
//ignored
}
}
static EditSession pasteSchematic(Schematic schematic, int pasteX, int pasteY, int pasteZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {

Datei anzeigen

@ -1,24 +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);
BasicListener_9.toActionbar(player, components);
}
static void toChat(Player player, BaseComponent... components){
player.spigot().sendMessage(ChatMessageType.CHAT, components);
BasicListener_9.toChat(player, components);
}
static void setAttackSpeed(Player player){
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
attribute.setBaseValue(16);
BasicListener_9.setAttackSpeed(player);
}
}

Datei anzeigen

@ -6,6 +6,6 @@ class ColorConverter_12 {
private ColorConverter_12(){}
static DyeColor getSilver(){
return DyeColor.SILVER;
return ColorConverter_8.getSilver();
}
}

Datei anzeigen

@ -6,6 +6,6 @@ class WaterRemover_12 {
private WaterRemover_12(){}
static boolean isWater(Material type){
return type == Material.WATER || type == Material.STATIONARY_WATER;
return WaterRemover_8.isWater(type);
}
}

Datei anzeigen

@ -0,0 +1,20 @@
package de.steamwar.fightsystem.listener;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.entity.Player;
class BasicListener_14 {
private BasicListener_14(){}
static void toActionbar(Player player, BaseComponent... components){
BasicListener_9.toActionbar(player, components);
}
static void toChat(Player player, BaseComponent... components){
BasicListener_9.toChat(player, components);
}
static void setAttackSpeed(Player player){
BasicListener_9.setAttackSpeed(player);
}
}

Datei anzeigen

@ -24,7 +24,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.scoreboard.NameTagVisibility;
import org.bukkit.scoreboard.Team;
import java.io.IOException;
@ -53,7 +52,6 @@ class FightTeam_8 {
static void setTeamColor(Team team, ChatColor color){
team.setPrefix("§" + color.getChar());
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
}
@SuppressWarnings("deprecation")

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.fightsystem.utils;
import org.bukkit.DyeColor;
class ColorConverter_8 {
private ColorConverter_8(){}
static DyeColor getSilver(){
return DyeColor.SILVER;
}
}

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.fightsystem.utils;
import org.bukkit.Material;
public class WaterRemover_8 {
private WaterRemover_8(){}
static boolean isWater(Material type){
return type == Material.WATER || type == Material.STATIONARY_WATER;
}
}

53
FightSystem_9/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,53 @@
<?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_9</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>FightSystem_API</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>WorldEdit</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.9</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -0,0 +1,20 @@
package de.steamwar.fightsystem.countdown;
import org.bukkit.Sound;
class Countdown_9 {
private Countdown_9(){}
static Sound getSound(SWSound sound){
switch(sound){
case ENTITY_WITHER_DEATH:
return Sound.ENTITY_WITHER_DEATH;
case BLOCK_NOTE_BASS:
return Sound.BLOCK_NOTE_BASS;
case BLOCK_NOTE_PLING:
return Sound.BLOCK_NOTE_PLING;
default:
return null;
}
}
}

Datei anzeigen

@ -0,0 +1,26 @@
package de.steamwar.fightsystem.fight;
import com.sk89q.worldedit.EditSession;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.scoreboard.Team;
import java.io.IOException;
class FightTeam_9 {
private FightTeam_9(){}
static void setTeamColor(Team team, ChatColor color){
FightTeam_8.setTeamColor(team, color);
}
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
}
static EditSession pasteSchematic(Schematic schematic, int pasteX, int pasteY, int pasteZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
return FightTeam_8.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
}
}

Datei anzeigen

@ -0,0 +1,24 @@
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_9 {
private BasicListener_9(){}
static void toActionbar(Player player, BaseComponent... components){
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, components);
}
static void toChat(Player player, BaseComponent... components){
player.spigot().sendMessage(ChatMessageType.CHAT, components);
}
static void setAttackSpeed(Player player){
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
attribute.setBaseValue(16);
}
}

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.fightsystem.utils;
import org.bukkit.DyeColor;
class ColorConverter_9 {
private ColorConverter_9(){}
static DyeColor getSilver(){
return ColorConverter_8.getSilver();
}
}

Datei anzeigen

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

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.fightsystem.utils;
import org.bukkit.Material;
class WaterRemover_9 {
private WaterRemover_9(){}
static boolean isWater(Material type){
return WaterRemover_8.isWater(type);
}
}

Datei anzeigen

@ -46,7 +46,7 @@
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.14</version>
<version>1.15</version>
<scope>provided</scope>
</dependency>
<dependency>

Datei anzeigen

@ -41,10 +41,14 @@ public abstract class Countdown {
return null;
switch (Core.getVersion()){
case 8:
return Countdown_8.getSound(sound);
case 14:
return Countdown_14.getSound(sound);
case 10:
return Countdown_10.getSound(sound);
case 9:
return Countdown_9.getSound(sound);
case 8:
return Countdown_8.getSound(sound);
default:
return Countdown_12.getSound(sound);
}

Datei anzeigen

@ -18,6 +18,7 @@ import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.scoreboard.NameTagVisibility;
import org.bukkit.scoreboard.Team;
import java.io.IOException;
@ -69,18 +70,27 @@ public class FightTeam implements IFightTeam{
team = FightScoreboard.getScoreboard().registerNewTeam(name);
else
team = FightScoreboard.getScoreboard().getTeam(name);
assert team != null;
setTeamColor(team, color);
//noinspection deprecation
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
team.setAllowFriendlyFire(false);
}
private void setTeamColor(Team team, ChatColor color){
switch(Core.getVersion()){
case 8:
FightTeam_8.setTeamColor(team, color);
break;
case 14:
FightTeam_14.setTeamColor(team, color);
break;
case 10:
FightTeam_10.setTeamColor(team, color);
break;
case 9:
FightTeam_9.setTeamColor(team, color);
break;
case 8:
FightTeam_8.setTeamColor(team, color);
break;
default:
FightTeam_12.setTeamColor(team, color);
}
@ -232,12 +242,18 @@ public class FightTeam implements IFightTeam{
EditSession e;
try {
switch(Core.getVersion()){
case 8:
e = FightTeam_8.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
break;
case 14:
e = FightTeam_14.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
break;
case 10:
e = FightTeam_10.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
break;
case 9:
e = FightTeam_9.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
break;
case 8:
e = FightTeam_8.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
break;
default:
e = FightTeam_12.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
}
@ -256,12 +272,18 @@ public class FightTeam implements IFightTeam{
DyeColor c = ColorConverter.chat2dye(color);
switch(Core.getVersion()){
case 8:
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 14:
FightTeam_14.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 10:
FightTeam_10.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 9:
FightTeam_9.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 8:
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
default:
FightTeam_12.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
}

Datei anzeigen

@ -47,6 +47,15 @@ public abstract class BasicListener implements Listener {
public static void toActionbar(Player player, BaseComponent... components){
switch(Core.getVersion()){
case 14:
BasicListener_14.toActionbar(player, components);
break;
case 10:
BasicListener_10.toActionbar(player, components);
break;
case 9:
BasicListener_9.toActionbar(player, components);
break;
case 8:
BasicListener_8.toActionbar(player, components);
break;
@ -55,17 +64,17 @@ public abstract class BasicListener implements Listener {
}
}
void setAttackSpeed(Player player){
switch(Core.getVersion()){
case 8:
break;
default:
BasicListener_12.setAttackSpeed(player);
}
}
public static void toChat(Player player, BaseComponent... components){
switch(Core.getVersion()){
case 14:
BasicListener_14.toChat(player, components);
break;
case 10:
BasicListener_10.toChat(player, components);
break;
case 9:
BasicListener_9.toChat(player, components);
break;
case 8:
BasicListener_8.toChat(player, components);
break;
@ -73,4 +82,22 @@ public abstract class BasicListener implements Listener {
BasicListener_12.toChat(player, components);
}
}
void setAttackSpeed(Player player){
switch(Core.getVersion()){
case 14:
BasicListener_14.setAttackSpeed(player);
break;
case 10:
BasicListener_10.setAttackSpeed(player);
break;
case 9:
BasicListener_9.setAttackSpeed(player);
break;
case 8:
break;
default:
BasicListener_12.setAttackSpeed(player);
}
}
}

Datei anzeigen

@ -34,6 +34,15 @@ public class ColorConverter {
case 14:
chat2dye.put(ChatColor.GRAY, ColorConverter_14.getSilver());
break;
case 10:
chat2dye.put(ChatColor.GRAY, ColorConverter_10.getSilver());
break;
case 9:
chat2dye.put(ChatColor.GRAY, ColorConverter_9.getSilver());
break;
case 8:
chat2dye.put(ChatColor.GRAY, ColorConverter_8.getSilver());
break;
default:
chat2dye.put(ChatColor.GRAY, ColorConverter_12.getSilver());
}

Datei anzeigen

@ -68,11 +68,13 @@ public class TechHider {
blockHider();
multiBlockHider();
switch(Core.getVersion()){
case 8:
break;
case 14:
TechHider_14.start();
break;
case 10:
case 9:
case 8:
break;
default:
TechHider_12.start();
}
@ -189,12 +191,18 @@ public class TechHider {
private static void reloadChunk(Player p, Pair<Integer, Integer> chunk){
switch(Core.getVersion()){
case 8:
TechHider_8.reloadChunk(p, chunk);
break;
case 14:
TechHider_14.reloadChunk(p, chunk);
break;
case 10:
TechHider_10.reloadChunk(p, chunk);
break;
case 9:
TechHider_9.reloadChunk(p, chunk);
break;
case 8:
TechHider_8.reloadChunk(p, chunk);
break;
default:
TechHider_12.reloadChunk(p, chunk);
}

Datei anzeigen

@ -96,6 +96,12 @@ public class WaterRemover {
switch(Core.getVersion()){
case 14:
return WaterRemover_14.isWater(type);
case 10:
return WaterRemover_10.isWater(type);
case 9:
return WaterRemover_9.isWater(type);
case 8:
return WaterRemover_8.isWater(type);
default:
return WaterRemover_12.isWater(type);
}

Datei anzeigen

@ -38,6 +38,8 @@
<modules>
<module>FightSystem_API</module>
<module>FightSystem_8</module>
<module>FightSystem_9</module>
<module>FightSystem_10</module>
<module>FightSystem_12</module>
<module>FightSystem_14</module>
<module>FightSystem_Main</module>