Refitting vor new Core
Dieser Commit ist enthalten in:
Ursprung
3247ea737c
Commit
a108a810ea
2
pom.xml
2
pom.xml
@ -54,7 +54,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>steamwar</groupId>
|
<groupId>steamwar</groupId>
|
||||||
<artifactId>SpigotCore</artifactId>
|
<artifactId>SpigotCore</artifactId>
|
||||||
<version>1.0</version>
|
<version>2.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -12,8 +12,8 @@ import de.steamwar.fightsystem.utils.Config;
|
|||||||
import de.steamwar.fightsystem.utils.FightScoreboard;
|
import de.steamwar.fightsystem.utils.FightScoreboard;
|
||||||
import de.steamwar.fightsystem.utils.TechHider;
|
import de.steamwar.fightsystem.utils.TechHider;
|
||||||
import de.steamwar.fightsystem.utils.WaterRemover;
|
import de.steamwar.fightsystem.utils.WaterRemover;
|
||||||
import de.steamwar.fightsystem.utils.sql.EventFight;
|
|
||||||
import de.steamwar.fightsystem.winconditions.*;
|
import de.steamwar.fightsystem.winconditions.*;
|
||||||
|
import de.steamwar.sql.EventFight;
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -153,8 +153,14 @@ public class FightSystem extends JavaPlugin {
|
|||||||
Bukkit.broadcastMessage(PREFIX + "§aKein Team hat gewonnen!");
|
Bukkit.broadcastMessage(PREFIX + "§aKein Team hat gewonnen!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.event())
|
if(Config.event()){
|
||||||
eventFight.setErgebnis(winFightTeam);
|
if(winFightTeam == null)
|
||||||
|
eventFight.setErgebnis(0);
|
||||||
|
else if(winFightTeam.isBlue())
|
||||||
|
eventFight.setErgebnis(1);
|
||||||
|
else
|
||||||
|
eventFight.setErgebnis(2);
|
||||||
|
}
|
||||||
|
|
||||||
if(!Config.test())
|
if(!Config.test())
|
||||||
new SpectateOverCountdown();
|
new SpectateOverCountdown();
|
||||||
|
@ -6,10 +6,10 @@ import de.steamwar.fightsystem.fight.FightState;
|
|||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.kit.KitManager;
|
import de.steamwar.fightsystem.kit.KitManager;
|
||||||
import de.steamwar.fightsystem.utils.Config;
|
import de.steamwar.fightsystem.utils.Config;
|
||||||
import de.warking.hunjy.MySQL.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import de.warking.hunjy.MySQL.SchematicType;
|
import de.steamwar.sql.SchematicType;
|
||||||
import de.warking.hunjy.MySQL.UserGroup;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import de.warking.hunjy.MySQL.WarkingUser;
|
import de.steamwar.sql.UserGroup;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
@ -61,7 +61,7 @@ public class AkCommand implements CommandExecutor {
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if(args[0].equalsIgnoreCase("addkit")){
|
if(args[0].equalsIgnoreCase("addkit")){
|
||||||
if(WarkingUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Developer){
|
if(SteamwarUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Developer){
|
||||||
Commands.sendHelp(player);
|
Commands.sendHelp(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ public class AkCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Schematic schem;
|
Schematic schem;
|
||||||
if(args[2].equalsIgnoreCase("public")) {
|
if(args[2].equalsIgnoreCase("public")) {
|
||||||
schem = Schematic.getSchemFromDB(args[1], WarkingUser.get(0).getUUID());
|
schem = Schematic.getSchemFromDB(args[1], SteamwarUser.get(0).getUUID());
|
||||||
} else if(args[2].equalsIgnoreCase("private")) {
|
} else if(args[2].equalsIgnoreCase("private")) {
|
||||||
schem = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
schem = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
} else
|
} else
|
||||||
|
@ -10,8 +10,8 @@ import de.steamwar.fightsystem.utils.Config;
|
|||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
import de.warking.hunjy.MySQL.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import de.warking.hunjy.MySQL.WarkingUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -50,7 +50,7 @@ public class GUI {
|
|||||||
List<Pair<SWItem, UUID>> players = SWListInv.createPlayerList(p);
|
List<Pair<SWItem, UUID>> players = SWListInv.createPlayerList(p);
|
||||||
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getValue())) != null);
|
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getValue())) != null);
|
||||||
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler einladen", (ClickType click, UUID player) -> {
|
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler einladen", (ClickType click, UUID player) -> {
|
||||||
Commands.invite(p, WarkingUser.get(player).getUserName());
|
Commands.invite(p, SteamwarUser.get(player).getUserName());
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
}, players);
|
}, players);
|
||||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
@ -64,7 +64,7 @@ public class GUI {
|
|||||||
return;
|
return;
|
||||||
players.removeIf(swItemUUIDPair -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(swItemUUIDPair.getValue()))));
|
players.removeIf(swItemUUIDPair -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(swItemUUIDPair.getValue()))));
|
||||||
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler rauswerfen", (ClickType click, UUID player) -> {
|
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler rauswerfen", (ClickType click, UUID player) -> {
|
||||||
Commands.kick(p, WarkingUser.get(player).getUserName());
|
Commands.kick(p, SteamwarUser.get(player).getUserName());
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
}, players);
|
}, players);
|
||||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
@ -109,9 +109,9 @@ public class GUI {
|
|||||||
if(publicSchems)
|
if(publicSchems)
|
||||||
schems = SWListInv.getSchemList(0, Config.SchematicType);
|
schems = SWListInv.getSchemList(0, Config.SchematicType);
|
||||||
else if(Config.test())
|
else if(Config.test())
|
||||||
schems = SWListInv.getSchemList(WarkingUser.get(p.getUniqueId()).getId(), null);
|
schems = SWListInv.getSchemList(SteamwarUser.get(p.getUniqueId()).getId(), null);
|
||||||
else
|
else
|
||||||
schems = SWListInv.getSchemList(WarkingUser.get(p.getUniqueId()).getId(), Config.SchematicType);
|
schems = SWListInv.getSchemList(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType);
|
||||||
SWListInv<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", (ClickType click, Schematic s) -> {
|
SWListInv<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", (ClickType click, Schematic s) -> {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||||
if(fightTeam == null)
|
if(fightTeam == null)
|
||||||
|
@ -17,6 +17,6 @@ public class PreRunningCountdown extends Countdown {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void countdownFinished() {
|
public void countdownFinished() {
|
||||||
FightSystem.getPlugin().setRunningState();
|
FightSystem.setRunningState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ import com.sk89q.worldedit.world.World;
|
|||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.kit.KitManager;
|
import de.steamwar.fightsystem.kit.KitManager;
|
||||||
import de.steamwar.fightsystem.utils.*;
|
import de.steamwar.fightsystem.utils.*;
|
||||||
import de.warking.hunjy.MySQL.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import de.warking.hunjy.MySQL.WarkingUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -218,7 +218,7 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void pasteSchematic(){
|
private void pasteSchematic(){
|
||||||
File file = new File(Config.SchematicDirectory + WarkingUser.get(schematic.getSchemOwner()).getUUID().toString(), schematic.getSchemName() + ".schematic");
|
File file = new File(Config.SchematicDirectory + SteamwarUser.get(schematic.getSchemOwner()).getUUID().toString(), schematic.getSchemName() + ".schematic");
|
||||||
com.boydti.fawe.object.schematic.Schematic schem;
|
com.boydti.fawe.object.schematic.Schematic schem;
|
||||||
try {
|
try {
|
||||||
schem = FaweAPI.load(file);
|
schem = FaweAPI.load(file);
|
||||||
|
@ -6,7 +6,7 @@ import de.steamwar.fightsystem.fight.FightPlayer;
|
|||||||
import de.steamwar.fightsystem.fight.FightState;
|
import de.steamwar.fightsystem.fight.FightState;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.utils.Config;
|
import de.steamwar.fightsystem.utils.Config;
|
||||||
import de.warking.hunjy.MySQL.WarkingUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
@ -17,7 +17,7 @@ public class EventJoinListener extends BasicListener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
WarkingUser user = WarkingUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
|
||||||
FightTeam team = null;
|
FightTeam team = null;
|
||||||
if(user.getTeam() == Config.EventTeamBlueID)
|
if(user.getTeam() == Config.EventTeamBlueID)
|
||||||
|
@ -22,6 +22,7 @@ public class PlayerDeathListener extends BasicListener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §cist gestorben!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §cist gestorben!");
|
||||||
|
event.setDeathMessage(null);
|
||||||
fightTeam.getFightPlayer(player).setOut();
|
fightTeam.getFightPlayer(player).setOut();
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
player.teleport(fightTeam.getSpawn());
|
player.teleport(fightTeam.getSpawn());
|
||||||
|
@ -2,10 +2,9 @@ package de.steamwar.fightsystem.utils;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.utils.sql.Event;
|
import de.steamwar.sql.Event;
|
||||||
import de.steamwar.fightsystem.utils.sql.EventFight;
|
import de.steamwar.sql.EventFight;
|
||||||
import de.steamwar.fightsystem.utils.sql.Team;
|
import de.steamwar.sql.Team;
|
||||||
import de.warking.hunjy.MySQL.SchematicType;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -45,7 +44,7 @@ public class Config {
|
|||||||
|
|
||||||
public static boolean OnlyPublicSchematics;
|
public static boolean OnlyPublicSchematics;
|
||||||
public static String SchematicDirectory;
|
public static String SchematicDirectory;
|
||||||
public static SchematicType SchematicType;
|
public static de.steamwar.sql.SchematicType SchematicType;
|
||||||
public static boolean TeamRedRotate;
|
public static boolean TeamRedRotate;
|
||||||
public static boolean TeamBlueRotate;
|
public static boolean TeamBlueRotate;
|
||||||
|
|
||||||
@ -142,7 +141,7 @@ public class Config {
|
|||||||
|
|
||||||
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics");
|
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics");
|
||||||
SchematicDirectory = config.getString("Schematic.Directory");
|
SchematicDirectory = config.getString("Schematic.Directory");
|
||||||
SchematicType = de.warking.hunjy.MySQL.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
||||||
boolean Rotate = config.getBoolean("Schematic.Rotate");
|
boolean Rotate = config.getBoolean("Schematic.Rotate");
|
||||||
|
|
||||||
TeamRedName = config.getString("Output.TeamRedName");
|
TeamRedName = config.getString("Output.TeamRedName");
|
||||||
|
@ -30,7 +30,6 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class TechHider {
|
public class TechHider {
|
||||||
|
|
||||||
private TechHider(){}
|
private TechHider(){}
|
||||||
|
|
||||||
private static Map<PacketContainer, PacketContainer> packetCache = new HashMap<>();
|
private static Map<PacketContainer, PacketContainer> packetCache = new HashMap<>();
|
||||||
@ -48,7 +47,7 @@ public class TechHider {
|
|||||||
private static int redMinZ;
|
private static int redMinZ;
|
||||||
private static int redMaxZ;
|
private static int redMaxZ;
|
||||||
private static short obfuscateShift4;
|
private static short obfuscateShift4;
|
||||||
private static final short BITMASK = 0x1FF;
|
//private static final short BITMASK = 0x1FF;
|
||||||
private static Material obfuscateMaterial;
|
private static Material obfuscateMaterial;
|
||||||
private static boolean running = false;
|
private static boolean running = false;
|
||||||
private static int threadMultiplier = 1;
|
private static int threadMultiplier = 1;
|
||||||
@ -72,6 +71,7 @@ public class TechHider {
|
|||||||
redMaxZ = posToChunk(Config.TeamRedCornerZ + Config.SchemsizeZ) + 1;
|
redMaxZ = posToChunk(Config.TeamRedCornerZ + Config.SchemsizeZ) + 1;
|
||||||
|
|
||||||
obfuscateShift4 = (short)(Config.ObfuscateWith << 4);
|
obfuscateShift4 = (short)(Config.ObfuscateWith << 4);
|
||||||
|
//noinspection deprecation
|
||||||
obfuscateMaterial = Material.getMaterial(Config.ObfuscateWith);
|
obfuscateMaterial = Material.getMaterial(Config.ObfuscateWith);
|
||||||
|
|
||||||
if(Config.event())
|
if(Config.event())
|
||||||
@ -109,7 +109,40 @@ public class TechHider {
|
|||||||
|
|
||||||
Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), packetCache::clear, 1, 1);
|
Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), packetCache::clear, 1, 1);
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
chunkHider();
|
||||||
|
multiBlockHider();
|
||||||
|
blockHider();
|
||||||
|
blockActionHider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean bypass(Player p, int chunkX, int chunkZ){
|
||||||
|
if(p == FightSystem.getEventLeiter())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
FightTeam ft = Fight.getPlayerTeam(p);
|
||||||
|
if(ft == null){
|
||||||
|
//Außerhalb der Arena
|
||||||
|
return arenaMinX > chunkX ||
|
||||||
|
chunkX > arenaMaxX ||
|
||||||
|
arenaMinZ > chunkZ ||
|
||||||
|
chunkZ > arenaMaxZ;
|
||||||
|
}else if(ft.isBlue()){
|
||||||
|
return FightSystem.isEntern() ||
|
||||||
|
redMinX > chunkX ||
|
||||||
|
chunkX > redMaxX ||
|
||||||
|
redMinZ > chunkZ ||
|
||||||
|
chunkZ > redMaxZ;
|
||||||
|
}else{
|
||||||
|
return FightSystem.isEntern() ||
|
||||||
|
blueMinX > chunkX ||
|
||||||
|
chunkX > blueMaxX ||
|
||||||
|
blueMinZ > chunkZ ||
|
||||||
|
chunkZ > blueMaxZ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void chunkHider(){
|
||||||
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent e) {
|
public void onPacketSending(PacketEvent e) {
|
||||||
PacketContainer packet = e.getPacket();
|
PacketContainer packet = e.getPacket();
|
||||||
@ -220,34 +253,10 @@ public class TechHider {
|
|||||||
byteArray.write(0, data);
|
byteArray.write(0, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).start(threadMultiplier * 4);
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
|
||||||
@Override
|
|
||||||
public void onPacketSending(PacketEvent e) {
|
|
||||||
PacketContainer packet = e.getPacket();
|
|
||||||
BlockPosition pos = packet.getBlockPositionModifier().read(0);
|
|
||||||
|
|
||||||
Player p = e.getPlayer();
|
|
||||||
if(bypass(p, posToChunk(pos.getX()), posToChunk(pos.getZ())))
|
|
||||||
return;
|
|
||||||
|
|
||||||
PacketContainer cached = packetCache.get(packet);
|
|
||||||
if(cached != null){
|
|
||||||
e.setPacket(cached);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cached = packet.deepClone();
|
private static void multiBlockHider(){
|
||||||
packetCache.put(packet, cached);
|
|
||||||
e.setPacket(cached);
|
|
||||||
StructureModifier<WrappedBlockData> blockStructure = cached.getBlockData();
|
|
||||||
WrappedBlockData block = blockStructure.read(0);
|
|
||||||
if(Config.HiddenBlocks.contains(block.getType().getId())){
|
|
||||||
block.setType(obfuscateMaterial);
|
|
||||||
blockStructure.write(0, block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent e) {
|
public void onPacketSending(PacketEvent e) {
|
||||||
@ -272,6 +281,7 @@ public class TechHider {
|
|||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for(MultiBlockChangeInfo mbci : changes){
|
for(MultiBlockChangeInfo mbci : changes){
|
||||||
WrappedBlockData block = mbci.getData();
|
WrappedBlockData block = mbci.getData();
|
||||||
|
//noinspection deprecation
|
||||||
if(Config.HiddenBlocks.contains(block.getType().getId())){
|
if(Config.HiddenBlocks.contains(block.getType().getId())){
|
||||||
changed = true;
|
changed = true;
|
||||||
block.setType(obfuscateMaterial);
|
block.setType(obfuscateMaterial);
|
||||||
@ -284,6 +294,40 @@ public class TechHider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void blockHider(){
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(PacketEvent e) {
|
||||||
|
PacketContainer packet = e.getPacket();
|
||||||
|
BlockPosition pos = packet.getBlockPositionModifier().read(0);
|
||||||
|
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
if(bypass(p, posToChunk(pos.getX()), posToChunk(pos.getZ())))
|
||||||
|
return;
|
||||||
|
|
||||||
|
PacketContainer cached = packetCache.get(packet);
|
||||||
|
if(cached != null){
|
||||||
|
e.setPacket(cached);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cached = packet.deepClone();
|
||||||
|
packetCache.put(packet, cached);
|
||||||
|
e.setPacket(cached);
|
||||||
|
StructureModifier<WrappedBlockData> blockStructure = cached.getBlockData();
|
||||||
|
WrappedBlockData block = blockStructure.read(0);
|
||||||
|
//noinspection deprecation
|
||||||
|
if(Config.HiddenBlocks.contains(block.getType().getId())){
|
||||||
|
block.setType(obfuscateMaterial);
|
||||||
|
blockStructure.write(0, block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void blockActionHider(){
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_ACTION) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_ACTION) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent e) {
|
public void onPacketSending(PacketEvent e) {
|
||||||
@ -299,32 +343,6 @@ public class TechHider {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean bypass(Player p, int chunkX, int chunkZ){
|
|
||||||
if(p == FightSystem.getEventLeiter())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
FightTeam ft = Fight.getPlayerTeam(p);
|
|
||||||
if(ft == null){
|
|
||||||
//Außerhalb der Arena
|
|
||||||
return arenaMinX > chunkX ||
|
|
||||||
chunkX > arenaMaxX ||
|
|
||||||
arenaMinZ > chunkZ ||
|
|
||||||
chunkZ > arenaMaxZ;
|
|
||||||
}else if(ft.isBlue()){
|
|
||||||
return FightSystem.isEntern() ||
|
|
||||||
redMinX > chunkX ||
|
|
||||||
chunkX > redMaxX ||
|
|
||||||
redMinZ > chunkZ ||
|
|
||||||
chunkZ > redMaxZ;
|
|
||||||
}else{
|
|
||||||
return FightSystem.isEntern() ||
|
|
||||||
blueMinX > chunkX ||
|
|
||||||
chunkX > blueMaxX ||
|
|
||||||
blueMinZ > chunkZ ||
|
|
||||||
chunkZ > blueMaxZ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Pair<Integer, Integer>> prepareChunkReload(Player p){
|
public static List<Pair<Integer, Integer>> prepareChunkReload(Player p){
|
||||||
if(disabled())
|
if(disabled())
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
package de.steamwar.fightsystem.utils.sql;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import static de.warking.hunjy.Core.sql;
|
|
||||||
|
|
||||||
public class Event {
|
|
||||||
|
|
||||||
private final int eventID;
|
|
||||||
private final String eventName;
|
|
||||||
private final Timestamp start;
|
|
||||||
private final Timestamp end;
|
|
||||||
private final int maximumTeamMembers;
|
|
||||||
private final boolean publicSchemsOnly;
|
|
||||||
|
|
||||||
private Event(int eventID, String eventName, Timestamp start, Timestamp end, int maximumTeamMembers, boolean publicSchemsOnly){
|
|
||||||
this.eventID = eventID;
|
|
||||||
this.eventName = eventName;
|
|
||||||
this.start = start;
|
|
||||||
this.end = end;
|
|
||||||
this.maximumTeamMembers = maximumTeamMembers;
|
|
||||||
this.publicSchemsOnly = publicSchemsOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Event get(int eventID){
|
|
||||||
ResultSet rs = sql.select("SELECT * FROM Event WHERE EventID = " + eventID);
|
|
||||||
try{
|
|
||||||
if(!rs.next())
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
|
|
||||||
return new Event(eventID, rs.getString("EventName"), rs.getTimestamp("Start"), rs.getTimestamp("End"), rs.getInt("MaximumTeamMembers"), rs.getBoolean("PublicSchemsOnly"));
|
|
||||||
}catch (SQLException e){
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Event", e);
|
|
||||||
throw new SecurityException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEventID() {
|
|
||||||
return eventID;
|
|
||||||
}
|
|
||||||
public String getEventName() {
|
|
||||||
return eventName;
|
|
||||||
}
|
|
||||||
public Timestamp getStart() {
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
public Timestamp getEnd() {
|
|
||||||
return end;
|
|
||||||
}
|
|
||||||
public int getMaximumTeamMembers() {
|
|
||||||
return maximumTeamMembers;
|
|
||||||
}
|
|
||||||
public boolean publicSchemsOnly() {
|
|
||||||
return publicSchemsOnly;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
package de.steamwar.fightsystem.utils.sql;
|
|
||||||
|
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
|
||||||
import de.warking.hunjy.Core;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class EventFight {
|
|
||||||
private int eventID;
|
|
||||||
private int fightID;
|
|
||||||
private int teamBlue;
|
|
||||||
private int teamRed;
|
|
||||||
private int kampfleiter;
|
|
||||||
private int ergebnis;
|
|
||||||
|
|
||||||
private EventFight(int eventID, int fightID, int teamBlue, int teamRed, int kampfleiter, int ergebnis){
|
|
||||||
this.eventID = eventID;
|
|
||||||
this.fightID = fightID;
|
|
||||||
this.teamBlue = teamBlue;
|
|
||||||
this.teamRed = teamRed;
|
|
||||||
this.kampfleiter = kampfleiter;
|
|
||||||
this.ergebnis = ergebnis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EventFight get(int fightID){
|
|
||||||
ResultSet rs = Core.sql.select("SELECT * FROM EventFight WHERE FightID = " + fightID);
|
|
||||||
try{
|
|
||||||
rs.next();
|
|
||||||
return new EventFight(
|
|
||||||
rs.getInt("EventID"),
|
|
||||||
fightID,
|
|
||||||
rs.getInt("TeamBlue"),
|
|
||||||
rs.getInt("TeamRed"),
|
|
||||||
rs.getInt("Kampfleiter"),
|
|
||||||
rs.getInt("Ergebnis"));
|
|
||||||
}catch (SQLException e){
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight", e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErgebnis(FightTeam winner){
|
|
||||||
if (winner == null)
|
|
||||||
ergebnis = 0;
|
|
||||||
else if (winner.isBlue())
|
|
||||||
ergebnis = 1;
|
|
||||||
else
|
|
||||||
ergebnis = 2;
|
|
||||||
Core.sql.update("UPDATE EventFight SET Ergebnis = " + ergebnis + " WHERE FightID = " + fightID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTeamBlue() {
|
|
||||||
return teamBlue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTeamRed() {
|
|
||||||
return teamRed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEventID() {
|
|
||||||
return eventID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFightID() {
|
|
||||||
return fightID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getKampfleiter() {
|
|
||||||
return kampfleiter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getErgebnis() {
|
|
||||||
return ergebnis;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
package de.steamwar.fightsystem.utils.sql;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import static de.warking.hunjy.Core.sql;
|
|
||||||
|
|
||||||
public class Team {
|
|
||||||
private final int teamId;
|
|
||||||
private String teamKuerzel;
|
|
||||||
private String teamName;
|
|
||||||
private int teamLeader;
|
|
||||||
|
|
||||||
private Team(int id, String kuerzel, String name, int leader){
|
|
||||||
teamId = id;
|
|
||||||
teamKuerzel = kuerzel;
|
|
||||||
teamName = name;
|
|
||||||
teamLeader = leader;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Team get(int id){
|
|
||||||
return load(sql.select("SELECT * FROM Team WHERE TeamID = " + id));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Team load(ResultSet dbteam){
|
|
||||||
try {
|
|
||||||
if(!dbteam.next()){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int id = dbteam.getInt("TeamID");
|
|
||||||
String kuerzel = dbteam.getString("TeamKuerzel");
|
|
||||||
String name = dbteam.getString("TeamName");
|
|
||||||
int leader = dbteam.getInt("TeamLeader");
|
|
||||||
return new Team(id, kuerzel, name, leader);
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Could not load teammembers", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTeamId() {
|
|
||||||
return teamId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTeamKuerzel() {
|
|
||||||
return teamKuerzel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTeamName() {
|
|
||||||
return teamName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTeamLeader() {
|
|
||||||
return teamLeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Integer> getMembers(){
|
|
||||||
try{
|
|
||||||
ResultSet memberlist = sql.select("SELECT id FROM UserData WHERE Team = '" + teamId + "'");
|
|
||||||
List<Integer> members = new ArrayList<>();
|
|
||||||
while(memberlist.next()){
|
|
||||||
members.add(memberlist.getInt("id"));
|
|
||||||
}
|
|
||||||
return members;
|
|
||||||
}catch(SQLException e){
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Could not load Teammembers", e);
|
|
||||||
}
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@ name: FightSystem
|
|||||||
version: 1.0
|
version: 1.0
|
||||||
author: [Yaruma3341, Lixfel]
|
author: [Yaruma3341, Lixfel]
|
||||||
main: de.steamwar.fightsystem.FightSystem
|
main: de.steamwar.fightsystem.FightSystem
|
||||||
depend: [CoreSystem, WorldEdit, FastAsyncWorldEdit, ProtocolLib]
|
depend: [SpigotCore, WorldEdit, ProtocolLib]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
ak:
|
ak:
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren