SteamWar/FightSystem
Archiviert
13
1

Simplify multiversioning with removing fall-through code #188

Manuell gemergt
Lixfel hat 2 Commits von simplifyMultiversioning nach master 2020-09-08 15:59:31 +02:00 zusammengeführt
47 geänderte Dateien mit 176 neuen und 890 gelöschten Zeilen

Datei anzeigen

@ -51,7 +51,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.10</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.10.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.10.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -1,45 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.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_9.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

@ -1,39 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import 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

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.DyeColor;
class ColorConverter_10 {
private ColorConverter_10(){}
static DyeColor getSilver(){
return ColorConverter_8.getSilver();
}
}

Datei anzeigen

@ -1,33 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
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, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
}

Datei anzeigen

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.block.Block;
class WaterRemover_10 {
private WaterRemover_10(){}
static boolean isWater(Block block){
return WaterRemover_8.isWater(block);
}
}

Datei anzeigen

@ -51,7 +51,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.12</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.12.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.12.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.countdown;
import org.bukkit.Sound;
class Countdown_12 {
private Countdown_12(){}
static Sound getSound(SWSound sound){
return Countdown_9.getSound(sound);
}
}

Datei anzeigen

@ -25,14 +25,11 @@ import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.Team;
import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
@ -69,8 +66,4 @@ class FightTeam_12 {
} }
e.flushQueue(); e.flushQueue();
} }
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

@ -1,39 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.entity.Player;
class BasicListener_12 {
private BasicListener_12(){}
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

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.DyeColor;
class ColorConverter_12 {
private ColorConverter_12(){}
static DyeColor getSilver(){
return ColorConverter_8.getSilver();
}
}

Datei anzeigen

@ -31,10 +31,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.IFightSystem; import de.steamwar.fightsystem.IFightSystem;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator; import io.netty.buffer.UnpooledByteBufAllocator;
import net.minecraft.server.v1_12_R1.PacketPlayOutMapChunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
@ -47,10 +44,6 @@ class TechHider_12 {
private static final short obfuscateShift4 = (short)(Config.ObfuscateWith << 4); private static final short obfuscateShift4 = (short)(Config.ObfuscateWith << 4);
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
static void start(){ static void start(){
chunkHider(); chunkHider();
} }

Datei anzeigen

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.block.Block;
class WaterRemover_12 {
private WaterRemover_12(){}
static boolean isWater(Block block){
return WaterRemover_8.isWater(block);
}
}

Datei anzeigen

@ -34,7 +34,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.14</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.14.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.14.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -1,39 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import 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

@ -17,14 +17,16 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.fightsystem.countdown; package de.steamwar.fightsystem.listener;
import org.bukkit.Sound; import org.bukkit.inventory.ItemStack;
class Countdown_10 { import java.util.Objects;
private Countdown_10(){}
static Sound getSound(SWSound sound){ class PersonalKitCreator_14 {
return Countdown_9.getSound(sound); private PersonalKitCreator_14(){}
static boolean hasAttributeModifier(ItemStack stack){
return stack.hasItemMeta() && Objects.requireNonNull(stack.getItemMeta()).hasAttributeModifiers();
} }
} }

Datei anzeigen

@ -31,9 +31,6 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.IFightSystem; import de.steamwar.fightsystem.IFightSystem;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator; import io.netty.buffer.UnpooledByteBufAllocator;
import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk;
import org.bukkit.craftbukkit.v1_14_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
@ -43,10 +40,6 @@ import static de.steamwar.fightsystem.utils.ITechHider.bypass;
public class TechHider_14 { public class TechHider_14 {
private TechHider_14(){} private TechHider_14(){}
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
static void start(){ static void start(){
chunkHider(); chunkHider();
} }

Datei anzeigen

@ -34,7 +34,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.15</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.15.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.15.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.countdown;
import org.bukkit.Sound;
class Countdown_15 {
private Countdown_15(){}
static Sound getSound(SWSound sound){
return Countdown_14.getSound(sound);
}
}

Datei anzeigen

@ -1,45 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.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_15 {
private FightTeam_15(){}
static void setTeamColor(Team team, ChatColor color){
FightTeam_14.setTeamColor(team, color);
}
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){
FightTeam_14.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
}
static EditSession pasteSchematic(Schematic schematic, int pX, int pY, int pZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
return FightTeam_14.pasteSchematic(schematic, pX, pY, pZ, rotate);
}
}

Datei anzeigen

@ -1,39 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.entity.Player;
class BasicListener_15 {
private BasicListener_15(){}
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

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.DyeColor;
class ColorConverter_15 {
private ColorConverter_15(){}
static DyeColor getSilver(){
return ColorConverter_14.getSilver();
}
}

Datei anzeigen

@ -36,12 +36,9 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator; import io.netty.buffer.UnpooledByteBufAllocator;
import net.minecraft.server.v1_15_R1.Block; import net.minecraft.server.v1_15_R1.Block;
import net.minecraft.server.v1_15_R1.ChunkSection; import net.minecraft.server.v1_15_R1.ChunkSection;
import net.minecraft.server.v1_15_R1.PacketPlayOutMapChunk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_15_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -56,10 +53,6 @@ public class TechHider_15 {
private static final World WORLD = Bukkit.getWorlds().get(0); private static final World WORLD = Bukkit.getWorlds().get(0);
private static final WrappedBlockData WRAPPED_BLOCK_DATA = WrappedBlockData.createData(ITechHider.obfuscateMaterial); private static final WrappedBlockData WRAPPED_BLOCK_DATA = WrappedBlockData.createData(ITechHider.obfuscateMaterial);
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
static void start(){ static void start(){
chunkHider(); chunkHider();
} }

Datei anzeigen

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.block.Block;
class WaterRemover_15 {
private WaterRemover_15(){}
static boolean isWater(Block block){
return WaterRemover_14.isWater(block);
}
}

Datei anzeigen

@ -34,7 +34,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.8</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.8.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.8.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -1,33 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
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_8 {
private TechHider_8(){}
static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), true, 65535));
}
}

Datei anzeigen

@ -51,7 +51,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.9</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.9.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.9.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -19,15 +19,9 @@
package de.steamwar.fightsystem.fight; 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.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.Team;
import java.io.IOException;
class FightTeam_9 { class FightTeam_9 {
private FightTeam_9(){} private FightTeam_9(){}
@ -35,14 +29,4 @@ class FightTeam_9 {
FightTeam_8.setTeamColor(team, color); FightTeam_8.setTeamColor(team, color);
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM); team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
} }
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

@ -19,20 +19,14 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.states.FightState;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupArrowEvent;
import java.util.EnumSet; class PickupArrowListener_9 implements Listener {
public class SleepListener extends BasicListener{
public SleepListener() {
super(EnumSet.allOf(FightState.class));
}
@EventHandler @EventHandler
public void onSleep(PlayerBedEnterEvent e) { public void onArrowPickup(PlayerPickupArrowEvent e){
e.setCancelled(true); e.setCancelled(true);
} }
} }

Datei anzeigen

@ -1,30 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.DyeColor;
class ColorConverter_9 {
private ColorConverter_9(){}
static DyeColor getSilver(){
return ColorConverter_8.getSilver();
}
}

Datei anzeigen

@ -1,33 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
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, ITechHider.ChunkPos chunk){
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.x(), chunk.z())).getHandle(), 65535));
}
}

Datei anzeigen

@ -1,31 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import org.bukkit.Material;
import org.bukkit.block.Block;
class WaterRemover_9 {
private WaterRemover_9(){}
static boolean isWater(Block block){
return WaterRemover_8.isWater(block);
}
}

Datei anzeigen

@ -34,7 +34,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.12</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.12.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.12.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -28,13 +28,11 @@ public class IFightSystem {
private IFightSystem(){} private IFightSystem(){}
private static Plugin plugin; private static Plugin plugin;
private static String prefix;
private static EventFight eventFight; private static EventFight eventFight;
private static Player eventLeiter; private static Player eventLeiter;
public static void init(Plugin plugin, String prefix){ public static void init(Plugin plugin){
IFightSystem.plugin = plugin; IFightSystem.plugin = plugin;
IFightSystem.prefix = prefix;
} }
static void setEventFight(EventFight ef){ static void setEventFight(EventFight ef){
eventFight = ef; eventFight = ef;
@ -46,15 +44,13 @@ public class IFightSystem {
public static Plugin getPlugin(){ public static Plugin getPlugin(){
return plugin; return plugin;
} }
public static String getPrefix(){
return prefix;
}
public static EventFight getEventFight(){ public static EventFight getEventFight(){
return eventFight; return eventFight;
} }
public static Player getEventLeiter(){ public static Player getEventLeiter(){
return eventLeiter; return eventLeiter;
} }
public static void shutdown(String reason){ public static void shutdown(String reason){
if(reason != null) if(reason != null)
Bukkit.broadcastMessage(reason); Bukkit.broadcastMessage(reason);

Datei anzeigen

@ -155,22 +155,4 @@ public class ITechHider {
} while (value != 0); } while (value != 0);
return Bytes.toArray(buffer); return Bytes.toArray(buffer);
} }
public static class ChunkPos{
final int x;
final int z;
ChunkPos(int x, int z){
this.x = x;
this.z = z;
}
final int x(){
return x;
}
final int z(){
return z;
}
}
} }

Datei anzeigen

@ -50,7 +50,7 @@
<dependency> <dependency>
<groupId>steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>Spigot</artifactId> <artifactId>Spigot</artifactId>
<version>1.0</version> <version>1.15</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.15.jar</systemPath> <systemPath>${main.basedir}/lib/Spigot-1.15.jar</systemPath>
</dependency> </dependency>

Datei anzeigen

@ -57,7 +57,7 @@ public class FightSystem extends JavaPlugin {
@Override @Override
public void onLoad() { public void onLoad() {
setPlugin(this); setPlugin(this);
IFightSystem.init(this, PREFIX); IFightSystem.init(this);
} }
@Override @Override
@ -93,10 +93,10 @@ public class FightSystem extends JavaPlugin {
new TestListener(); new TestListener();
new NormalJoinListener(); new NormalJoinListener();
new RankedJoinListener(); new RankedJoinListener();
new SleepListener(); new GameplayListener();
new PersonalKitCreator(); new PersonalKitCreator();
if(Core.getVersion() > 8) if(Core.getVersion() > 8)
new ExtendedInventoryListener(); new VersionDependentListener();
new EnterHandler(); new EnterHandler();

Datei anzeigen

@ -53,18 +53,16 @@ public abstract class Countdown {
return null; return null;
switch (Core.getVersion()){ switch (Core.getVersion()){
case 15:
return Countdown_15.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: case 8:
return Countdown_8.getSound(sound); return Countdown_8.getSound(sound);
case 9:
case 10:
case 12:
return Countdown_9.getSound(sound);
case 14:
case 15:
default: default:
return Countdown_12.getSound(sound); return Countdown_14.getSound(sound);
} }
} }

Datei anzeigen

@ -23,7 +23,6 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.listener.BasicListener; import de.steamwar.fightsystem.listener.BasicListener;
import de.steamwar.fightsystem.utils.ITechHider;
import de.steamwar.fightsystem.utils.TechHider; import de.steamwar.fightsystem.utils.TechHider;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -33,7 +32,7 @@ import java.util.List;
public class EnternCountdown extends Countdown { public class EnternCountdown extends Countdown {
private final FightPlayer fightPlayer; private final FightPlayer fightPlayer;
private List<ITechHider.ChunkPos> chunkPos; private List<TechHider.ChunkPos> chunkPos;
public EnternCountdown(FightPlayer fp) { public EnternCountdown(FightPlayer fp) {
super(fp.getKit().getEnterStage(), SWSound.BLOCK_NOTE_PLING, false); super(fp.getKit().getEnterStage(), SWSound.BLOCK_NOTE_PLING, false);

Datei anzeigen

@ -166,7 +166,7 @@ public class FightTeam implements IFightTeam{
} }
public FightPlayer addMember(Player player) { public FightPlayer addMember(Player player) {
final List<ITechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player); final List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player);
FightPlayer fightPlayer = new FightPlayer(player, this); FightPlayer fightPlayer = new FightPlayer(player, this);
players.add(fightPlayer); players.add(fightPlayer);
invited.remove(player); invited.remove(player);
@ -184,7 +184,7 @@ public class FightTeam implements IFightTeam{
public void removePlayer(Player player) { public void removePlayer(Player player) {
FightPlayer fightPlayer = getFightPlayer(player); FightPlayer fightPlayer = getFightPlayer(player);
final List<ITechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player); final List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player);
players.remove(fightPlayer); players.remove(fightPlayer);
team.removeEntry(player.getName()); team.removeEntry(player.getName());
fightPlayer.getPlayer().getInventory().clear(); fightPlayer.getPlayer().getInventory().clear();
@ -269,29 +269,21 @@ public class FightTeam implements IFightTeam{
try { try {
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15:
e = FightTeam_15.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_15.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 14:
e = FightTeam_14.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_14.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 10:
e = FightTeam_10.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_10.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 9:
e = FightTeam_9.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_9.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 8: case 8:
case 9:
case 10:
e = FightTeam_8.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate); e = FightTeam_8.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ); FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break; break;
default: case 12:
e = FightTeam_12.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate); e = FightTeam_8.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_12.replaceTeamColor(e, c, cornerX, cornerY, cornerZ); FightTeam_12.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
break;
case 14:
case 15:
default:
e = FightTeam_14.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_14.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
} }
} catch (Schematic.WrongVersionException ex) { } catch (Schematic.WrongVersionException ex) {
broadcast(FightSystem.PREFIX + "§cDie gewählte Schematic kann nicht in dieser Version geladen werden"); broadcast(FightSystem.PREFIX + "§cDie gewählte Schematic kann nicht in dieser Version geladen werden");
@ -441,23 +433,20 @@ public class FightTeam implements IFightTeam{
private void setTeamColor(Team team, ChatColor color){ private void setTeamColor(Team team, ChatColor color){
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15:
FightTeam_15.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: case 8:
FightTeam_8.setTeamColor(team, color); FightTeam_8.setTeamColor(team, color);
break; break;
default: case 9:
case 10:
FightTeam_9.setTeamColor(team, color);
break;
case 12:
FightTeam_12.setTeamColor(team, color); FightTeam_12.setTeamColor(team, color);
break;
case 14:
case 15:
default:
FightTeam_14.setTeamColor(team, color);
} }
} }

Datei anzeigen

@ -47,66 +47,45 @@ public abstract class BasicListener implements Listener, StateDependent {
public static void toActionbar(Player player, BaseComponent... components){ public static void toActionbar(Player player, BaseComponent... components){
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15:
BasicListener_15.toActionbar(player, components);
break;
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: case 8:
BasicListener_8.toActionbar(player, components); BasicListener_8.toActionbar(player, components);
break; break;
case 9:
case 10:
case 12:
case 14:
case 15:
default: default:
BasicListener_12.toActionbar(player, components); BasicListener_9.toActionbar(player, components);
} }
} }
public static void toChat(Player player, BaseComponent... components){ public static void toChat(Player player, BaseComponent... components){
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15:
BasicListener_15.toChat(player, components);
break;
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: case 8:
BasicListener_8.toChat(player, components); BasicListener_8.toChat(player, components);
break; break;
case 9:
case 10:
case 12:
case 14:
case 15:
default: default:
BasicListener_12.toChat(player, components); BasicListener_9.toChat(player, components);
} }
} }
void setAttackSpeed(Player player){ void setAttackSpeed(Player player){
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15:
BasicListener_15.setAttackSpeed(player);
break;
case 14:
BasicListener_14.setAttackSpeed(player);
break;
case 10:
BasicListener_10.setAttackSpeed(player);
break;
case 9:
BasicListener_9.setAttackSpeed(player);
break;
case 8: case 8:
break; break;
case 9:
case 10:
case 12:
case 14:
case 15:
default: default:
BasicListener_12.setAttackSpeed(player); BasicListener_9.setAttackSpeed(player);
} }
} }

Datei anzeigen

@ -20,23 +20,21 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent; import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.event.player.PlayerPickupArrowEvent; import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.inventory.ItemStack;
import java.util.EnumSet; import java.util.EnumSet;
public class ExtendedInventoryListener extends BasicListener { public class GameplayListener extends BasicListener{
public ExtendedInventoryListener() { public GameplayListener() {
super(EnumSet.allOf(FightState.class)); super(EnumSet.allOf(FightState.class));
} }
@EventHandler @EventHandler
public void onArrowPickup(PlayerPickupArrowEvent e){ public void onSleep(PlayerBedEnterEvent e) {
e.setCancelled(true); e.setCancelled(true);
} }
@ -47,6 +45,6 @@ public class ExtendedInventoryListener extends BasicListener {
@EventHandler @EventHandler
public void onFurnace(FurnaceSmeltEvent e){ public void onFurnace(FurnaceSmeltEvent e){
e.setResult(new ItemStack(Material.AIR)); e.setCancelled(true);
} }
} }

Datei anzeigen

@ -46,7 +46,6 @@ import org.bukkit.inventory.PlayerInventory;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.logging.Level; import java.util.logging.Level;
public class PersonalKitCreator extends BasicListener { public class PersonalKitCreator extends BasicListener {
@ -156,7 +155,7 @@ public class PersonalKitCreator extends BasicListener {
return true; return true;
//Check for attribute modifiers //Check for attribute modifiers
if(Core.getVersion() >= 14 && stack.hasItemMeta() && Objects.requireNonNull(stack.getItemMeta()).hasAttributeModifiers()){ if(Core.getVersion() >= 14 && PersonalKitCreator_14.hasAttributeModifier(stack)){
Bukkit.getLogger().log(Level.SEVERE, "Spieler " + player.getName() + " hat versucht ein Item mit einem Attribute-Modifier zu bekommen."); Bukkit.getLogger().log(Level.SEVERE, "Spieler " + player.getName() + " hat versucht ein Item mit einem Attribute-Modifier zu bekommen.");
return true; return true;
} }

Datei anzeigen

@ -0,0 +1,52 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.listener;
import de.steamwar.core.Core;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import java.util.*;
public class VersionDependentListener extends BasicListener {
private final List<Listener> listeners = new ArrayList<>();
public VersionDependentListener() {
super(EnumSet.allOf(FightState.class));
if(Core.getVersion() > 8)
listeners.add(new PickupArrowListener_9());
}
@Override
public void enable() {
for(Listener listener : listeners)
Bukkit.getPluginManager().registerEvents(listener, FightSystem.getPlugin());
}
@Override
public void disable() {
for(Listener listener : listeners)
HandlerList.unregisterAll(listener);
}
}

Datei anzeigen

@ -50,23 +50,17 @@ public class ColorConverter {
//Rosa 9pink, Braun 3brown //Rosa 9pink, Braun 3brown
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15:
chat2dye.put(ChatColor.GRAY, ColorConverter_15.getSilver());
break;
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: case 8:
case 9:
case 10:
case 12:
chat2dye.put(ChatColor.GRAY, ColorConverter_8.getSilver()); chat2dye.put(ChatColor.GRAY, ColorConverter_8.getSilver());
break; break;
case 14:
case 15:
default: default:
chat2dye.put(ChatColor.GRAY, ColorConverter_12.getSilver()); chat2dye.put(ChatColor.GRAY, ColorConverter_14.getSilver());
break;
} }
} }

Datei anzeigen

@ -30,6 +30,7 @@ import com.comphenix.protocol.wrappers.ChunkCoordIntPair;
import com.comphenix.protocol.wrappers.MultiBlockChangeInfo; import com.comphenix.protocol.wrappers.MultiBlockChangeInfo;
import com.comphenix.protocol.wrappers.WrappedBlockData; import com.comphenix.protocol.wrappers.WrappedBlockData;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.events.ChunkListener;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.IFightSystem; import de.steamwar.fightsystem.IFightSystem;
@ -210,51 +211,47 @@ public class TechHider {
}); });
} }
public static List<ITechHider.ChunkPos> prepareChunkReload(Player p){ public static List<ChunkPos> prepareChunkReload(Player p){
if(disabled()) if(disabled())
return Collections.emptyList(); return Collections.emptyList();
List<ITechHider.ChunkPos> chunksToReload = new ArrayList<>(); List<ChunkPos> chunksToReload = new ArrayList<>();
for(int x = ITechHider.arenaMinX; x <= ITechHider.arenaMaxX; x++) for(int x = ITechHider.arenaMinX; x <= ITechHider.arenaMaxX; x++)
for(int z = ITechHider.arenaMinZ; z <= ITechHider.arenaMaxZ; z++) for(int z = ITechHider.arenaMinZ; z <= ITechHider.arenaMaxZ; z++)
if(!bypass(p, x, z)) if(!bypass(p, x, z))
chunksToReload.add(new ITechHider.ChunkPos(x, z)); chunksToReload.add(new ChunkPos(x, z));
return chunksToReload; return chunksToReload;
} }
public static void reloadChunks(Player p, List<ITechHider.ChunkPos> chunksToReload){ public static void reloadChunks(Player p, List<ChunkPos> chunksToReload){
if(disabled()) if(disabled())
return; return;
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
for(ITechHider.ChunkPos chunk : chunksToReload){ for(ChunkPos chunk : chunksToReload){
if(bypass(p, chunk.x(), chunk.z())) if(bypass(p, chunk.x(), chunk.z()))
reloadChunk(p, chunk); ChunkListener.sendChunk(p, chunk.x(), chunk.z());
} }
}, 40); }, 40);
} }
private static void reloadChunk(Player p, ITechHider.ChunkPos chunk){
switch(Core.getVersion()){
case 15:
TechHider_15.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);
}
}
private static boolean disabled(){ private static boolean disabled(){
return Config.OnlyPublicSchematics || Config.test() || !Config.TechhiderActive; return Config.OnlyPublicSchematics || Config.test() || !Config.TechhiderActive;
} }
public static class ChunkPos{
final int x;
final int z;
ChunkPos(int x, int z){
this.x = x;
this.z = z;
}
final int x(){
return x;
}
final int z(){
return z;
}
}
} }

Datei anzeigen

@ -73,18 +73,15 @@ public class WaterRemover {
public static boolean isWater(Block block){ public static boolean isWater(Block block){
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15:
return WaterRemover_15.isWater(block);
case 14:
return WaterRemover_14.isWater(block);
case 10:
return WaterRemover_10.isWater(block);
case 9:
return WaterRemover_9.isWater(block);
case 8: case 8:
case 9:
case 10:
case 12:
return WaterRemover_8.isWater(block); return WaterRemover_8.isWater(block);
case 14:
case 15:
default: default:
return WaterRemover_12.isWater(block); return WaterRemover_14.isWater(block);
} }
} }
} }