forked from SteamWar/SteamWar
Format code
This commit is contained in:
@@ -4,9 +4,9 @@ Server:
|
||||
# Server java archive
|
||||
ServerJar: ""
|
||||
# Available arenas
|
||||
Maps: []
|
||||
Maps: [ ]
|
||||
# Names to address the game mode in the chat interface
|
||||
ChatNames: []
|
||||
ChatNames: [ ]
|
||||
# If the game mode should be marked as a historic game mode
|
||||
Historic: false # defaults to false if missing
|
||||
# If ranked matches should be available for the game mode
|
||||
@@ -16,7 +16,7 @@ Server:
|
||||
Deadline: null # defaults to null if missing
|
||||
|
||||
# The questions that have to be answered to accept the schematic
|
||||
CheckQuestions: [] # Disables check schem type if missing
|
||||
CheckQuestions: [ ] # Disables check schem type if missing
|
||||
|
||||
Times:
|
||||
# Time in seconds the server stops after starting if nobody joins
|
||||
@@ -70,7 +70,7 @@ Schematic:
|
||||
# The schematic type that can be chosen in this arena
|
||||
Type: Normal # defaults to Normal if missing
|
||||
# The schematic types that are also allowed to be chosen in this arena
|
||||
SubTypes: [] # defaults to empty List
|
||||
SubTypes: [ ] # defaults to empty List
|
||||
# Shortcut of the schematic type
|
||||
Shortcut: "" # defaults to "" if missing
|
||||
# Spigot (1.8) material for GUIs
|
||||
@@ -100,14 +100,14 @@ Schematic:
|
||||
# List of limited material (combinations)
|
||||
# List contains tags Amount (integer) and Materials (List of material names in Spigot 1.12 AND Spigot 1.15 format)
|
||||
Limited:
|
||||
- Materials: []
|
||||
- Materials: [ ]
|
||||
Amount: 0
|
||||
|
||||
# The name of the game mode presented to the players
|
||||
GameName: WarGear # defaults to WarGear if missing
|
||||
# The months this game mode should be active and playable
|
||||
# The empty List means all of them
|
||||
ActiveMonths: [] # defaults to none if missing
|
||||
ActiveMonths: [ ] # defaults to none if missing
|
||||
# The prefix used for team chats
|
||||
TeamChatPrefix: + # defaults to + if missing
|
||||
Blue:
|
||||
@@ -149,7 +149,7 @@ WinConditionParams:
|
||||
# Is Blocks a whitelist (true) or blacklist (false)
|
||||
BlocksWhitelist: false # defaults to false if missing
|
||||
# Special Blocks (Valid spigot material values) used by the percent win conditions
|
||||
Blocks: [] # defaults to none if missing
|
||||
Blocks: [ ] # defaults to none if missing
|
||||
# Time for being declared TechKo without a shot given.
|
||||
TechKoTime: 90 # defaults to 90 if missing
|
||||
|
||||
@@ -163,10 +163,10 @@ Kits:
|
||||
# If the personal kit system is active
|
||||
PersonalKits: false # defaults to false if missing
|
||||
# Items (Valid spigot material values) that are not allowed in the personal kit
|
||||
ForbiddenItems: [] # defaults to none if missing
|
||||
ForbiddenItems: [ ] # defaults to none if missing
|
||||
|
||||
# A list of integers containing the waiting time of this enter stage in the fight
|
||||
EnterStages: [] # defaults to no enter stages (empty list) if missing
|
||||
EnterStages: [ ] # defaults to no enter stages (empty list) if missing
|
||||
|
||||
Techhider:
|
||||
# The tech hider blocks/materials have to be valid lowercase minecraft material names
|
||||
@@ -175,9 +175,9 @@ Techhider:
|
||||
# Which block the tech hider replaces to.
|
||||
ObfuscateWith: end_stone # defaults to end_stone if missing
|
||||
# A list of all hidden blocks. "water" results in the hiding of all waterlogged blocks as well.
|
||||
HiddenBlocks: [] # defaults to none if missing
|
||||
HiddenBlocks: [ ] # defaults to none if missing
|
||||
# The block entity contents that are hidden (here with minecraft:nametag)
|
||||
HiddenBlockEntites: [] # defaults to none if missing
|
||||
HiddenBlockEntites: [ ] # defaults to none if missing
|
||||
|
||||
# The following configuration must be in the world folder/config.yml
|
||||
#
|
||||
|
||||
@@ -40,7 +40,8 @@ import java.util.logging.Level;
|
||||
|
||||
public class Config {
|
||||
|
||||
private Config(){}
|
||||
private Config() {
|
||||
}
|
||||
|
||||
public static final World world = Bukkit.getWorlds().get(0);
|
||||
|
||||
@@ -97,13 +98,13 @@ public class Config {
|
||||
public static final int SpectatePort;
|
||||
public static final int ReplayID;
|
||||
|
||||
static{
|
||||
static {
|
||||
CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0"));
|
||||
PrepareSchemID = Integer.parseInt(System.getProperty("prepareSchemID", "0"));
|
||||
ReplayID = Integer.parseInt(System.getProperty("replay", "0"));
|
||||
|
||||
String configFile = System.getProperty("config", "config.yml");
|
||||
if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||
if (!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||
FightSystem.getPlugin().saveDefaultConfig();
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
||||
Bukkit.shutdown();
|
||||
@@ -111,7 +112,7 @@ public class Config {
|
||||
GameModeConfig = new GameModeConfig<>(new File(FightSystem.getPlugin().getDataFolder(), configFile), GameModeConfigUtils.ToMaterial, Winconditions::valueOf, de.steamwar.sql.GameModeConfig.ToStaticWarGear, false);
|
||||
|
||||
File worldConfigFile = new File(world.getWorldFolder(), "config.yml");
|
||||
if(!worldConfigFile.exists()) {
|
||||
if (!worldConfigFile.exists()) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
@@ -146,9 +147,9 @@ public class Config {
|
||||
teamRedPasteZ + 0.5 - GameModeConfig.Arena.SpawnOffset.z);
|
||||
|
||||
SpecSpawn = new Location(world,
|
||||
teamBluePasteX + BlueToRedX /2.0,
|
||||
blueCornerY + BlueToRedY /2.0 + GameModeConfig.Schematic.Size.y/2.0,
|
||||
teamBluePasteZ + BlueToRedZ /2.0);
|
||||
teamBluePasteX + BlueToRedX / 2.0,
|
||||
blueCornerY + BlueToRedY / 2.0 + GameModeConfig.Schematic.Size.y / 2.0,
|
||||
teamBluePasteZ + BlueToRedZ / 2.0);
|
||||
|
||||
Vector v1 = TeamBlueSpawn.toVector().subtract(TeamRedSpawn.toVector());
|
||||
double pitch = Math.toDegrees(v1.angle(v1.clone().setY(0)));
|
||||
@@ -167,31 +168,31 @@ public class Config {
|
||||
int arenaMaxX;
|
||||
int arenaMinZ;
|
||||
int arenaMaxZ;
|
||||
if(BlueToRedX > 0){
|
||||
if (BlueToRedX > 0) {
|
||||
arenaMinX = blueCornerX - GameModeConfig.Arena.Schem2Border.x;
|
||||
arenaMaxX = teamRedCornerX + GameModeConfig.Schematic.Size.x + GameModeConfig.Arena.Schem2Border.x;
|
||||
teamRedRotate = true;
|
||||
teamBlueRotate = false;
|
||||
}else{
|
||||
} else {
|
||||
arenaMinX = teamRedCornerX - GameModeConfig.Arena.Schem2Border.x;
|
||||
arenaMaxX = blueCornerX + GameModeConfig.Schematic.Size.x + GameModeConfig.Arena.Schem2Border.x;
|
||||
teamRedRotate = false;
|
||||
teamBlueRotate = true;
|
||||
}
|
||||
if(BlueToRedZ > 0){
|
||||
if (BlueToRedZ > 0) {
|
||||
arenaMinZ = blueCornerZ - GameModeConfig.Arena.Schem2Border.z;
|
||||
arenaMaxZ = teamRedCornerZ + GameModeConfig.Schematic.Size.z + GameModeConfig.Arena.Schem2Border.z;
|
||||
teamRedRotate = true;
|
||||
teamBlueRotate = false;
|
||||
}else{
|
||||
} else {
|
||||
arenaMinZ = teamRedCornerZ - GameModeConfig.Arena.Schem2Border.z;
|
||||
arenaMaxZ = blueCornerZ + GameModeConfig.Schematic.Size.z + GameModeConfig.Arena.Schem2Border.z;
|
||||
if(BlueToRedZ != 0){
|
||||
if (BlueToRedZ != 0) {
|
||||
teamRedRotate = false;
|
||||
teamBlueRotate = true;
|
||||
}
|
||||
}
|
||||
if(!GameModeConfig.Schematic.Rotate){
|
||||
if (!GameModeConfig.Schematic.Rotate) {
|
||||
teamRedRotate = false;
|
||||
teamBlueRotate = false;
|
||||
}
|
||||
@@ -209,9 +210,9 @@ public class Config {
|
||||
BlueInsetRegion = new Region(BluePasteRegion.getMinX() + GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMinY() + GameModeConfig.Schematic.Inset.bottom, BluePasteRegion.getMinZ() + GameModeConfig.Schematic.Inset.z, BluePasteRegion.getMaxX() - GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMaxY() - GameModeConfig.Schematic.Inset.top, BluePasteRegion.getMaxZ() - GameModeConfig.Schematic.Inset.z);
|
||||
|
||||
int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||
if(eventKampfID >= 1){
|
||||
if (eventKampfID >= 1) {
|
||||
EventKampf = EventFight.byId(eventKampfID);
|
||||
if(EventKampf == null){
|
||||
if (EventKampf == null) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
@@ -220,7 +221,7 @@ public class Config {
|
||||
Team team1 = Team.byId(EventKampf.getTeamBlue());
|
||||
Team team2 = Team.byId(EventKampf.getTeamRed());
|
||||
|
||||
if(team1 == null || team2 == null){
|
||||
if (team1 == null || team2 == null) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
@@ -239,14 +240,14 @@ public class Config {
|
||||
Referees = Referee.get(Config.EventKampf.getEventID());
|
||||
|
||||
Event event = Event.byId(EventKampf.getEventID());
|
||||
if(BothTeamsPublic) {
|
||||
if (BothTeamsPublic) {
|
||||
OnlyPublicSchematics = true;
|
||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||
}else{
|
||||
} else {
|
||||
OnlyPublicSchematics = event.publicSchemsOnly();
|
||||
MaximumTeamMembers = event.getMaximumTeamMembers();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
//No event
|
||||
TeamRedColor = GameModeConfig.Red.Prefix;
|
||||
TeamBlueColor = GameModeConfig.Blue.Prefix;
|
||||
@@ -265,37 +266,41 @@ public class Config {
|
||||
|
||||
String blueLeader = System.getProperty("blueLeader", null);
|
||||
String redLeader = System.getProperty("redLeader", null);
|
||||
if(blueLeader != null)
|
||||
if (blueLeader != null) {
|
||||
BlueLeader = UUID.fromString(blueLeader);
|
||||
else
|
||||
} else {
|
||||
BlueLeader = null;
|
||||
if(redLeader != null)
|
||||
}
|
||||
if (redLeader != null) {
|
||||
RedLeader = UUID.fromString(redLeader);
|
||||
else
|
||||
} else {
|
||||
RedLeader = null;
|
||||
}
|
||||
|
||||
if(CheckSchemID != 0){
|
||||
if (CheckSchemID != 0) {
|
||||
mode = ArenaMode.CHECK;
|
||||
}else if(PrepareSchemID != 0){
|
||||
} else if (PrepareSchemID != 0) {
|
||||
mode = ArenaMode.PREPARE;
|
||||
}else if(eventKampfID >= 1){
|
||||
} else if (eventKampfID >= 1) {
|
||||
mode = ArenaMode.EVENT;
|
||||
}else if(eventKampfID == -1){
|
||||
} else if (eventKampfID == -1) {
|
||||
mode = ArenaMode.TEST;
|
||||
}else if(ReplayID != 0){
|
||||
} else if (ReplayID != 0) {
|
||||
mode = ArenaMode.REPLAY;
|
||||
}else{
|
||||
} else {
|
||||
mode = ArenaMode.NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean test(){
|
||||
public static boolean test() {
|
||||
return ArenaMode.Test.contains(mode);
|
||||
}
|
||||
public static boolean replayserver(){
|
||||
|
||||
public static boolean replayserver() {
|
||||
return ReplayID < 0;
|
||||
}
|
||||
public static boolean blueNegZ(){
|
||||
|
||||
public static boolean blueNegZ() {
|
||||
return BlueToRedZ > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if(Core.getInstance() == null) {
|
||||
if (Core.getInstance() == null) {
|
||||
Core.setInstance(this);
|
||||
TinyProtocol.init();
|
||||
}
|
||||
@@ -105,9 +105,9 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
FileSource.startReplay();
|
||||
|
||||
if(Config.mode == ArenaMode.EVENT) {
|
||||
if (Config.mode == ArenaMode.EVENT) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
}else if(Config.mode == ArenaMode.CHECK){
|
||||
} else if (Config.mode == ArenaMode.CHECK) {
|
||||
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
Fight.getBlueTeam().setSchem(checkSchematicNode);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
|
||||
new TechareaCommand();
|
||||
}else if(Config.mode == ArenaMode.PREPARE) {
|
||||
} else if (Config.mode == ArenaMode.PREPARE) {
|
||||
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
public static void shutdown() {
|
||||
//Staggered kick to prevent lobby overloading
|
||||
if(Bukkit.getOnlinePlayers().isEmpty()){
|
||||
if (Bukkit.getOnlinePlayers().isEmpty()) {
|
||||
Bukkit.shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,164 +17,164 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
PREFIX=§eArena§8»
|
||||
PREFIX = §eArena§8»
|
||||
|
||||
# Commands
|
||||
NO_TEAM=§cYou are in no team
|
||||
FIGHT_ALREADY_STARTED=§cThe fight already started
|
||||
NOT_LEADER=§cYou aren't a leader
|
||||
PLAYER_UNAVAILABLE=§cThe player is not in an arena
|
||||
NO_TEAM = §cYou are in no team
|
||||
FIGHT_ALREADY_STARTED = §cThe fight already started
|
||||
NOT_LEADER = §cYou aren't a leader
|
||||
PLAYER_UNAVAILABLE = §cThe player is not in an arena
|
||||
|
||||
NOT_IN_TEAM=§e{0} §cis not in your team
|
||||
NOT_IN_TEAM = §e{0} §cis not in your team
|
||||
|
||||
KIT_UNAVAILABLE=§cThis kit does not exist
|
||||
KIT_CHOSEN=§7Selected kit §e{0}
|
||||
KIT_UNAVAILABLE = §cThis kit does not exist
|
||||
KIT_CHOSEN = §7Selected kit §e{0}
|
||||
|
||||
GAMEMODE_NOT_ALLOWED=§cChanging gamemode is not permitted
|
||||
GAMEMODE_UNKNOWN=§cUnknown gamemode {0}
|
||||
GAMEMODE_HELP=§8/§7gm §8[§egamemode§8]
|
||||
GAMEMODE_NOT_ALLOWED = §cChanging gamemode is not permitted
|
||||
GAMEMODE_UNKNOWN = §cUnknown gamemode {0}
|
||||
GAMEMODE_HELP = §8/§7gm §8[§egamemode§8]
|
||||
|
||||
LOCKSCHEM_HELP=§8/§7lockschem §8[§eteam§8]
|
||||
UNKNOWN_TEAM=§cThis team does not exist
|
||||
LOCKSCHEM_LOCKED=§7Schematic locked
|
||||
LOCKSCHEM_LOCKED_BY=§cThe schematic was locked by §e{0}
|
||||
LOCKSCHEM_HELP = §8/§7lockschem §8[§eteam§8]
|
||||
UNKNOWN_TEAM = §cThis team does not exist
|
||||
LOCKSCHEM_LOCKED = §7Schematic locked
|
||||
LOCKSCHEM_LOCKED_BY = §cThe schematic was locked by §e{0}
|
||||
|
||||
REMOVE_HELP=§8/§eremove §8[§eplayer§8]
|
||||
REMOVE_HELP = §8/§eremove §8[§eplayer§8]
|
||||
|
||||
NOT_FIGHTLEADER=§cYou are not the fight leader
|
||||
WIN_HELP=§8/§7win §8[§eteam §8or §etie§8]
|
||||
NOT_FIGHTLEADER = §cYou are not the fight leader
|
||||
WIN_HELP = §8/§7win §8[§eteam §8or §etie§8]
|
||||
|
||||
INFO_LEADER=§7Leader {0}§8: {1}
|
||||
INFO_SCHEMATIC=§7Schematic {0}§8: §e{1} §7from {2}, Rank: {3}
|
||||
INFO_LEADER = §7Leader {0}§8: {1}
|
||||
INFO_SCHEMATIC = §7Schematic {0}§8: §e{1} §7from {2}, Rank: {3}
|
||||
|
||||
TPSWARP_HELP=§8/§7tpswarp §8[§eticks per second§8]
|
||||
TPSWARP_SET=§7TPS set to §e{0}
|
||||
TPSWARP_HELP = §8/§7tpswarp §8[§eticks per second§8]
|
||||
TPSWARP_SET = §7TPS set to §e{0}
|
||||
|
||||
|
||||
# GUI
|
||||
STATE_TITLE=Fight state
|
||||
STATE_PRE_LEADER_SETUP=§7Team leader waiting phase
|
||||
STATE_PRE_SCHEM_SETUP=§7Schematic selection phase
|
||||
STATE_POST_SCHEM_SETUP=§7Preparation phase
|
||||
STATE_PRE_RUNNING=§eKit distribution
|
||||
STATE_RUNNING=§eFighting phase
|
||||
STATE_SPECTATE_WIN=§7Victory {0}
|
||||
STATE_SPECTATE_TIE=§7Draw
|
||||
STATE_TITLE = Fight state
|
||||
STATE_PRE_LEADER_SETUP = §7Team leader waiting phase
|
||||
STATE_PRE_SCHEM_SETUP = §7Schematic selection phase
|
||||
STATE_POST_SCHEM_SETUP = §7Preparation phase
|
||||
STATE_PRE_RUNNING = §eKit distribution
|
||||
STATE_RUNNING = §eFighting phase
|
||||
STATE_SPECTATE_WIN = §7Victory {0}
|
||||
STATE_SPECTATE_TIE = §7Draw
|
||||
|
||||
MANAGE_TITLE=Manage players
|
||||
MANAGE_LORE1=§eLeft §7click§8: §ekick
|
||||
MANAGE_LORE2=§eRight §7click§8: §epromote
|
||||
MANAGE_TITLE = Manage players
|
||||
MANAGE_LORE1 = §eLeft §7click§8: §ekick
|
||||
MANAGE_LORE2 = §eRight §7click§8: §epromote
|
||||
|
||||
KIT_SELECTION_TITLE=Kit selection
|
||||
KIT_NO_KITS=§cNo kits found
|
||||
KIT_CREATE=§eNew kit
|
||||
KITNAME_TITLE=Input kit name
|
||||
KITNAME_IN_USE=§cThis kit name is already in use
|
||||
KIT_SEARCH=§eSearch
|
||||
KITSEARCH_TITLE=Search for kit
|
||||
KIT_SELECTION_TITLE = Kit selection
|
||||
KIT_NO_KITS = §cNo kits found
|
||||
KIT_CREATE = §eNew kit
|
||||
KITNAME_TITLE = Input kit name
|
||||
KITNAME_IN_USE = §cThis kit name is already in use
|
||||
KIT_SEARCH = §eSearch
|
||||
KITSEARCH_TITLE = Search for kit
|
||||
|
||||
SCHEM_NO_ENEMY=§cNo schematic selection without an opponent
|
||||
SCHEM_TITLE={0} selection
|
||||
SCHEM_DIRT=§eDirt Block
|
||||
SCHEM_PUBLIC=§ePublic {0}
|
||||
SCHEM_UNCHECKED=§eUnchecked {0}
|
||||
SCHEM_PRIVATE=§ePrivate {0}
|
||||
SCHEM_NO_PRIVATE=§7No private {0} present
|
||||
SCHEM_PRIVATE_FORBIDDEN=§7No private {0} allowed
|
||||
SCHEM_NO_ENEMY = §cNo schematic selection without an opponent
|
||||
SCHEM_TITLE = {0} selection
|
||||
SCHEM_DIRT = §eDirt Block
|
||||
SCHEM_PUBLIC = §ePublic {0}
|
||||
SCHEM_UNCHECKED = §eUnchecked {0}
|
||||
SCHEM_PRIVATE = §ePrivate {0}
|
||||
SCHEM_NO_PRIVATE = §7No private {0} present
|
||||
SCHEM_PRIVATE_FORBIDDEN = §7No private {0} allowed
|
||||
|
||||
ADD_AI_TITLE=Add AI
|
||||
ADD_AI_TITLE = Add AI
|
||||
|
||||
|
||||
# Countdowns
|
||||
COUNTDOWN_MINUTES=§e{0} §7Minutes {1}
|
||||
COUNTDOWN_SECONDS=§e{0} §7Seconds {1}
|
||||
COUNTDOWN_SECOND=§eOne §7second {1}
|
||||
COUNTDOWN_MINUTES = §e{0} §7Minutes {1}
|
||||
COUNTDOWN_SECONDS = §e{0} §7Seconds {1}
|
||||
COUNTDOWN_SECOND = §eOne §7second {1}
|
||||
|
||||
ENTERN_COUNTDOWN=until boarding is allowed
|
||||
ENTERN_ALLOWED=§eBoarding §7is now allowed
|
||||
ENTERN_COUNTDOWN = until boarding is allowed
|
||||
ENTERN_ALLOWED = §eBoarding §7is now allowed
|
||||
|
||||
SHUTDOWN_COUNTDOWN=until the server is stopped
|
||||
PRE_SCHEM_COUNTDOWN=until a public schematic is chosen
|
||||
POST_SCHEM_COUNTDOWN=until the kits are distributed
|
||||
PRE_RUNNING_COUNTDOWN=until the fight starts
|
||||
RUNNING_COUNTDOWN=until the fight ends
|
||||
SPECTATE_COUNTDOWN=until the arena is reset
|
||||
SHUTDOWN_COUNTDOWN = until the server is stopped
|
||||
PRE_SCHEM_COUNTDOWN = until a public schematic is chosen
|
||||
POST_SCHEM_COUNTDOWN = until the kits are distributed
|
||||
PRE_RUNNING_COUNTDOWN = until the fight starts
|
||||
RUNNING_COUNTDOWN = until the fight ends
|
||||
SPECTATE_COUNTDOWN = until the arena is reset
|
||||
|
||||
|
||||
# Fight
|
||||
SCHEMATIC_UNLOADABLE=§cUnable to load schematic
|
||||
SCHEMATIC_CHOSEN=§7{0} §e{1} §7chosen
|
||||
SCHEMATIC_UNCHECKED=§7Team {0} §7has chosen an §eunchecked §7schematic§8!
|
||||
TEAM_READY=§aTeam ready
|
||||
TEAM_NOT_READY=§c§mTeam ready
|
||||
SKIP_READY=§aSkipping to next event
|
||||
SKIP_NOT_READY=§c§mSkipping to next event
|
||||
TEAM_CHAT={0}{1}§8» {0}{2}
|
||||
CHOOSE_KIT=§eChoose kit
|
||||
RESPAWN=§eRespawn
|
||||
MANAGE_PLAYERS=§cManage players
|
||||
CHOOSE_SCHEMATIC=§eChoose {0}
|
||||
SCHEMATIC_REQUIRED=§cChoose a schematic first
|
||||
ADD_AI=§eAdd AI
|
||||
SCHEMATIC_UNLOADABLE = §cUnable to load schematic
|
||||
SCHEMATIC_CHOSEN = §7{0} §e{1} §7chosen
|
||||
SCHEMATIC_UNCHECKED = §7Team {0} §7has chosen an §eunchecked §7schematic§8!
|
||||
TEAM_READY = §aTeam ready
|
||||
TEAM_NOT_READY = §c§mTeam ready
|
||||
SKIP_READY = §aSkipping to next event
|
||||
SKIP_NOT_READY = §c§mSkipping to next event
|
||||
TEAM_CHAT = {0}{1}§8» {0}{2}
|
||||
CHOOSE_KIT = §eChoose kit
|
||||
RESPAWN = §eRespawn
|
||||
MANAGE_PLAYERS = §cManage players
|
||||
CHOOSE_SCHEMATIC = §eChoose {0}
|
||||
SCHEMATIC_REQUIRED = §cChoose a schematic first
|
||||
ADD_AI = §eAdd AI
|
||||
|
||||
KIT_PREVIEW_EDIT=§7Edit kit
|
||||
KIT_PREVIEW_CHOOSE=§aSelect kit
|
||||
KIT_PREVIEW_BACK=§cBack
|
||||
KIT_PREVIEW_DELETE=§cDelete kit
|
||||
KIT_DELETION_CONFIRMATION=Are you sure you want to delete the kit?
|
||||
KIT_DELETION_ABORT=§cCancel
|
||||
KIT_DELETION_DELETE=§aDelete
|
||||
KIT_PREVIEW_EDIT = §7Edit kit
|
||||
KIT_PREVIEW_CHOOSE = §aSelect kit
|
||||
KIT_PREVIEW_BACK = §cBack
|
||||
KIT_PREVIEW_DELETE = §cDelete kit
|
||||
KIT_DELETION_CONFIRMATION = Are you sure you want to delete the kit?
|
||||
KIT_DELETION_ABORT = §cCancel
|
||||
KIT_DELETION_DELETE = §aDelete
|
||||
|
||||
|
||||
# Listener
|
||||
NO_ARENA_LEAVING=§cYou may not leave the arena
|
||||
CHECK_JOIN_DENIED=§cThere is a schematic in review on this server!
|
||||
CHECK_COMMAND_LOCKED=§cThis command is locked during review! Admin will be notified.
|
||||
NO_BLOCK_BREAK=§cYou are currently not allowed to break blocks here
|
||||
NO_BLOCK_PLACE=§cYou are currently not allowed to place blocks here
|
||||
NO_BOW_USAGE=§cYou can only use your bow after the fight has started
|
||||
NO_PARTICIPANT=§cYou are no fight participant
|
||||
NO_FRIENDLY_FIRE=§cNo friendly fire allowed
|
||||
NO_TNT_PLACE=§cYou are not allowed to place tnt
|
||||
NO_TELEPORT=§cYou are not allowed to use this teleport function
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE=§eOpen inventory to customize your kit
|
||||
NO_ENTERN=§cYou may not board
|
||||
NO_TEAMAREA=§cYou are not allowed in the team area
|
||||
PREPARE_SCHEM_DELETED=§cApparently the schematic to be submitted was deleted. submission aborted.
|
||||
PREPARE_SCHEM_EXISTS=§cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted.
|
||||
PREPARE_ACTIVE_PISTON=§cMoving pistons were found in the team area, submission aborted.
|
||||
PREPARE_FAILED_SAVING=§cThe schematic could not be saved, submission aborted.
|
||||
PREPARE_SENT_IN=§aA team member will review the schematic soon
|
||||
PARTICIPANT_CHAT={0} {1}§8» §7{2}
|
||||
FIGHTLEADER_CHAT=§e{0}§8» §e{1}
|
||||
SPECTATOR_CHAT=§7{0}§8» §7{1}
|
||||
PISTON_PUSHED_OUTSIDE=§cA piston pushed a block outside the allowed area!
|
||||
NO_ARENA_LEAVING = §cYou may not leave the arena
|
||||
CHECK_JOIN_DENIED = §cThere is a schematic in review on this server!
|
||||
CHECK_COMMAND_LOCKED = §cThis command is locked during review! Admin will be notified.
|
||||
NO_BLOCK_BREAK = §cYou are currently not allowed to break blocks here
|
||||
NO_BLOCK_PLACE = §cYou are currently not allowed to place blocks here
|
||||
NO_BOW_USAGE = §cYou can only use your bow after the fight has started
|
||||
NO_PARTICIPANT = §cYou are no fight participant
|
||||
NO_FRIENDLY_FIRE = §cNo friendly fire allowed
|
||||
NO_TNT_PLACE = §cYou are not allowed to place tnt
|
||||
NO_TELEPORT = §cYou are not allowed to use this teleport function
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE = §eOpen inventory to customize your kit
|
||||
NO_ENTERN = §cYou may not board
|
||||
NO_TEAMAREA = §cYou are not allowed in the team area
|
||||
PREPARE_SCHEM_DELETED = §cApparently the schematic to be submitted was deleted. submission aborted.
|
||||
PREPARE_SCHEM_EXISTS = §cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted.
|
||||
PREPARE_ACTIVE_PISTON = §cMoving pistons were found in the team area, submission aborted.
|
||||
PREPARE_FAILED_SAVING = §cThe schematic could not be saved, submission aborted.
|
||||
PREPARE_SENT_IN = §aA team member will review the schematic soon
|
||||
PARTICIPANT_CHAT = {0} {1}§8» §7{2}
|
||||
FIGHTLEADER_CHAT = §e{0}§8» §e{1}
|
||||
SPECTATOR_CHAT = §7{0}§8» §7{1}
|
||||
PISTON_PUSHED_OUTSIDE = §cA piston pushed a block outside the allowed area!
|
||||
|
||||
|
||||
# Replay
|
||||
REPLAY_ENDS=§cReplay ended
|
||||
OLD_STRING={0}
|
||||
REPLAY_ENDS = §cReplay ended
|
||||
OLD_STRING = {0}
|
||||
|
||||
|
||||
# States
|
||||
COMMAND_CURRENTLY_UNAVAILABLE=§cThis command is unavailable at this time of the fight
|
||||
COMMAND_CURRENTLY_UNAVAILABLE = §cThis command is unavailable at this time of the fight
|
||||
|
||||
|
||||
# Utils
|
||||
TPS_WARNING=§c{0} §7TPS
|
||||
TPS_WARNING = §c{0} §7TPS
|
||||
|
||||
UI_PRE_RUNNING=§7Kits distributed
|
||||
UI_RUNNING=§aFight started
|
||||
UI_SKIP=§7Skipping to next event
|
||||
UI_PLAYER_JOINS=§a§l» {0}{1}
|
||||
UI_PLAYER_LEAVES=§c§l« {0}{1}
|
||||
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH={0}{1} §7died
|
||||
UI_PLAYER_LEAVE={0}{1} §7left the fight
|
||||
UI_WIN={0}Victory {1}
|
||||
UI_DRAW=§7Draw
|
||||
UI_PRE_RUNNING = §7Kits distributed
|
||||
UI_RUNNING = §aFight started
|
||||
UI_SKIP = §7Skipping to next event
|
||||
UI_PLAYER_JOINS = §a§l» {0}{1}
|
||||
UI_PLAYER_LEAVES = §c§l« {0}{1}
|
||||
UI_LEADER_JOINS = §a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH = {0}{1} §7died
|
||||
UI_PLAYER_LEAVE = {0}{1} §7left the fight
|
||||
UI_WIN = {0}Victory {1}
|
||||
UI_DRAW = §7Draw
|
||||
|
||||
BAR_PRE_LEADER=§7Waiting for team leader
|
||||
BAR_PRE_LEADER = §7Waiting for team leader
|
||||
BAR_PRE_SCHEM = {1} §7Schematic selection {0} {2}
|
||||
BAR_PREPARE = {1} {3} §7Preparation {0} {4} {2}
|
||||
BAR_PRE_RUNNING = {1} {3} §7Start of fight in {0} {4} {2}
|
||||
@@ -184,74 +184,74 @@ BAR_RUNNING2 = {1} {3} {5} {7} {0} {6} {8} {4} {2}
|
||||
BAR_RUNNING3 = {1} {3} {5} {7} {9} {0} {6} {8} {10} {4} {2}
|
||||
BAR_TIE = {1} §7Draw {0} {2}
|
||||
BAR_WIN = {1} §7Victory {3} {0} {2}
|
||||
BAR_POINTS={0} §8Points
|
||||
BAR_POINTS_OF={0}§8/§7{1} §8Points
|
||||
BAR_PERCENT={0}§8%
|
||||
BAR_CANNONS={0} §8Cannons
|
||||
BAR_WATER={0} §8Water
|
||||
BAR_SECONDS={0}§8s
|
||||
BAR_POINTS = {0} §8Points
|
||||
BAR_POINTS_OF = {0}§8/§7{1} §8Points
|
||||
BAR_PERCENT = {0}§8%
|
||||
BAR_CANNONS = {0} §8Cannons
|
||||
BAR_WATER = {0} §8Water
|
||||
BAR_SECONDS = {0}§8s
|
||||
|
||||
|
||||
# Winconditions
|
||||
HELLS_BELLS_COUNTDOWN=until the bombs start dropping
|
||||
HELLS_BELLS_START_1=§c!!Careful!! Bombers arriving in about a minute.
|
||||
HELLS_BELLS_START_2=§cBombers approaching, arrival in about a minute.
|
||||
HELLS_BELLS_START_3=§cBombers spotted on the radar, ETA: one minute.
|
||||
HELLS_BELLS_START_4=§cUnknown flying object spotted, arriving in about a minute.
|
||||
HELLS_BELLS_START_5=§cFlying object spotted. ETA: one minute.
|
||||
HELLS_BELLS_START_6=§cWild bombers appeared, arrival in about a minute.
|
||||
HELLS_BELLS_SWAP_1=§aThe bombs are starting to fall more quickly.
|
||||
HELLS_BELLS_SWAP_2=§aMore bombers arriving.
|
||||
HELLS_BELLS_SWAP_3=§aAdditional bombers sighted.
|
||||
HELLS_BELLS_SWAP_4=§aThe bombardement is increasing.
|
||||
HELLS_BELLS_COUNTDOWN = until the bombs start dropping
|
||||
HELLS_BELLS_START_1 = §c!!Careful!! Bombers arriving in about a minute.
|
||||
HELLS_BELLS_START_2 = §cBombers approaching, arrival in about a minute.
|
||||
HELLS_BELLS_START_3 = §cBombers spotted on the radar, ETA: one minute.
|
||||
HELLS_BELLS_START_4 = §cUnknown flying object spotted, arriving in about a minute.
|
||||
HELLS_BELLS_START_5 = §cFlying object spotted. ETA: one minute.
|
||||
HELLS_BELLS_START_6 = §cWild bombers appeared, arrival in about a minute.
|
||||
HELLS_BELLS_SWAP_1 = §aThe bombs are starting to fall more quickly.
|
||||
HELLS_BELLS_SWAP_2 = §aMore bombers arriving.
|
||||
HELLS_BELLS_SWAP_3 = §aAdditional bombers sighted.
|
||||
HELLS_BELLS_SWAP_4 = §aThe bombardement is increasing.
|
||||
|
||||
METEOR_COUNTDOWN=until meteors start falling
|
||||
METEOR_START_1=§cA meteor shower was detected
|
||||
METEOR_START_2=§cShooting starts are 100% more likely to appear during this fight
|
||||
METEOR_START_3=§cMeteors sighted, seek shelter immediately!
|
||||
METEOR_START_4=§cThe end is near! The meteors will hit us in about a minute.
|
||||
METEOR_START_5=§fNEWS §cThere will be multiple meteor showers this afternoon!
|
||||
METEOR_START_6=§cAirships still flying are doomed to crash.
|
||||
METEOR_SWAP_1=§aIt doesn't stop, the meteors appear to be increasing.
|
||||
METEOR_SWAP_2=§aThis was only the beginning, the meteors are arriving faster and more powerful.
|
||||
METEOR_SWAP_3=§aIt seems like it won't stop, the meteors are starting to arrive more quickly!
|
||||
METEOR_SWAP_4=§aAnother shower has been detected, get to safety!
|
||||
METEOR_COUNTDOWN = until meteors start falling
|
||||
METEOR_START_1 = §cA meteor shower was detected
|
||||
METEOR_START_2 = §cShooting starts are 100% more likely to appear during this fight
|
||||
METEOR_START_3 = §cMeteors sighted, seek shelter immediately!
|
||||
METEOR_START_4 = §cThe end is near! The meteors will hit us in about a minute.
|
||||
METEOR_START_5 = §fNEWS §cThere will be multiple meteor showers this afternoon!
|
||||
METEOR_START_6 = §cAirships still flying are doomed to crash.
|
||||
METEOR_SWAP_1 = §aIt doesn't stop, the meteors appear to be increasing.
|
||||
METEOR_SWAP_2 = §aThis was only the beginning, the meteors are arriving faster and more powerful.
|
||||
METEOR_SWAP_3 = §aIt seems like it won't stop, the meteors are starting to arrive more quickly!
|
||||
METEOR_SWAP_4 = §aAnother shower has been detected, get to safety!
|
||||
|
||||
TECHKO_COUNTDOWN=must have fired a shot by {0}
|
||||
TECHKO_COUNTDOWN = must have fired a shot by {0}
|
||||
|
||||
WIN_FIGHTLEADER=§7Referee decision
|
||||
WIN_PERCENT={0} §7is too badly damaged
|
||||
WIN_OFFLINE_BOTH=§7Both teams offline
|
||||
WIN_OFFLINE={0} §7offline
|
||||
WIN_ALL_DEAD={0}All players neutralised
|
||||
WIN_LEADER_DEAD={0} neutralised
|
||||
WIN_TIME_OVER=§7Time is up!
|
||||
WIN_MORE_HEALTH={0} with more remaining health
|
||||
WIN_LESS_DAMAGE={0} §7less damaged
|
||||
WIN_POINTS={0} has more points
|
||||
WIN_POINTS_EQUAL=§7Equal points
|
||||
WIN_TECHKO={0} §7is tech K.O.
|
||||
WIN_IMPOSTER_DEAD={0} §7killed the imposter
|
||||
WIN_CREWMATE_DEAD={0} §7killed all team mates
|
||||
WIN_FIGHTLEADER = §7Referee decision
|
||||
WIN_PERCENT = {0} §7is too badly damaged
|
||||
WIN_OFFLINE_BOTH = §7Both teams offline
|
||||
WIN_OFFLINE = {0} §7offline
|
||||
WIN_ALL_DEAD = {0}All players neutralised
|
||||
WIN_LEADER_DEAD = {0} neutralised
|
||||
WIN_TIME_OVER = §7Time is up!
|
||||
WIN_MORE_HEALTH = {0} with more remaining health
|
||||
WIN_LESS_DAMAGE = {0} §7less damaged
|
||||
WIN_POINTS = {0} has more points
|
||||
WIN_POINTS_EQUAL = §7Equal points
|
||||
WIN_TECHKO = {0} §7is tech K.O.
|
||||
WIN_IMPOSTER_DEAD = {0} §7killed the imposter
|
||||
WIN_CREWMATE_DEAD = {0} §7killed all team mates
|
||||
|
||||
AMONG_US_IMPOSTER_MESSAGE = §4You are the Imposter§8! §7Kill all your team mates to win the game!
|
||||
AMONG_US_IMPOSTER_AMONG_MESSAGE = §4There is an Imposter among us§8! §7Kill him to win the game!
|
||||
|
||||
|
||||
# Invites
|
||||
JOIN_REQUEST=§7Request join
|
||||
JOIN_REQUEST_TITLE=Request join
|
||||
JOIN_REQUEST_ALREADY=§cYou have already sent a join request
|
||||
JOIN_REQUEST_TEAM=§7Join {0}
|
||||
JOIN_REQUEST_CONFIRMATION=§7Join request submitted
|
||||
JOIN_REQUEST_NOTIFICATION=§e{0} §7requests joining team {1}§8. §7Accept or decline using §8/§erequests
|
||||
JOIN_REQUEST = §7Request join
|
||||
JOIN_REQUEST_TITLE = Request join
|
||||
JOIN_REQUEST_ALREADY = §cYou have already sent a join request
|
||||
JOIN_REQUEST_TEAM = §7Join {0}
|
||||
JOIN_REQUEST_CONFIRMATION = §7Join request submitted
|
||||
JOIN_REQUEST_NOTIFICATION = §e{0} §7requests joining team {1}§8. §7Accept or decline using §8/§erequests
|
||||
|
||||
REQUESTS=§7Open join requests
|
||||
REQUESTS_TITLE=Open join requests
|
||||
REQUEST_DECLINED=§cJoin of {0} declined
|
||||
REQUEST_YOUR_DECLINED=§cYour join request was declined
|
||||
REQUESTS_LEFT_CLICK=§eLeft click §7to §eaccept§8!
|
||||
REQUESTS_RIGHT_CLICK=§eRight click §7to §edecline§8!
|
||||
REQUESTS = §7Open join requests
|
||||
REQUESTS_TITLE = Open join requests
|
||||
REQUEST_DECLINED = §cJoin of {0} declined
|
||||
REQUEST_YOUR_DECLINED = §cYour join request was declined
|
||||
REQUESTS_LEFT_CLICK = §eLeft click §7to §eaccept§8!
|
||||
REQUESTS_RIGHT_CLICK = §eRight click §7to §edecline§8!
|
||||
|
||||
NO_JOIN_REQUEST=§cThe player did not request joining
|
||||
NO_CONFIRMATION=§cNo confirmation necessary
|
||||
NO_JOIN_REQUEST = §cThe player did not request joining
|
||||
NO_CONFIRMATION = §cNo confirmation necessary
|
||||
+163
-163
@@ -18,220 +18,220 @@
|
||||
#
|
||||
|
||||
# Commands
|
||||
NO_TEAM=§cDu bist in keinem Team
|
||||
FIGHT_ALREADY_STARTED=§cDer Kampf hat bereits begonnen
|
||||
NOT_LEADER=§cDu bist kein Leader
|
||||
PLAYER_UNAVAILABLE=§cDer Spieler ist nicht in der Arena
|
||||
NO_TEAM = §cDu bist in keinem Team
|
||||
FIGHT_ALREADY_STARTED = §cDer Kampf hat bereits begonnen
|
||||
NOT_LEADER = §cDu bist kein Leader
|
||||
PLAYER_UNAVAILABLE = §cDer Spieler ist nicht in der Arena
|
||||
|
||||
NOT_IN_TEAM=§e{0} §cist nicht in deinem Team
|
||||
NOT_IN_TEAM = §e{0} §cist nicht in deinem Team
|
||||
|
||||
KIT_UNAVAILABLE=§cDieses Kit gibt es nicht
|
||||
KIT_CHOSEN=§7Kit §e{0} §7gew§hlt
|
||||
KIT_UNAVAILABLE = §cDieses Kit gibt es nicht
|
||||
KIT_CHOSEN = §7Kit §e{0} §7gew§hlt
|
||||
|
||||
GAMEMODE_NOT_ALLOWED=§cSpielmodusänderung verboten
|
||||
GAMEMODE_UNKNOWN=§cUnbekannter Spielmodus {0}
|
||||
GAMEMODE_HELP=§8/§7gm §8[§eSpielmodus§8]
|
||||
GAMEMODE_NOT_ALLOWED = §cSpielmodusänderung verboten
|
||||
GAMEMODE_UNKNOWN = §cUnbekannter Spielmodus {0}
|
||||
GAMEMODE_HELP = §8/§7gm §8[§eSpielmodus§8]
|
||||
|
||||
LOCKSCHEM_HELP=§8/§7lockschem §8[§eTeam§8]
|
||||
UNKNOWN_TEAM=§cDieses Team existiert nicht
|
||||
LOCKSCHEM_LOCKED=§7Schematic gesperrt
|
||||
LOCKSCHEM_LOCKED_BY=§cDie Schematic wurde von §e{0} §cgesperrt
|
||||
LOCKSCHEM_HELP = §8/§7lockschem §8[§eTeam§8]
|
||||
UNKNOWN_TEAM = §cDieses Team existiert nicht
|
||||
LOCKSCHEM_LOCKED = §7Schematic gesperrt
|
||||
LOCKSCHEM_LOCKED_BY = §cDie Schematic wurde von §e{0} §cgesperrt
|
||||
|
||||
REMOVE_HELP=§8/§eremove §8[§eSpieler§8]
|
||||
REMOVE_HELP = §8/§eremove §8[§eSpieler§8]
|
||||
|
||||
NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter
|
||||
WIN_HELP=§8/§7win §8[§eTeam §8oder §etie§8]
|
||||
NOT_FIGHTLEADER = §cDu bist nicht Kampfleiter
|
||||
WIN_HELP = §8/§7win §8[§eTeam §8oder §etie§8]
|
||||
|
||||
TPSWARP_HELP=§8/§7tpswarp §8[§eTicks pro Sekunde§8]
|
||||
TPSWARP_SET=§7TPS auf §e{0} §7gesetzt
|
||||
TPSWARP_HELP = §8/§7tpswarp §8[§eTicks pro Sekunde§8]
|
||||
TPSWARP_SET = §7TPS auf §e{0} §7gesetzt
|
||||
|
||||
|
||||
# GUI
|
||||
STATE_TITLE=Kampfstatus
|
||||
STATE_PRE_LEADER_SETUP=§7Teamleaderwartephase
|
||||
STATE_PRE_SCHEM_SETUP=§7Schemauswahlphase
|
||||
STATE_POST_SCHEM_SETUP=§7Vorbereitungsphase
|
||||
STATE_PRE_RUNNING=§eKitausgabe
|
||||
STATE_RUNNING=§eKampfphase
|
||||
STATE_SPECTATE_WIN=§7Sieg {0}
|
||||
STATE_SPECTATE_TIE=§7Unentschieden
|
||||
STATE_TITLE = Kampfstatus
|
||||
STATE_PRE_LEADER_SETUP = §7Teamleaderwartephase
|
||||
STATE_PRE_SCHEM_SETUP = §7Schemauswahlphase
|
||||
STATE_POST_SCHEM_SETUP = §7Vorbereitungsphase
|
||||
STATE_PRE_RUNNING = §eKitausgabe
|
||||
STATE_RUNNING = §eKampfphase
|
||||
STATE_SPECTATE_WIN = §7Sieg {0}
|
||||
STATE_SPECTATE_TIE = §7Unentschieden
|
||||
|
||||
MANAGE_TITLE=Mitspieler verwalten
|
||||
MANAGE_LORE1=§eLinksklick§8: §eRauswurf
|
||||
MANAGE_LORE2=§eRechtsklick§8: §eBefördern
|
||||
MANAGE_TITLE = Mitspieler verwalten
|
||||
MANAGE_LORE1 = §eLinksklick§8: §eRauswurf
|
||||
MANAGE_LORE2 = §eRechtsklick§8: §eBefördern
|
||||
|
||||
KIT_SELECTION_TITLE=Kitauswahl
|
||||
KIT_NO_KITS=§cKeine Kits gefunden
|
||||
KIT_CREATE=§eNeues Kit
|
||||
KITNAME_TITLE=Kitname eingeben
|
||||
KITNAME_IN_USE=§cDieser Kitname wird bereits genutzt
|
||||
KIT_SEARCH=§eSuchen
|
||||
KITSEARCH_TITLE=Nach Kit suchen
|
||||
KIT_SELECTION_TITLE = Kitauswahl
|
||||
KIT_NO_KITS = §cKeine Kits gefunden
|
||||
KIT_CREATE = §eNeues Kit
|
||||
KITNAME_TITLE = Kitname eingeben
|
||||
KITNAME_IN_USE = §cDieser Kitname wird bereits genutzt
|
||||
KIT_SEARCH = §eSuchen
|
||||
KITSEARCH_TITLE = Nach Kit suchen
|
||||
|
||||
SCHEM_NO_ENEMY=§cKeine Schematicwahl ohne Gegner
|
||||
SCHEM_TITLE={0}-Auswahl
|
||||
SCHEM_DIRT=§eErdblock
|
||||
SCHEM_PUBLIC=§eÖffentliches {0}
|
||||
SCHEM_UNCHECKED=§eUngeprüftes {0}
|
||||
SCHEM_PRIVATE=§ePrivates {0}
|
||||
SCHEM_NO_PRIVATE=§7Kein privates {0} vorhanden
|
||||
SCHEM_PRIVATE_FORBIDDEN=§7Kein privates {0} erlaubt
|
||||
SCHEM_NO_ENEMY = §cKeine Schematicwahl ohne Gegner
|
||||
SCHEM_TITLE = {0}-Auswahl
|
||||
SCHEM_DIRT = §eErdblock
|
||||
SCHEM_PUBLIC = §eÖffentliches {0}
|
||||
SCHEM_UNCHECKED = §eUngeprüftes {0}
|
||||
SCHEM_PRIVATE = §ePrivates {0}
|
||||
SCHEM_NO_PRIVATE = §7Kein privates {0} vorhanden
|
||||
SCHEM_PRIVATE_FORBIDDEN = §7Kein privates {0} erlaubt
|
||||
|
||||
ADD_AI_TITLE=KI hinzufügen
|
||||
ADD_AI_TITLE = KI hinzufügen
|
||||
|
||||
|
||||
# Countdowns
|
||||
COUNTDOWN_MINUTES=§e{0} §7Minuten {1}
|
||||
COUNTDOWN_SECONDS=§e{0} §7Sekunden {1}
|
||||
COUNTDOWN_SECOND=§eEine §7Sekunde {1}
|
||||
COUNTDOWN_MINUTES = §e{0} §7Minuten {1}
|
||||
COUNTDOWN_SECONDS = §e{0} §7Sekunden {1}
|
||||
COUNTDOWN_SECOND = §eEine §7Sekunde {1}
|
||||
|
||||
ENTERN_COUNTDOWN=bis Entern erlaubt ist
|
||||
ENTERN_ALLOWED=§eEntern §7ist nun erlaubt
|
||||
ENTERN_COUNTDOWN = bis Entern erlaubt ist
|
||||
ENTERN_ALLOWED = §eEntern §7ist nun erlaubt
|
||||
|
||||
SHUTDOWN_COUNTDOWN=bis der Server gestoppt wird
|
||||
PRE_SCHEM_COUNTDOWN=bis eine Public-Schematic gewählt wird
|
||||
POST_SCHEM_COUNTDOWN=bis die Kits verteilt werden
|
||||
PRE_RUNNING_COUNTDOWN=bis die Arena freigegeben ist
|
||||
RUNNING_COUNTDOWN=bis der Kampf vorbei ist
|
||||
SPECTATE_COUNTDOWN=bis die Arena zurückgesetzt wird
|
||||
SHUTDOWN_COUNTDOWN = bis der Server gestoppt wird
|
||||
PRE_SCHEM_COUNTDOWN = bis eine Public-Schematic gewählt wird
|
||||
POST_SCHEM_COUNTDOWN = bis die Kits verteilt werden
|
||||
PRE_RUNNING_COUNTDOWN = bis die Arena freigegeben ist
|
||||
RUNNING_COUNTDOWN = bis der Kampf vorbei ist
|
||||
SPECTATE_COUNTDOWN = bis die Arena zurückgesetzt wird
|
||||
|
||||
|
||||
# Fight
|
||||
SCHEMATIC_UNLOADABLE=§cSchematic konnte nicht geladen werden
|
||||
SCHEMATIC_CHOSEN=§7{0} §e{1} §7gewählt
|
||||
SCHEMATIC_UNCHECKED=§7Team {0} §7hat eine §eungeprüfte §7Schematic gewählt§8!
|
||||
TEAM_READY=§aTeam bereit
|
||||
TEAM_NOT_READY=§c§mTeam bereit
|
||||
SKIP_READY=§aBeschleunigung zum nächsten Event
|
||||
SKIP_NOT_READY=§c§mBeschleunigung zum nächsten Event
|
||||
CHOOSE_KIT=§eKit wählen
|
||||
RESPAWN=§eRespawn
|
||||
MANAGE_PLAYERS=§cMitspieler verwalten
|
||||
CHOOSE_SCHEMATIC=§e{0} wählen
|
||||
SCHEMATIC_REQUIRED=§cZuerst muss eine Schematic gewählt sein
|
||||
ADD_AI=§eKI hinzufügen
|
||||
SCHEMATIC_UNLOADABLE = §cSchematic konnte nicht geladen werden
|
||||
SCHEMATIC_CHOSEN = §7{0} §e{1} §7gewählt
|
||||
SCHEMATIC_UNCHECKED = §7Team {0} §7hat eine §eungeprüfte §7Schematic gewählt§8!
|
||||
TEAM_READY = §aTeam bereit
|
||||
TEAM_NOT_READY = §c§mTeam bereit
|
||||
SKIP_READY = §aBeschleunigung zum nächsten Event
|
||||
SKIP_NOT_READY = §c§mBeschleunigung zum nächsten Event
|
||||
CHOOSE_KIT = §eKit wählen
|
||||
RESPAWN = §eRespawn
|
||||
MANAGE_PLAYERS = §cMitspieler verwalten
|
||||
CHOOSE_SCHEMATIC = §e{0} wählen
|
||||
SCHEMATIC_REQUIRED = §cZuerst muss eine Schematic gewählt sein
|
||||
ADD_AI = §eKI hinzufügen
|
||||
|
||||
KIT_PREVIEW_EDIT=§7Kit bearbeiten
|
||||
KIT_PREVIEW_CHOOSE=§aKit wählen
|
||||
KIT_PREVIEW_BACK=§cZurück
|
||||
KIT_PREVIEW_DELETE=§cKit löschen
|
||||
KIT_DELETION_CONFIRMATION=Kit wirklich löschen?
|
||||
KIT_DELETION_ABORT=§cAbbrechen
|
||||
KIT_DELETION_DELETE=§aLöschen
|
||||
KIT_PREVIEW_EDIT = §7Kit bearbeiten
|
||||
KIT_PREVIEW_CHOOSE = §aKit wählen
|
||||
KIT_PREVIEW_BACK = §cZurück
|
||||
KIT_PREVIEW_DELETE = §cKit löschen
|
||||
KIT_DELETION_CONFIRMATION = Kit wirklich löschen?
|
||||
KIT_DELETION_ABORT = §cAbbrechen
|
||||
KIT_DELETION_DELETE = §aLöschen
|
||||
|
||||
|
||||
# Listener
|
||||
NO_ARENA_LEAVING=§cDu darfst die Arena nicht verlassen
|
||||
CHECK_JOIN_DENIED=§cAuf diesem Server wird momentan eine Schematic geprüft!
|
||||
CHECK_COMMAND_LOCKED=§cDieser Befehl ist beim Prüfen gesperrt! Admin wird benachrichtigt.
|
||||
NO_BLOCK_BREAK=§cDu darfst hier derzeit keine Blöcke abbauen
|
||||
NO_BLOCK_PLACE=§cDu darfst hier derzeit keine Blöcke setzen
|
||||
NO_BOW_USAGE=§cDu darfst den Bogen erst nach Kampfbeginn nutzen
|
||||
NO_PARTICIPANT=§cDu bist kein Kampfteilnehmer
|
||||
NO_FRIENDLY_FIRE=§cDu darfst deinen Teamkollegen keinen Schaden zufügen
|
||||
NO_TNT_PLACE=§cDu darfst kein TNT setzen
|
||||
NO_TELEPORT=§cDu darfst diese Teleportfunktion nicht benutzen
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE=§eInventar zum Anpassen des Kits öffnen
|
||||
NO_ENTERN=§cDu darfst nicht entern
|
||||
NO_TEAMAREA=§cDu darfst nicht zu den Teams
|
||||
PREPARE_SCHEM_DELETED=§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.
|
||||
PREPARE_SCHEM_EXISTS=§cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen.
|
||||
PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
||||
PREPARE_FAILED_SAVING=§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.
|
||||
PREPARE_SENT_IN=§aDie Schematic wird nun zeitnah von einem Teammitglied überprüft
|
||||
PISTON_PUSHED_OUTSIDE=§cEin Kolben hat einen Block aus dem erlaubten Bereich geschoben!
|
||||
NO_ARENA_LEAVING = §cDu darfst die Arena nicht verlassen
|
||||
CHECK_JOIN_DENIED = §cAuf diesem Server wird momentan eine Schematic geprüft!
|
||||
CHECK_COMMAND_LOCKED = §cDieser Befehl ist beim Prüfen gesperrt! Admin wird benachrichtigt.
|
||||
NO_BLOCK_BREAK = §cDu darfst hier derzeit keine Blöcke abbauen
|
||||
NO_BLOCK_PLACE = §cDu darfst hier derzeit keine Blöcke setzen
|
||||
NO_BOW_USAGE = §cDu darfst den Bogen erst nach Kampfbeginn nutzen
|
||||
NO_PARTICIPANT = §cDu bist kein Kampfteilnehmer
|
||||
NO_FRIENDLY_FIRE = §cDu darfst deinen Teamkollegen keinen Schaden zufügen
|
||||
NO_TNT_PLACE = §cDu darfst kein TNT setzen
|
||||
NO_TELEPORT = §cDu darfst diese Teleportfunktion nicht benutzen
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE = §eInventar zum Anpassen des Kits öffnen
|
||||
NO_ENTERN = §cDu darfst nicht entern
|
||||
NO_TEAMAREA = §cDu darfst nicht zu den Teams
|
||||
PREPARE_SCHEM_DELETED = §cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.
|
||||
PREPARE_SCHEM_EXISTS = §cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen.
|
||||
PREPARE_ACTIVE_PISTON = §cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
||||
PREPARE_FAILED_SAVING = §cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.
|
||||
PREPARE_SENT_IN = §aDie Schematic wird nun zeitnah von einem Teammitglied überprüft
|
||||
PISTON_PUSHED_OUTSIDE = §cEin Kolben hat einen Block aus dem erlaubten Bereich geschoben!
|
||||
|
||||
|
||||
# Replay
|
||||
REPLAY_ENDS=§cReplay beendet
|
||||
REPLAY_ENDS = §cReplay beendet
|
||||
|
||||
|
||||
# States
|
||||
COMMAND_CURRENTLY_UNAVAILABLE=§cDieser Befehl ist zu diesem Kampfzeitpunkt nicht verfügbar
|
||||
COMMAND_CURRENTLY_UNAVAILABLE = §cDieser Befehl ist zu diesem Kampfzeitpunkt nicht verfügbar
|
||||
|
||||
|
||||
# Utils
|
||||
UI_PRE_RUNNING=§7Kits verteilt
|
||||
UI_RUNNING=§aArena freigegeben
|
||||
UI_SKIP=§7Sprung zum nächsten Ereignis
|
||||
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH={0}{1} §7ist gestorben
|
||||
UI_PLAYER_LEAVE={0}{1} §7hat den Kampf verlassen
|
||||
UI_WIN={0}Sieg {1}
|
||||
UI_DRAW=§7Unentschieden
|
||||
UI_PRE_RUNNING = §7Kits verteilt
|
||||
UI_RUNNING = §aArena freigegeben
|
||||
UI_SKIP = §7Sprung zum nächsten Ereignis
|
||||
UI_LEADER_JOINS = §a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH = {0}{1} §7ist gestorben
|
||||
UI_PLAYER_LEAVE = {0}{1} §7hat den Kampf verlassen
|
||||
UI_WIN = {0}Sieg {1}
|
||||
UI_DRAW = §7Unentschieden
|
||||
|
||||
BAR_PRE_LEADER=§7Warten auf Teamleader
|
||||
BAR_PRE_LEADER = §7Warten auf Teamleader
|
||||
BAR_PRE_SCHEM = {1} §7Schemauswahl {0} {2}
|
||||
BAR_PREPARE = {1} {3} §7Vorbereitung {0} {4} {2}
|
||||
BAR_PRE_RUNNING = {1} {3} §7Kampfbeginn in {0} {4} {2}
|
||||
BAR_TIE = {1} §7Unentschieden {0} {2}
|
||||
BAR_WIN = {1} §7Sieg {3} {0} {2}
|
||||
BAR_POINTS={0} §8Punkte
|
||||
BAR_POINTS_OF={0}§8/§7{1} §8Punkte
|
||||
BAR_PERCENT={0}§8%
|
||||
BAR_CANNONS={0} §8Kanonen
|
||||
BAR_WATER={0} §8Wasser
|
||||
BAR_POINTS = {0} §8Punkte
|
||||
BAR_POINTS_OF = {0}§8/§7{1} §8Punkte
|
||||
BAR_PERCENT = {0}§8%
|
||||
BAR_CANNONS = {0} §8Kanonen
|
||||
BAR_WATER = {0} §8Wasser
|
||||
|
||||
|
||||
# Winconditions
|
||||
HELLS_BELLS_COUNTDOWN=bis die Bomben fallen
|
||||
HELLS_BELLS_START_1=§c!!Achtung!! Bomber im Anflug, noch ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_2=§cBomber im Anflug, ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_3=§cBomber auf dem Radar gesichtet, geschätzte Ankunftszeit: eine Minute.
|
||||
HELLS_BELLS_START_4=§cUnbekanntes Flugobjekt gesichtet, trifft in ca. einer Minute ein.
|
||||
HELLS_BELLS_START_5=§cFlugobjekt gesichtet. Ankunft in ca. einer Minute.
|
||||
HELLS_BELLS_START_6=§cBomber erschienen, Ankunft ca. eine Minute.
|
||||
HELLS_BELLS_SWAP_1=§aDie Bomben fallen nun schneller.
|
||||
HELLS_BELLS_SWAP_2=§aMehr Bomber im Anflug.
|
||||
HELLS_BELLS_SWAP_3=§aZusätzliche Bomber gesichtet.
|
||||
HELLS_BELLS_SWAP_4=§aDas Bombardement scheint sich zu erhöhen.
|
||||
HELLS_BELLS_COUNTDOWN = bis die Bomben fallen
|
||||
HELLS_BELLS_START_1 = §c!!Achtung!! Bomber im Anflug, noch ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_2 = §cBomber im Anflug, ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_3 = §cBomber auf dem Radar gesichtet, geschätzte Ankunftszeit: eine Minute.
|
||||
HELLS_BELLS_START_4 = §cUnbekanntes Flugobjekt gesichtet, trifft in ca. einer Minute ein.
|
||||
HELLS_BELLS_START_5 = §cFlugobjekt gesichtet. Ankunft in ca. einer Minute.
|
||||
HELLS_BELLS_START_6 = §cBomber erschienen, Ankunft ca. eine Minute.
|
||||
HELLS_BELLS_SWAP_1 = §aDie Bomben fallen nun schneller.
|
||||
HELLS_BELLS_SWAP_2 = §aMehr Bomber im Anflug.
|
||||
HELLS_BELLS_SWAP_3 = §aZusätzliche Bomber gesichtet.
|
||||
HELLS_BELLS_SWAP_4 = §aDas Bombardement scheint sich zu erhöhen.
|
||||
|
||||
METEOR_COUNTDOWN=bis es Meteore regnet
|
||||
METEOR_START_1=§cEin Meteorschauer wurden am Himmel entdeckt
|
||||
METEOR_START_2=§cSternschnuppen sind diesen Fight 100% wahrscheinlicher
|
||||
METEOR_START_3=§cEs wurden Meteoriten am Himmel entdeckt, begeben sie sich umgehend in Sicherheit!
|
||||
METEOR_START_4=§cDer Untergang steht nahe! Die Meteoriten werden uns in etwa einer Minute treffen.
|
||||
METEOR_START_5=§fNEWS §cHeute Nachmittag wird es größere Meteoriten Schauer geben!
|
||||
METEOR_START_6=§cNoch fliegende Airships sind dem Absturz geweiht.
|
||||
METEOR_SWAP_1=§aEs hört nicht auf, die Meteoriten scheinen mehr zu werden.
|
||||
METEOR_SWAP_2=§aDas war erst der Anfang, die Meteoriten kommen immer schneller und machen mehr Schaden.
|
||||
METEOR_SWAP_3=§aEs scheint als würde es nicht aufhören, die Meteoriten kommen nur schneller!
|
||||
METEOR_SWAP_4=§aEin weiterer Schauer ist entdeckt worden, begebt euch in Sicherheit!
|
||||
METEOR_COUNTDOWN = bis es Meteore regnet
|
||||
METEOR_START_1 = §cEin Meteorschauer wurden am Himmel entdeckt
|
||||
METEOR_START_2 = §cSternschnuppen sind diesen Fight 100% wahrscheinlicher
|
||||
METEOR_START_3 = §cEs wurden Meteoriten am Himmel entdeckt, begeben sie sich umgehend in Sicherheit!
|
||||
METEOR_START_4 = §cDer Untergang steht nahe! Die Meteoriten werden uns in etwa einer Minute treffen.
|
||||
METEOR_START_5 = §fNEWS §cHeute Nachmittag wird es größere Meteoriten Schauer geben!
|
||||
METEOR_START_6 = §cNoch fliegende Airships sind dem Absturz geweiht.
|
||||
METEOR_SWAP_1 = §aEs hört nicht auf, die Meteoriten scheinen mehr zu werden.
|
||||
METEOR_SWAP_2 = §aDas war erst der Anfang, die Meteoriten kommen immer schneller und machen mehr Schaden.
|
||||
METEOR_SWAP_3 = §aEs scheint als würde es nicht aufhören, die Meteoriten kommen nur schneller!
|
||||
METEOR_SWAP_4 = §aEin weiterer Schauer ist entdeckt worden, begebt euch in Sicherheit!
|
||||
|
||||
TECHKO_COUNTDOWN=bis {0} §7einen Schuss abgegeben haben muss
|
||||
TECHKO_COUNTDOWN = bis {0} §7einen Schuss abgegeben haben muss
|
||||
|
||||
WIN_FIGHTLEADER=§7Kampfleiterentscheidung
|
||||
WIN_PERCENT={0} §7zu beschädigt
|
||||
WIN_OFFLINE_BOTH=§7Beide Teams offline
|
||||
WIN_OFFLINE={0} §7offline
|
||||
WIN_ALL_DEAD={0}Alle Spieler kampfunfähig
|
||||
WIN_LEADER_DEAD={0} kampfunfähig
|
||||
WIN_TIME_OVER=§7Zeit abgelaufen
|
||||
WIN_MORE_HEALTH={0} mit mehr verbleibenden Leben
|
||||
WIN_LESS_DAMAGE={0} §7weniger beschädigt
|
||||
WIN_POINTS={0} hat mehr Punkte
|
||||
WIN_POINTS_EQUAL=§7Gleicher Punktestand
|
||||
WIN_TECHKO={0} §7ist Tech K.O.
|
||||
WIN_IMPOSTER_DEAD={0} §7 hat den Imposter getötet
|
||||
WIN_CREWMATE_DEAD={0} §7 hat alle Kameraden getötet
|
||||
WIN_FIGHTLEADER = §7Kampfleiterentscheidung
|
||||
WIN_PERCENT = {0} §7zu beschädigt
|
||||
WIN_OFFLINE_BOTH = §7Beide Teams offline
|
||||
WIN_OFFLINE = {0} §7offline
|
||||
WIN_ALL_DEAD = {0}Alle Spieler kampfunfähig
|
||||
WIN_LEADER_DEAD = {0} kampfunfähig
|
||||
WIN_TIME_OVER = §7Zeit abgelaufen
|
||||
WIN_MORE_HEALTH = {0} mit mehr verbleibenden Leben
|
||||
WIN_LESS_DAMAGE = {0} §7weniger beschädigt
|
||||
WIN_POINTS = {0} hat mehr Punkte
|
||||
WIN_POINTS_EQUAL = §7Gleicher Punktestand
|
||||
WIN_TECHKO = {0} §7ist Tech K.O.
|
||||
WIN_IMPOSTER_DEAD = {0} §7 hat den Imposter getötet
|
||||
WIN_CREWMATE_DEAD = {0} §7 hat alle Kameraden getötet
|
||||
|
||||
AMONG_US_IMPOSTER_MESSAGE = §4Du bist ein Imposter§8! §7Du musst alle Kameraden töten, um zu gewinnen.
|
||||
AMONG_US_IMPOSTER_AMONG_MESSAGE = §4Es ist ein Imposter unter uns§8! §7Tötet ihn, um das Spiel zu gewinnen!
|
||||
|
||||
# Invites
|
||||
JOIN_REQUEST=§7Teambeitritt anfragen
|
||||
JOIN_REQUEST_TITLE=Teambeitritt anfragen
|
||||
JOIN_REQUEST_ALREADY=§cDu hast bereits ein Team um Beitritt angefragt
|
||||
JOIN_REQUEST_TEAM={0} §7beitreten
|
||||
JOIN_REQUEST_CONFIRMATION=§7Teambeitritt angefragt
|
||||
JOIN_REQUEST_NOTIFICATION=§e{0} §7möchte Team {1} §7beitreten§8. §7Akzeptiere oder lehne ab mit §8/§erequests
|
||||
JOIN_REQUEST = §7Teambeitritt anfragen
|
||||
JOIN_REQUEST_TITLE = Teambeitritt anfragen
|
||||
JOIN_REQUEST_ALREADY = §cDu hast bereits ein Team um Beitritt angefragt
|
||||
JOIN_REQUEST_TEAM = {0} §7beitreten
|
||||
JOIN_REQUEST_CONFIRMATION = §7Teambeitritt angefragt
|
||||
JOIN_REQUEST_NOTIFICATION = §e{0} §7möchte Team {1} §7beitreten§8. §7Akzeptiere oder lehne ab mit §8/§erequests
|
||||
|
||||
REQUESTS=§7Offene Beitrittsanfragen
|
||||
REQUESTS_TITLE=Offene Beitrittsanfragen
|
||||
REQUEST_DECLINED=§cBeitritt von {0} abgelehnt
|
||||
REQUEST_YOUR_DECLINED=§cDeine Betrittsanfrage wurde abgelehnt
|
||||
REQUESTS_LEFT_CLICK=§eLinksklick §7um §eanzunehmen§8!
|
||||
REQUESTS_RIGHT_CLICK=§eRechtsklick §7um §eabzulehnen§8!
|
||||
REQUESTS = §7Offene Beitrittsanfragen
|
||||
REQUESTS_TITLE = Offene Beitrittsanfragen
|
||||
REQUEST_DECLINED = §cBeitritt von {0} abgelehnt
|
||||
REQUEST_YOUR_DECLINED = §cDeine Betrittsanfrage wurde abgelehnt
|
||||
REQUESTS_LEFT_CLICK = §eLinksklick §7um §eanzunehmen§8!
|
||||
REQUESTS_RIGHT_CLICK = §eRechtsklick §7um §eabzulehnen§8!
|
||||
|
||||
NO_JOIN_REQUEST=§cDer Spieler hat noch keinen Beitritt angefragt
|
||||
NO_CONFIRMATION=§cKeine Zustimmung nötig
|
||||
NO_JOIN_REQUEST = §cDer Spieler hat noch keinen Beitritt angefragt
|
||||
NO_CONFIRMATION = §cKeine Zustimmung nötig
|
||||
|
||||
@@ -65,6 +65,7 @@ public abstract class AI {
|
||||
public static final double INTERACTION_RANGE = 5.0;
|
||||
|
||||
private static final Map<UUID, AI> ais = new HashMap<>();
|
||||
|
||||
public static void printPos() {
|
||||
ais.values().forEach(ai -> ai.chat(ai.entity.isValid() + " " + ai.entity.isDead() + " " + ai.entity.getLocation()));
|
||||
}
|
||||
@@ -92,17 +93,19 @@ public abstract class AI {
|
||||
|
||||
entity = (LivingEntity) Config.world.spawnEntity(Config.SpecSpawn, EntityType.VILLAGER);
|
||||
entity.setCustomName(user.getUserName());
|
||||
((Villager)entity).setAware(false);
|
||||
((Villager) entity).setAware(false);
|
||||
|
||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::run, 1, 1);
|
||||
ais.put(entity.getUniqueId(), this);
|
||||
team.addMember(entity, user);
|
||||
|
||||
if(FightState.Schem.contains(FightState.getFightState()))
|
||||
if (FightState.Schem.contains(FightState.getFightState())) {
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> schematic(team.getClipboard()));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract SchematicNode chooseSchematic();
|
||||
|
||||
public abstract void schematic(Clipboard clipboard);
|
||||
|
||||
public boolean acceptJoinRequest(JoinRequest.Enquirer enquirer, FightTeam team) {
|
||||
@@ -112,20 +115,13 @@ public abstract class AI {
|
||||
protected abstract void plan();
|
||||
|
||||
public void stop() {
|
||||
if(!entity.isDead())
|
||||
entity.remove();
|
||||
|
||||
if(!task.isCancelled())
|
||||
task.cancel();
|
||||
if (!entity.isDead()) entity.remove();
|
||||
if (!task.isCancelled()) task.cancel();
|
||||
}
|
||||
|
||||
public void setReady() {
|
||||
if(FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
return;
|
||||
|
||||
if(team.getLeader().getEntity() != entity)
|
||||
return;
|
||||
|
||||
if (FightState.getFightState() != FightState.POST_SCHEM_SETUP) return;
|
||||
if (team.getLeader().getEntity() != entity) return;
|
||||
team.setReady(true);
|
||||
}
|
||||
|
||||
@@ -137,7 +133,7 @@ public abstract class AI {
|
||||
public Vector getPosition() {
|
||||
Location location = entity.getLocation();
|
||||
Region extend = team.getExtendRegion();
|
||||
if(Fight.getUnrotated() == team)
|
||||
if (Fight.getUnrotated() == team)
|
||||
return new Vector(
|
||||
location.getX() - extend.getMinX(),
|
||||
location.getY() - team.getSchemRegion().getMinY(),
|
||||
@@ -165,17 +161,16 @@ public abstract class AI {
|
||||
queue.add(new Action(1) {
|
||||
@Override
|
||||
public void run() {
|
||||
if(FightState.getFightState() != FightState.RUNNING)
|
||||
return;
|
||||
if (FightState.getFightState() != FightState.RUNNING) return;
|
||||
|
||||
Location location = translate(pos);
|
||||
if(interactionDistanceViolation(location)) {
|
||||
if (interactionDistanceViolation(location)) {
|
||||
chat("InteractionDistanceViolation: setTNT");
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = location.getBlock();
|
||||
if(block.getType() == Material.AIR)
|
||||
if (block.getType() == Material.AIR)
|
||||
block.setType(Material.TNT);
|
||||
}
|
||||
});
|
||||
@@ -186,7 +181,7 @@ public abstract class AI {
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = translate(pos);
|
||||
if(interactionDistanceViolation(location)) {
|
||||
if (interactionDistanceViolation(location)) {
|
||||
chat("InteractionDistanceViolation: interact");
|
||||
return;
|
||||
}
|
||||
@@ -198,22 +193,21 @@ public abstract class AI {
|
||||
|
||||
public void interact(Vector pos, int n) {
|
||||
queue.add(new Action(1) {
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = translate(pos);
|
||||
if (interactionDistanceViolation(location))
|
||||
return;
|
||||
Block block = location.getBlock();
|
||||
BlockData data = block.getBlockData();
|
||||
if (data instanceof Repeater) {
|
||||
Repeater repeater = (Repeater) data;
|
||||
repeater.setDelay(n);
|
||||
} else if (data instanceof Lectern) {
|
||||
Lectern lectern = (Lectern) data;
|
||||
lectern.setPage(n);
|
||||
}
|
||||
block.setBlockData(data);
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = translate(pos);
|
||||
if (interactionDistanceViolation(location)) return;
|
||||
Block block = location.getBlock();
|
||||
BlockData data = block.getBlockData();
|
||||
if (data instanceof Repeater) {
|
||||
Repeater repeater = (Repeater) data;
|
||||
repeater.setDelay(n);
|
||||
} else if (data instanceof Lectern) {
|
||||
Lectern lectern = (Lectern) data;
|
||||
lectern.setPage(n);
|
||||
}
|
||||
block.setBlockData(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -222,22 +216,23 @@ public abstract class AI {
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = entity.getLocation();
|
||||
if(!entity.isOnGround() && location.getBlock().getType() != Material.LADDER) {
|
||||
if (!entity.isOnGround() && location.getBlock().getType() != Material.LADDER) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, "Entity falling");
|
||||
return;
|
||||
}
|
||||
|
||||
Location target = translate(pos);
|
||||
if(Math.abs(location.getX() - target.getX()) > 1.0 || Math.abs(location.getY() - target.getY()) > 1.5 || Math.abs(location.getZ() - target.getZ()) > 1.0) {
|
||||
if (Math.abs(location.getX() - target.getX()) > 1.0 || Math.abs(location.getY() - target.getY()) > 1.5 || Math.abs(location.getZ() - target.getZ()) > 1.0) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> entity.getName() + ": Overdistance movement " + location.toVector() + " " + target.toVector());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!team.getFightPlayer(entity).canEntern() && !team.getExtendRegion().inRegion(target))
|
||||
if (!team.getFightPlayer(entity).canEntern() && !team.getExtendRegion().inRegion(target))
|
||||
return;
|
||||
|
||||
if(!entity.teleport(target, PlayerTeleportEvent.TeleportCause.PLUGIN))
|
||||
if (!entity.teleport(target, PlayerTeleportEvent.TeleportCause.PLUGIN)) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, "Entity not teleported: " + entity.isValid());
|
||||
}
|
||||
|
||||
GlobalRecorder.getInstance().entityMoves(entity);
|
||||
}
|
||||
@@ -265,13 +260,11 @@ public abstract class AI {
|
||||
Powerable powerable = (Powerable) data;
|
||||
boolean isPowered = powerable.isPowered();
|
||||
|
||||
if(type.name().endsWith("BUTTON")) {
|
||||
if(isPowered)
|
||||
return;
|
||||
if (type.name().endsWith("BUTTON")) {
|
||||
if (isPowered) return;
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
if(!block.getType().name().endsWith("BUTTON"))
|
||||
return;
|
||||
if (!block.getType().name().endsWith("BUTTON")) return;
|
||||
|
||||
powerable.setPowered(false);
|
||||
block.setBlockData(powerable);
|
||||
@@ -282,7 +275,7 @@ public abstract class AI {
|
||||
powerable.setPowered(!isPowered);
|
||||
}
|
||||
block.setBlockData(data);
|
||||
if(data instanceof Switch) {
|
||||
if (data instanceof Switch) {
|
||||
updateButton(block);
|
||||
}
|
||||
}
|
||||
@@ -306,7 +299,7 @@ public abstract class AI {
|
||||
}
|
||||
|
||||
private void run() {
|
||||
if(queue.isEmpty()) {
|
||||
if (queue.isEmpty()) {
|
||||
try {
|
||||
plan();
|
||||
} catch (Throwable t) {
|
||||
@@ -315,34 +308,37 @@ public abstract class AI {
|
||||
}
|
||||
}
|
||||
|
||||
if(!queue.isEmpty() && --queue.peek().delay == 0)
|
||||
if (!queue.isEmpty() && --queue.peek().delay == 0)
|
||||
queue.poll().run();
|
||||
}
|
||||
|
||||
public Location translate(Vector pos) {
|
||||
Region extend = team.getExtendRegion();
|
||||
if(Fight.getUnrotated() == team)
|
||||
if (Fight.getUnrotated() == team) {
|
||||
return new Location(
|
||||
Config.world,
|
||||
pos.getX() + extend.getMinX(),
|
||||
pos.getY() + team.getSchemRegion().getMinY(),
|
||||
pos.getZ() + extend.getMinZ()
|
||||
);
|
||||
else
|
||||
} else {
|
||||
return new Location(
|
||||
Config.world,
|
||||
extend.getMaxX() - pos.getX(),
|
||||
pos.getY() + team.getSchemRegion().getMinY(),
|
||||
extend.getMaxZ() - pos.getZ()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Action {
|
||||
private int delay;
|
||||
|
||||
public Action(int delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public void run() {}
|
||||
public void run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ public class DummyAI extends AI {
|
||||
|
||||
@Override
|
||||
protected void plan() {
|
||||
if(FightState.getFightState() == FightState.POST_SCHEM_SETUP)
|
||||
setReady();
|
||||
if (FightState.getFightState() == FightState.POST_SCHEM_SETUP) setReady();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,14 +42,13 @@ public class AkCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if(!player.isOp())
|
||||
return false;
|
||||
if (!player.isOp()) return false;
|
||||
|
||||
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.ADMINISTRATION) && Core.getInstance() != FightSystem.getPlugin()){
|
||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.ADMINISTRATION) && Core.getInstance() != FightSystem.getPlugin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,95 +42,89 @@ public class Commands {
|
||||
((CraftServer) Bukkit.getServer()).getCommandMap().register("FightSystem", cmd);
|
||||
}
|
||||
|
||||
private static void errNoTeam(Player p){
|
||||
private static void errNoTeam(Player p) {
|
||||
FightSystem.getMessage().sendPrefixless("NO_TEAM", p, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
static boolean checkSetup(Player p){
|
||||
if(!FightState.setup()){
|
||||
static boolean checkSetup(Player p) {
|
||||
if (!FightState.setup()) {
|
||||
FightSystem.getMessage().sendPrefixless("FIGHT_ALREADY_STARTED", p, ChatMessageType.ACTION_BAR);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static FightPlayer checkGetPlayer(Player p){
|
||||
private static FightPlayer checkGetPlayer(Player p) {
|
||||
FightPlayer fightPlayer = Fight.getFightPlayer(p);
|
||||
if(fightPlayer == null){
|
||||
if (fightPlayer == null) {
|
||||
errNoTeam(p);
|
||||
}
|
||||
return fightPlayer;
|
||||
}
|
||||
|
||||
public static FightPlayer checkGetLeader(Player p){
|
||||
public static FightPlayer checkGetLeader(Player p) {
|
||||
FightPlayer fightPlayer = checkGetPlayer(p);
|
||||
if(fightPlayer != null && !fightPlayer.isLeader()){
|
||||
if (fightPlayer != null && !fightPlayer.isLeader()) {
|
||||
FightSystem.getMessage().sendPrefixless("NOT_LEADER", p, ChatMessageType.ACTION_BAR);
|
||||
fightPlayer = null;
|
||||
}
|
||||
return fightPlayer;
|
||||
}
|
||||
|
||||
public static FightTeam checkGetTeam(Player p){
|
||||
public static FightTeam checkGetTeam(Player p) {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if(fightTeam == null){
|
||||
if (fightTeam == null) {
|
||||
errNoTeam(p);
|
||||
}
|
||||
return fightTeam;
|
||||
}
|
||||
|
||||
private static Player checkGetPlayer(Player p, String t){
|
||||
private static Player checkGetPlayer(Player p, String t) {
|
||||
Player target = Bukkit.getPlayer(t);
|
||||
if(target == null) {
|
||||
if (target == null) {
|
||||
FightSystem.getMessage().sendPrefixless("PLAYER_UNAVAILABLE", p, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
static void toggleReady(Player p){
|
||||
static void toggleReady(Player p) {
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null || checkGetLeader(p) == null)
|
||||
return;
|
||||
if (fightTeam == null || checkGetLeader(p) == null) return;
|
||||
|
||||
fightTeam.setReady(!fightTeam.isReady());
|
||||
}
|
||||
|
||||
static void toggleSkip(Player p){
|
||||
static void toggleSkip(Player p) {
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null || checkGetLeader(p) == null)
|
||||
return;
|
||||
if (fightTeam == null || checkGetLeader(p) == null) return;
|
||||
|
||||
fightTeam.skip();
|
||||
}
|
||||
|
||||
static void leaveTeam(Player p){
|
||||
if(checkSetup(p))
|
||||
static void leaveTeam(Player p) {
|
||||
if (checkSetup(p))
|
||||
return;
|
||||
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if (fightTeam == null) return;
|
||||
|
||||
fightTeam.removePlayer(p);
|
||||
}
|
||||
|
||||
static void kick(Player p, String kicked){
|
||||
if(checkSetup(p))
|
||||
static void kick(Player p, String kicked) {
|
||||
if (checkSetup(p))
|
||||
return;
|
||||
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if (fightTeam == null) return;
|
||||
|
||||
FightPlayer fightPlayer = checkGetLeader(p);
|
||||
if(fightPlayer == null)
|
||||
return;
|
||||
if (fightPlayer == null) return;
|
||||
|
||||
Player target = checkGetPlayer(p, kicked);
|
||||
if(target == null)
|
||||
return;
|
||||
if (target == null) return;
|
||||
|
||||
if(!fightTeam.isPlayerInTeam(target)){
|
||||
if (!fightTeam.isPlayerInTeam(target)) {
|
||||
FightSystem.getMessage().sendPrefixless("NOT_IN_TEAM", p, ChatMessageType.ACTION_BAR, target.getName());
|
||||
return;
|
||||
}
|
||||
@@ -138,26 +132,24 @@ public class Commands {
|
||||
fightTeam.removePlayer(target);
|
||||
}
|
||||
|
||||
public static void kit(Player p, String kitName){
|
||||
if(checkSetup(p))
|
||||
return;
|
||||
public static void kit(Player p, String kitName) {
|
||||
if (checkSetup(p)) return;
|
||||
|
||||
FightPlayer fightPlayer = checkGetPlayer(p);
|
||||
if(fightPlayer == null)
|
||||
return;
|
||||
if (fightPlayer == null) return;
|
||||
|
||||
Kit k = null;
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
PersonalKit kit = PersonalKit.get(SteamwarUser.get(p.getUniqueId()).getId(), Config.GameModeConfig.Schematic.Type.toDB(), kitName);
|
||||
if(kit != null){
|
||||
if (kit != null) {
|
||||
kit.setInUse();
|
||||
k = new Kit(kit);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
k = Kit.getKitByName(kitName);
|
||||
}
|
||||
|
||||
if(k == null || !k.canUseKit(fightPlayer.isLeader())){
|
||||
if (k == null || !k.canUseKit(fightPlayer.isLeader())) {
|
||||
FightSystem.getMessage().sendPrefixless("KIT_UNAVAILABLE", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GUI {
|
||||
private GUI(){}
|
||||
private GUI() {
|
||||
}
|
||||
|
||||
private static final Message msg = FightSystem.getMessage();
|
||||
|
||||
@@ -55,38 +56,40 @@ public class GUI {
|
||||
inv.setItem(pos, ColorConverter.chat2dye(team.getColor()), msg.parse("JOIN_REQUEST_TEAM", p, team.getColor() + name), click -> {
|
||||
p.closeInventory();
|
||||
|
||||
if(ArenaMode.ManualTeams.contains(Config.mode) && team.canbeLeader(p))
|
||||
if (ArenaMode.ManualTeams.contains(Config.mode) && team.canbeLeader(p)) {
|
||||
team.addMember(p);
|
||||
else
|
||||
} else {
|
||||
JoinRequest.forPlayer(p, team);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void joinRequest(Player p) {
|
||||
if(JoinRequest.get(p) != null) {
|
||||
if (JoinRequest.get(p) != null) {
|
||||
msg.sendPrefixless("JOIN_REQUEST_ALREADY", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
|
||||
SWInventory inv = new SWInventory(p, 9, msg.parse("JOIN_REQUEST_TITLE", p));
|
||||
FightTeam team = Fight.getPlayerTeam(p);
|
||||
if(team != Fight.getRedTeam())
|
||||
if (team != Fight.getRedTeam()) {
|
||||
addTeamRequest(p, inv, team == null ? 0 : 4, Fight.getBlueTeam());
|
||||
if(team != Fight.getBlueTeam())
|
||||
}
|
||||
if (team != Fight.getBlueTeam()) {
|
||||
addTeamRequest(p, inv, team == null ? 8 : 4, Fight.getRedTeam());
|
||||
}
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void state(Player p){
|
||||
public static void state(Player p) {
|
||||
SWInventory inv = new SWInventory(p, 9, msg.parse("STATE_TITLE", p));
|
||||
int i = 0;
|
||||
for(FightState state : FightState.values()) {
|
||||
if(state == FightState.SPECTATE)
|
||||
continue;
|
||||
for (FightState state : FightState.values()) {
|
||||
if (state == FightState.SPECTATE) continue;
|
||||
|
||||
inv.setItem(i++, Material.GLASS, msg.parse("STATE_" + state.name(), p), click -> FightState.setFightState(state));
|
||||
}
|
||||
for(FightTeam team : Fight.teams()) {
|
||||
for (FightTeam team : Fight.teams()) {
|
||||
inv.setItem(i++, Material.GLASS, msg.parse("STATE_SPECTATE_WIN", p, team.getColoredName()), click -> FightSystem.setSpectateState(team, "operator", "WIN_FIGHTLEADER"));
|
||||
}
|
||||
inv.setItem(i, Material.GLASS, msg.parse("STATE_SPECTATE_TIE", p), click -> FightSystem.setSpectateState(null, "operator", "WIN_FIGHTLEADER"));
|
||||
@@ -100,7 +103,7 @@ public class GUI {
|
||||
AIManager.availableAIs().stream().map(manager -> new SWListInv.SWListEntry<>(new SWItem(manager.getIcon(), manager.name()), manager)).collect(Collectors.toList()),
|
||||
(click, manager) -> {
|
||||
FightTeam team = Fight.getPlayerTeam(p);
|
||||
if(FightState.PreLeaderSetup.contains(FightState.getFightState())) {
|
||||
if (FightState.PreLeaderSetup.contains(FightState.getFightState())) {
|
||||
manager.join(Fight.getOpposite(team));
|
||||
} else {
|
||||
JoinRequest.forAI(manager, team);
|
||||
@@ -112,7 +115,7 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void chooseJoinRequests(Player p){
|
||||
public static void chooseJoinRequests(Player p) {
|
||||
List<SWListInv.SWListEntry<JoinRequest>> players = JoinRequest.openRequests(p, Fight.getPlayerTeam(p));
|
||||
SWListInv<JoinRequest> inv = new SWListInv<>(p, msg.parse("REQUESTS_TITLE", p), players, (ClickType click, JoinRequest request) -> {
|
||||
p.closeInventory();
|
||||
@@ -122,20 +125,21 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void managePlayers(Player p){
|
||||
public static void managePlayers(Player p) {
|
||||
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
|
||||
FightTeam team = Fight.getPlayerTeam(p);
|
||||
if(team == null)
|
||||
if (team == null)
|
||||
return;
|
||||
players.removeIf(listEntry -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(listEntry.getObject()))));
|
||||
players.forEach(listEntry -> listEntry.getItem().setLore(msg.parse("MANAGE_LORE1", p), msg.parse("MANAGE_LORE2", p)));
|
||||
SWListInv<UUID> inv = new SWListInv<>(p, msg.parse("MANAGE_TITLE", p), players, (ClickType click, UUID player) -> {
|
||||
if(click.isLeftClick()) {
|
||||
if (click.isLeftClick()) {
|
||||
Commands.kick(p, SteamwarUser.get(player).getUserName());
|
||||
} else if(click.isRightClick()) {
|
||||
} else if (click.isRightClick()) {
|
||||
LivingEntity target = (LivingEntity) Bukkit.getEntity(player);
|
||||
if(target != null)
|
||||
if (target != null) {
|
||||
team.setLeader(team.getFightPlayer(target), false);
|
||||
}
|
||||
}
|
||||
p.closeInventory();
|
||||
});
|
||||
@@ -143,19 +147,19 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void kitSelection(Player p, String query){
|
||||
public static void kitSelection(Player p, String query) {
|
||||
FightPlayer fightPlayer = Fight.getFightPlayer(p);
|
||||
if(fightPlayer == null)
|
||||
return;
|
||||
if (fightPlayer == null) return;
|
||||
|
||||
List<SWListInv.SWListEntry<Kit>> entries = new ArrayList<>();
|
||||
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
List<PersonalKit> kits = PersonalKit.get(SteamwarUser.get(p.getUniqueId()).getId(), Config.GameModeConfig.Schematic.Type.toDB());
|
||||
kits.forEach(kit -> entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, "§e" + kit.getName(), new ArrayList<>(), kit.isInUse(), clickType -> {}), new Kit(kit))));
|
||||
}else{
|
||||
kits.forEach(kit -> entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, "§e" + kit.getName(), new ArrayList<>(), kit.isInUse(), clickType -> {
|
||||
}), new Kit(kit))));
|
||||
} else {
|
||||
List<Kit> kitList = Kit.getAvailableKits(fightPlayer.isLeader());
|
||||
for(Kit k : kitList){
|
||||
for (Kit k : kitList) {
|
||||
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, k.getName(), null, k.leaderExclusive(), null), k));
|
||||
}
|
||||
}
|
||||
@@ -164,16 +168,16 @@ public class GUI {
|
||||
|
||||
SWListInv<Kit> inv = new SWListInv<>(p, msg.parse("KIT_SELECTION_TITLE", p), false, entries, (clickType, kit) -> kit.preview(p));
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
if(entries.isEmpty()) {
|
||||
if (entries.isEmpty()) {
|
||||
inv.setItem(22, new SWItem(Material.BARRIER, msg.parse("KIT_NO_KITS", p)));
|
||||
}
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
inv.setItem(48, Material.NETHER_STAR, msg.parse("KIT_CREATE", p), clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(p, msg.parse("KITNAME_TITLE", p));
|
||||
anvilInv.setItem(Material.LEATHER_CHESTPLATE);
|
||||
anvilInv.setCallback(s -> {
|
||||
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
||||
if(PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), s) != null) {
|
||||
if (PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), s) != null) {
|
||||
msg.sendPrefixless("KITNAME_IN_USE", p, ChatMessageType.ACTION_BAR);
|
||||
p.closeInventory();
|
||||
return;
|
||||
@@ -194,8 +198,8 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void preSchemDialog(Player p){
|
||||
if(!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP){
|
||||
public static void preSchemDialog(Player p) {
|
||||
if (!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
|
||||
msg.sendPrefixless("SCHEM_NO_ENEMY", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
@@ -225,7 +229,8 @@ public class GUI {
|
||||
});
|
||||
|
||||
if (Fight.publicOnly()) {
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, type.name()), (ClickType click)->{});
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte) 8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, type.name()), (ClickType click) -> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -237,7 +242,8 @@ public class GUI {
|
||||
}
|
||||
|
||||
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !Config.test()) {
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click)->{});
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte) 8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click) -> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,20 +253,20 @@ public class GUI {
|
||||
});
|
||||
}
|
||||
|
||||
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked){
|
||||
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked) {
|
||||
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
|
||||
schemSelect(p, node);
|
||||
});
|
||||
selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY);
|
||||
selector.setPublicMode(publicSchems ? SchematicSelector.PublicMode.PUBLIC_ONLY : SchematicSelector.PublicMode.PRIVATE_ONLY);
|
||||
selector.open();
|
||||
}
|
||||
|
||||
private static void schemSelect(Player p, SchematicNode node) {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
if (fightTeam == null) return;
|
||||
if (Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
fightTeam.pasteSchem(node);
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-8
@@ -58,7 +58,7 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}else if (args.length == 0) {
|
||||
} else if (args.length == 0) {
|
||||
FightSystem.getMessage().sendPrefixless("GAMEMODE_HELP", sender);
|
||||
return false;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
|
||||
GameMode mode = createMode(args[0]);
|
||||
|
||||
if(mode == null){
|
||||
if (mode == null) {
|
||||
FightSystem.getMessage().sendPrefixless("GAMEMODE_UNKNOWN", p, ChatMessageType.ACTION_BAR, args[0]);
|
||||
return false;
|
||||
}
|
||||
@@ -82,26 +82,28 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private GameMode createMode(String modeArg){
|
||||
private GameMode createMode(String modeArg) {
|
||||
try {
|
||||
return GameMode.getByValue(Integer.parseInt(modeArg));
|
||||
} catch (NumberFormatException ignored) {
|
||||
if ((modeArg.equalsIgnoreCase("creative")) || (modeArg.equalsIgnoreCase("c")))
|
||||
if ((modeArg.equalsIgnoreCase("creative")) || (modeArg.equalsIgnoreCase("c"))) {
|
||||
return GameMode.CREATIVE;
|
||||
else if ((modeArg.equalsIgnoreCase("adventure")) || (modeArg.equalsIgnoreCase("a")))
|
||||
} else if ((modeArg.equalsIgnoreCase("adventure")) || (modeArg.equalsIgnoreCase("a"))) {
|
||||
return GameMode.ADVENTURE;
|
||||
else if ((modeArg.equalsIgnoreCase("spectator")) || (modeArg.equalsIgnoreCase("sp")))
|
||||
} else if ((modeArg.equalsIgnoreCase("spectator")) || (modeArg.equalsIgnoreCase("sp"))) {
|
||||
return GameMode.SPECTATOR;
|
||||
else if ((modeArg.equalsIgnoreCase("survival")) || (modeArg.equalsIgnoreCase("s")))
|
||||
} else if ((modeArg.equalsIgnoreCase("survival")) || (modeArg.equalsIgnoreCase("s"))) {
|
||||
return GameMode.SURVIVAL;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
|
||||
if (args.length == 1)
|
||||
if (args.length == 1) {
|
||||
return StringUtil.copyPartialMatches(args[0], GAMEMODE_NAMES, new ArrayList<>(GAMEMODE_NAMES.size()));
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,18 +43,16 @@ public class InfoCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
if (!(sender instanceof Player)) return false;
|
||||
|
||||
Player player = (Player) sender;
|
||||
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
|
||||
return false;
|
||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK)) return false;
|
||||
|
||||
for(FightTeam team : Fight.teams()) {
|
||||
if(!team.isLeaderless())
|
||||
for (FightTeam team : Fight.teams()) {
|
||||
if (!team.isLeaderless())
|
||||
FightSystem.getMessage().send("INFO_LEADER", player, team.getColoredName(), team.getLeader().getEntity().getName());
|
||||
|
||||
if(team.getSchematic() != 0) {
|
||||
if (team.getSchematic() != 0) {
|
||||
SchematicNode schematic = SchematicNode.getSchematicNode(team.getSchematic());
|
||||
FightSystem.getMessage().send("INFO_SCHEMATIC", player, team.getColoredName(), schematic.getName(), SteamwarUser.byId(schematic.getOwner()).getUserName(), schematic.getRank());
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ public class KitCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(args.length != 1)
|
||||
if (args.length != 1) {
|
||||
GUI.kitSelection(player, "");
|
||||
else{
|
||||
} else {
|
||||
Commands.kit(player, args[0]);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LeaveCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
+4
-6
@@ -45,14 +45,12 @@ public class LockschemCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
if (!(sender instanceof Player)) return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
|
||||
return false;
|
||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK)) return false;
|
||||
|
||||
if(args.length != 1) {
|
||||
if (args.length != 1) {
|
||||
FightSystem.getMessage().sendPrefixless("LOCKSCHEM_HELP", player);
|
||||
return false;
|
||||
}
|
||||
@@ -60,7 +58,7 @@ public class LockschemCommand implements CommandExecutor {
|
||||
String teamName = args[0];
|
||||
FightTeam fightTeam = Fight.getTeamByName(teamName);
|
||||
|
||||
if(fightTeam == null) {
|
||||
if (fightTeam == null) {
|
||||
FightSystem.getMessage().sendPrefixless("UNKNOWN_TEAM", player, ChatMessageType.ACTION_BAR);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ReadyCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
+2
-2
@@ -38,12 +38,12 @@ public class RemoveCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(args.length != 1){
|
||||
if (args.length != 1) {
|
||||
FightSystem.getMessage().sendPrefixless("REMOVE_HELP", player);
|
||||
return false;
|
||||
}
|
||||
|
||||
+4
-6
@@ -45,17 +45,15 @@ public class RequestsCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
if (!(sender instanceof Player)) return false;
|
||||
Player player = (Player) sender;
|
||||
FightPlayer fp = Fight.getFightPlayer(player);
|
||||
if(fp == null || !(fp.isLeader() || fp.isLiving())) {
|
||||
if (fp == null || !(fp.isLeader() || fp.isLiving())) {
|
||||
GUI.joinRequest(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Commands.checkGetLeader(player) == null)
|
||||
return false;
|
||||
if (Commands.checkGetLeader(player) == null) return false;
|
||||
|
||||
GUI.chooseJoinRequests(player);
|
||||
return false;
|
||||
@@ -63,7 +61,7 @@ public class RequestsCommand implements CommandExecutor {
|
||||
|
||||
public static void onJoinRequest(Player player, JoinRequest request, BiConsumer<JoinRequest, FightTeam> handleJoinRequest) {
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
if(!request.required(team)) {
|
||||
if (!request.required(team)) {
|
||||
FightSystem.getMessage().send("NO_CONFIRMATION", player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,12 +40,12 @@ public class SkipCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(PacketProcessor.isReplaying() && player.getUniqueId().equals(Fight.getBlueTeam().getDesignatedLeader())) {
|
||||
if (PacketProcessor.isReplaying() && player.getUniqueId().equals(Fight.getBlueTeam().getDesignatedLeader())) {
|
||||
PacketProcessor.currentReplay().skipToSubtitle();
|
||||
} else {
|
||||
Commands.toggleSkip(player);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class StateCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TBCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Fight.getRedTeam().pasteSchem();
|
||||
|
||||
@@ -39,7 +39,7 @@ public class WGCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
FightWorld.resetWorld();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class WinCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
@@ -52,18 +52,18 @@ public class WinCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(args.length == 0){
|
||||
if (args.length == 0) {
|
||||
FightSystem.getMessage().sendPrefixless("WIN_HELP", p);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("tie")){
|
||||
if (args[0].equalsIgnoreCase("tie")) {
|
||||
FightSystem.setSpectateState(null, "Referee", "WIN_FIGHTLEADER");
|
||||
return false;
|
||||
}
|
||||
|
||||
for(FightTeam team : Fight.teams()) {
|
||||
if(args[0].equalsIgnoreCase(team.getName())){
|
||||
for (FightTeam team : Fight.teams()) {
|
||||
if (args[0].equalsIgnoreCase(team.getName())) {
|
||||
FightSystem.setSpectateState(team, "Referee", "WIN_FIGHTLEADER");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,24 +65,22 @@ public abstract class Countdown {
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
if(task != null){
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
currentCountdowns.remove(this);
|
||||
task = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void skip(){
|
||||
if(currentCountdowns.isEmpty())
|
||||
return;
|
||||
public static void skip() {
|
||||
if (currentCountdowns.isEmpty()) return;
|
||||
|
||||
int smallestTime = currentCountdowns.get(0).time;
|
||||
for(Countdown countdown : currentCountdowns){
|
||||
if(countdown.time < smallestTime)
|
||||
smallestTime = countdown.time;
|
||||
for (Countdown countdown : currentCountdowns) {
|
||||
if (countdown.time < smallestTime) smallestTime = countdown.time;
|
||||
}
|
||||
|
||||
for(Countdown countdown : new ArrayList<>(currentCountdowns)) {
|
||||
for (Countdown countdown : new ArrayList<>(currentCountdowns)) {
|
||||
countdown.time -= smallestTime;
|
||||
countdown.show();
|
||||
}
|
||||
@@ -94,15 +92,16 @@ public abstract class Countdown {
|
||||
FightSystem.getMessage().sendPrefixless(message, p, ChatMessageType.ACTION_BAR, displaytime, FightSystem.getMessage().parse(appendix.getMsg(), p, appendix.getParams()));
|
||||
}
|
||||
|
||||
protected void broadcast(String message, int divisor){
|
||||
if(this.sound != null && divisor == 1)
|
||||
protected void broadcast(String message, int divisor) {
|
||||
if (this.sound != null && divisor == 1) {
|
||||
Fight.playSound(this.sound, 100.0F, 1.0F);
|
||||
}
|
||||
|
||||
GlobalRecorder.getInstance().countdown(message, time / divisor, appendix);
|
||||
Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, appendix));
|
||||
}
|
||||
|
||||
public int getTimeLeft(){
|
||||
public int getTimeLeft() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@@ -111,20 +110,33 @@ public abstract class Countdown {
|
||||
show();
|
||||
}
|
||||
|
||||
private void show(){
|
||||
private void show() {
|
||||
switch (time) {
|
||||
case 900: case 600: case 300: case 180: case 120:
|
||||
case 900:
|
||||
case 600:
|
||||
case 300:
|
||||
case 180:
|
||||
case 120:
|
||||
broadcast("COUNTDOWN_MINUTES", 60);
|
||||
break;
|
||||
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
|
||||
case 60:
|
||||
case 30:
|
||||
case 20:
|
||||
case 15:
|
||||
case 10:
|
||||
case 5:
|
||||
case 4:
|
||||
case 3:
|
||||
case 2:
|
||||
broadcast("COUNTDOWN_SECONDS", 1);
|
||||
break;
|
||||
case 1:
|
||||
broadcast("COUNTDOWN_SECOND", 1);
|
||||
break;
|
||||
case 0:
|
||||
if(this.sound != null)
|
||||
if (this.sound != null) {
|
||||
Fight.playSound(this.sound, 100.0F, 2.0F);
|
||||
}
|
||||
|
||||
disable();
|
||||
countdownFinished();
|
||||
@@ -132,7 +144,8 @@ public abstract class Countdown {
|
||||
default:
|
||||
}
|
||||
|
||||
if(this.level)
|
||||
if (this.level) {
|
||||
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -38,11 +38,9 @@ public class EnternCountdown extends Countdown {
|
||||
private static int calcTime(FightPlayer fp, Countdown countdown) {
|
||||
int time = Config.GameModeConfig.EnterStages.get(fp.getKit().getEnterStage());
|
||||
|
||||
if(countdown != null) {
|
||||
if (countdown != null) {
|
||||
time -= Config.GameModeConfig.WinConditionParams.TimeoutTime - countdown.getTimeLeft();
|
||||
|
||||
if(time < 0)
|
||||
time = 0;
|
||||
if (time < 0) time = 0;
|
||||
}
|
||||
|
||||
return time;
|
||||
|
||||
+2
-1
@@ -33,8 +33,9 @@ public class NoPlayersOnlineCountdown extends Countdown {
|
||||
public NoPlayersOnlineCountdown() {
|
||||
super(Config.GameModeConfig.Times.NoPlayersOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
|
||||
|
||||
if (!Config.GameModeConfig.Arena.Leaveable)
|
||||
if (!Config.GameModeConfig.Arena.Leaveable) {
|
||||
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -31,8 +31,9 @@ public class PostSchemCountdown extends Countdown {
|
||||
|
||||
public PostSchemCountdown() {
|
||||
super(Config.GameModeConfig.Times.SetupDuration, new Message("POST_SCHEM_COUNTDOWN"), null, false);
|
||||
if(Config.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare)
|
||||
if (Config.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare) {
|
||||
return;
|
||||
}
|
||||
|
||||
new StateDependentCountdown(ArenaMode.SeriousFight, FightState.PostSchemSetup, this);
|
||||
}
|
||||
|
||||
@@ -42,202 +42,202 @@ import java.util.logging.Level;
|
||||
@Linked
|
||||
public class HellsBells {
|
||||
|
||||
public static final Random random = new Random();
|
||||
public static final Random random = new Random();
|
||||
|
||||
private final int xLength = Config.BlueExtendRegion.getSizeX();
|
||||
private final int zLength = Config.BlueExtendRegion.getSizeZ();
|
||||
private State current = State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private HellsBellsCountdown currentCountdown;
|
||||
private BukkitTask currentDropping;
|
||||
private final int xLength = Config.BlueExtendRegion.getSizeX();
|
||||
private final int zLength = Config.BlueExtendRegion.getSizeZ();
|
||||
private State current = State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private HellsBellsCountdown currentCountdown;
|
||||
private BukkitTask currentDropping;
|
||||
|
||||
private final List<String> startMessages = Arrays.asList("HELLS_BELLS_START_1", "HELLS_BELLS_START_2",
|
||||
"HELLS_BELLS_START_3", "HELLS_BELLS_START_4", "HELLS_BELLS_START_5", "HELLS_BELLS_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("HELLS_BELLS_SWAP_1", "HELLS_BELLS_SWAP_2",
|
||||
"HELLS_BELLS_SWAP_3", "HELLS_BELLS_SWAP_4");
|
||||
private final List<String> startMessages = Arrays.asList("HELLS_BELLS_START_1", "HELLS_BELLS_START_2",
|
||||
"HELLS_BELLS_START_3", "HELLS_BELLS_START_4", "HELLS_BELLS_START_5", "HELLS_BELLS_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("HELLS_BELLS_SWAP_1", "HELLS_BELLS_SWAP_2",
|
||||
"HELLS_BELLS_SWAP_3", "HELLS_BELLS_SWAP_4");
|
||||
|
||||
public void startCountdown() {
|
||||
if (current == HellsBells.State.PRE || current == HellsBells.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != HellsBells.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
public void startCountdown() {
|
||||
if (current == HellsBells.State.PRE || current == HellsBells.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != HellsBells.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
|
||||
currentDrops++;
|
||||
currentCountdown = new HellsBellsCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
currentDrops++;
|
||||
currentCountdown = new HellsBellsCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
|
||||
public void drop() {
|
||||
Direction direction = Direction.getRandom();
|
||||
public void drop() {
|
||||
Direction direction = Direction.getRandom();
|
||||
|
||||
AtomicInteger length = new AtomicInteger(20 + random.nextInt(direction.getLength(zLength, xLength) - 20));
|
||||
int width = 5 + random.nextInt(5);
|
||||
int xOffset = getStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width));
|
||||
int zOffset = getStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
|
||||
int yOffset = getHeightStart();
|
||||
AtomicInteger length = new AtomicInteger(20 + random.nextInt(direction.getLength(zLength, xLength) - 20));
|
||||
int width = 5 + random.nextInt(5);
|
||||
int xOffset = getStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width));
|
||||
int zOffset = getStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
|
||||
int yOffset = getHeightStart();
|
||||
|
||||
Point redStart;
|
||||
Point blueStart;
|
||||
Point redStart;
|
||||
Point blueStart;
|
||||
|
||||
if (direction.isNorthOrWest()) {
|
||||
redStart = new Point(Config.RedExtendRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
} else {
|
||||
redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMinZ() + zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMaxZ() - zOffset);
|
||||
}
|
||||
if (direction.isNorthOrWest()) {
|
||||
redStart = new Point(Config.RedExtendRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
} else {
|
||||
redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMinZ() + zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMaxZ() - zOffset);
|
||||
}
|
||||
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
for (int w = 0; w < width; w++) {
|
||||
if (direction.isNorthOrWest()) {
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
for (int w = 0; w < width; w++) {
|
||||
if (direction.isNorthOrWest()) {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT);
|
||||
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT);
|
||||
} else {
|
||||
} else {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT);
|
||||
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT);
|
||||
}
|
||||
}
|
||||
if (length.addAndGet(-2) <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (length.addAndGet(-2) <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
|
||||
private int getStart(int regionSize, int length) {
|
||||
double randomNumber = (Math.max(Math.min(random.nextGaussian(), -2), 2) + 2) / 4;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - length)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0);
|
||||
}
|
||||
private int getStart(int regionSize, int length) {
|
||||
double randomNumber = (Math.max(Math.min(random.nextGaussian(), -2), 2) + 2) / 4;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - length)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0);
|
||||
}
|
||||
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
|
||||
public HellsBells() {
|
||||
new StateDependent(Winconditions.HELLS_BELLS, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
current = State.PRE;
|
||||
currentDrops = 0;
|
||||
startCountdown();
|
||||
}
|
||||
public HellsBells() {
|
||||
new StateDependent(Winconditions.HELLS_BELLS, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
current = State.PRE;
|
||||
currentDrops = 0;
|
||||
startCountdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
|
||||
private class HellsBellsCountdown extends Countdown {
|
||||
private class HellsBellsCountdown extends Countdown {
|
||||
|
||||
public HellsBellsCountdown(int time) {
|
||||
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
public HellsBellsCountdown(int time) {
|
||||
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
|
||||
private enum State {
|
||||
private enum State {
|
||||
|
||||
PRE(60, 80, 1),
|
||||
FIRST(40, 60, 3),
|
||||
SECOND(30, 40, 4),
|
||||
THIRD(20, 30, 4),
|
||||
FOURTH(10, 20, 5),
|
||||
LAST(5, 10, 0);
|
||||
PRE(60, 80, 1),
|
||||
FIRST(40, 60, 3),
|
||||
SECOND(30, 40, 4),
|
||||
THIRD(20, 30, 4),
|
||||
FOURTH(10, 20, 5),
|
||||
LAST(5, 10, 0);
|
||||
|
||||
|
||||
State(int minTime, int maxTime, int switchAfter) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
}
|
||||
State(int minTime, int maxTime, int switchAfter) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
}
|
||||
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
|
||||
|
||||
public State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
public State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum Direction {
|
||||
NORTH(0, 0, 1),
|
||||
SOUTH(0, 0, -1),
|
||||
EAST(1, 0, 0),
|
||||
WEST(-1, 0, 0);
|
||||
private enum Direction {
|
||||
NORTH(0, 0, 1),
|
||||
SOUTH(0, 0, -1),
|
||||
EAST(1, 0, 0),
|
||||
WEST(-1, 0, 0);
|
||||
|
||||
|
||||
int dx;
|
||||
int dy;
|
||||
int dz;
|
||||
int dx;
|
||||
int dy;
|
||||
int dz;
|
||||
|
||||
Direction(int dx, int dy, int dz) {
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
this.dz = dz;
|
||||
}
|
||||
Direction(int dx, int dy, int dz) {
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
this.dz = dz;
|
||||
}
|
||||
|
||||
public static Direction getRandom() {
|
||||
return Direction.values()[random.nextInt(Direction.values().length)];
|
||||
}
|
||||
public static Direction getRandom() {
|
||||
return Direction.values()[random.nextInt(Direction.values().length)];
|
||||
}
|
||||
|
||||
Direction other() {
|
||||
switch (this) {
|
||||
case NORTH:
|
||||
return EAST;
|
||||
case SOUTH:
|
||||
return WEST;
|
||||
case EAST:
|
||||
return NORTH;
|
||||
case WEST:
|
||||
return SOUTH;
|
||||
default:
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Direction other() {
|
||||
switch (this) {
|
||||
case NORTH:
|
||||
return EAST;
|
||||
case SOUTH:
|
||||
return WEST;
|
||||
case EAST:
|
||||
return NORTH;
|
||||
case WEST:
|
||||
return SOUTH;
|
||||
default:
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public int getLength(int length1, int length2) {
|
||||
return isNorthOrSouth() ? length1 : length2;
|
||||
}
|
||||
public int getLength(int length1, int length2) {
|
||||
return isNorthOrSouth() ? length1 : length2;
|
||||
}
|
||||
|
||||
public boolean isNorthOrSouth() {
|
||||
return this == NORTH || this == SOUTH;
|
||||
}
|
||||
public boolean isNorthOrSouth() {
|
||||
return this == NORTH || this == SOUTH;
|
||||
}
|
||||
|
||||
public boolean isNorthOrWest() {
|
||||
return this == NORTH || this == WEST;
|
||||
}
|
||||
}
|
||||
public boolean isNorthOrWest() {
|
||||
return this == NORTH || this == WEST;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,168 +48,168 @@ import java.util.logging.Level;
|
||||
@Linked
|
||||
public class Meteor implements Listener {
|
||||
|
||||
public static final Random random = new Random();
|
||||
public static final Random random = new Random();
|
||||
|
||||
private final Vector vector = new Vector(0, -1, 0);
|
||||
private final int xLength = Config.RedExtendRegion.getMaxX() - Config.RedExtendRegion.getMinX();
|
||||
private final int zLength = Config.RedExtendRegion.getMaxZ() - Config.RedExtendRegion.getMinZ();
|
||||
private Meteor.State current = Meteor.State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private Meteor.MeteorCountdown currentCountdown;
|
||||
private final AtomicInteger amount = new AtomicInteger(0);
|
||||
private BukkitTask currentDropping;
|
||||
private final Vector vector = new Vector(0, -1, 0);
|
||||
private final int xLength = Config.RedExtendRegion.getMaxX() - Config.RedExtendRegion.getMinX();
|
||||
private final int zLength = Config.RedExtendRegion.getMaxZ() - Config.RedExtendRegion.getMinZ();
|
||||
private Meteor.State current = Meteor.State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private Meteor.MeteorCountdown currentCountdown;
|
||||
private final AtomicInteger amount = new AtomicInteger(0);
|
||||
private BukkitTask currentDropping;
|
||||
|
||||
private final List<String> startMessages = Arrays.asList("METEOR_START_1", "METEOR_START_2", "METEOR_START_3", "METEOR_START_4", "METEOR_START_5", "METEOR_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("METEOR_SWAP_1", "METEOR_SWAP_2", "METEOR_SWAP_3", "METEOR_SWAP_4");
|
||||
private final List<String> startMessages = Arrays.asList("METEOR_START_1", "METEOR_START_2", "METEOR_START_3", "METEOR_START_4", "METEOR_START_5", "METEOR_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("METEOR_SWAP_1", "METEOR_SWAP_2", "METEOR_SWAP_3", "METEOR_SWAP_4");
|
||||
|
||||
public void startCountdown() {
|
||||
if (current == Meteor.State.PRE || current == Meteor.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != Meteor.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
public void startCountdown() {
|
||||
if (current == Meteor.State.PRE || current == Meteor.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != Meteor.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
|
||||
currentDrops++;
|
||||
currentCountdown = new Meteor.MeteorCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
currentDrops++;
|
||||
currentCountdown = new Meteor.MeteorCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
|
||||
//@EventHandler
|
||||
public void explode(ProjectileHitEvent event) {
|
||||
if (event.getEntity() instanceof Fireball) {
|
||||
TNTPrimed tnt = Config.world.spawn(event.getEntity().getLocation(), TNTPrimed.class);
|
||||
tnt.setVelocity(new Vector(0, 0, 0));
|
||||
tnt.setFuseTicks(0);
|
||||
tnt.setYield(((Fireball) event.getEntity()).getYield());
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
//@EventHandler
|
||||
public void explode(ProjectileHitEvent event) {
|
||||
if (event.getEntity() instanceof Fireball) {
|
||||
TNTPrimed tnt = Config.world.spawn(event.getEntity().getLocation(), TNTPrimed.class);
|
||||
tnt.setVelocity(new Vector(0, 0, 0));
|
||||
tnt.setFuseTicks(0);
|
||||
tnt.setYield(((Fireball) event.getEntity()).getYield());
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void drop() {
|
||||
int randomAmount = current.minAmount + random.nextInt(current.maxAmount - current.minAmount);
|
||||
if (amount.get() > 0) {
|
||||
amount.set(amount.get() + randomAmount);
|
||||
return;
|
||||
}
|
||||
amount.set(randomAmount);
|
||||
public void drop() {
|
||||
int randomAmount = current.minAmount + random.nextInt(current.maxAmount - current.minAmount);
|
||||
if (amount.get() > 0) {
|
||||
amount.set(amount.get() + randomAmount);
|
||||
return;
|
||||
}
|
||||
amount.set(randomAmount);
|
||||
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
int xOffset = getStart(xLength);
|
||||
int zOffset = getStart(zLength);
|
||||
int yOffset = getHeightStart();
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
int xOffset = getStart(xLength);
|
||||
int zOffset = getStart(zLength);
|
||||
int yOffset = getHeightStart();
|
||||
|
||||
Point redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
Point blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
Point redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
Point blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
|
||||
vector.setX(random.nextDouble() - 0.5);
|
||||
vector.setZ(random.nextDouble() - 0.5);
|
||||
vector.setX(random.nextDouble() - 0.5);
|
||||
vector.setZ(random.nextDouble() - 0.5);
|
||||
|
||||
LargeFireball fireballRed = Config.world.spawn(redStart.toLocation(Config.world), LargeFireball.class);
|
||||
fireballRed.setDirection(vector);
|
||||
fireballRed.setIsIncendiary(false);
|
||||
fireballRed.setYield(current.explosionSize);
|
||||
LargeFireball fireballRed = Config.world.spawn(redStart.toLocation(Config.world), LargeFireball.class);
|
||||
fireballRed.setDirection(vector);
|
||||
fireballRed.setIsIncendiary(false);
|
||||
fireballRed.setYield(current.explosionSize);
|
||||
|
||||
LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class);
|
||||
vector.setZ(vector.getZ() * -1);
|
||||
fireballBlue.setDirection(vector);
|
||||
fireballBlue.setIsIncendiary(false);
|
||||
fireballBlue.setYield(current.explosionSize);
|
||||
LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class);
|
||||
vector.setZ(vector.getZ() * -1);
|
||||
fireballBlue.setDirection(vector);
|
||||
fireballBlue.setIsIncendiary(false);
|
||||
fireballBlue.setYield(current.explosionSize);
|
||||
|
||||
if (amount.decrementAndGet() <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
if (amount.decrementAndGet() <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
|
||||
private int getStart(int regionSize) {
|
||||
double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - 1)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - 1)), regionSize - 1), 0);
|
||||
}
|
||||
private int getStart(int regionSize) {
|
||||
double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - 1)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - 1)), regionSize - 1), 0);
|
||||
}
|
||||
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
|
||||
public Meteor() {
|
||||
new StateDependentListener(Winconditions.METEOR, FightState.Running, this);
|
||||
public Meteor() {
|
||||
new StateDependentListener(Winconditions.METEOR, FightState.Running, this);
|
||||
|
||||
new StateDependent(Winconditions.METEOR, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
startCountdown();
|
||||
}
|
||||
new StateDependent(Winconditions.METEOR, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
startCountdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
|
||||
private class MeteorCountdown extends Countdown {
|
||||
private class MeteorCountdown extends Countdown {
|
||||
|
||||
public MeteorCountdown(int time) {
|
||||
super(time, new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
public MeteorCountdown(int time) {
|
||||
super(time, new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
|
||||
private enum State {
|
||||
private enum State {
|
||||
|
||||
PRE(60, 80, 1, 0, 0, 0),
|
||||
FIRST(25, 35, 6, 2, 3, 6),
|
||||
SECOND(20, 30, 7, 4, 4, 8),
|
||||
THIRD(15, 25, 7, 4, 5, 10),
|
||||
FOURTH(10, 20, 8, 6, 7, 14),
|
||||
LAST(5, 10, 0, 6, 9, 18);
|
||||
PRE(60, 80, 1, 0, 0, 0),
|
||||
FIRST(25, 35, 6, 2, 3, 6),
|
||||
SECOND(20, 30, 7, 4, 4, 8),
|
||||
THIRD(15, 25, 7, 4, 5, 10),
|
||||
FOURTH(10, 20, 8, 6, 7, 14),
|
||||
LAST(5, 10, 0, 6, 9, 18);
|
||||
|
||||
|
||||
State(int minTime, int maxTime, int switchAfter, int explosionSize, int minAmount, int maxAmount) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
this.explosionSize = explosionSize;
|
||||
this.minAmount = minAmount;
|
||||
this.maxAmount = maxAmount;
|
||||
}
|
||||
State(int minTime, int maxTime, int switchAfter, int explosionSize, int minAmount, int maxAmount) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
this.explosionSize = explosionSize;
|
||||
this.minAmount = minAmount;
|
||||
this.maxAmount = maxAmount;
|
||||
}
|
||||
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
private final int explosionSize; //NOSONAR
|
||||
private final int minAmount;
|
||||
private final int maxAmount;
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
private final int explosionSize; //NOSONAR
|
||||
private final int minAmount;
|
||||
private final int maxAmount;
|
||||
|
||||
|
||||
public Meteor.State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Meteor.State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -37,13 +37,12 @@ import java.util.logging.Level;
|
||||
public class PersistentDamage {
|
||||
|
||||
public PersistentDamage() {
|
||||
if(!ArenaMode.SeriousFight.contains(Config.mode))
|
||||
return;
|
||||
if (!ArenaMode.SeriousFight.contains(Config.mode)) return;
|
||||
|
||||
new OneShotStateDependent(Winconditions.PERSISTENT_DAMAGE, FightState.Spectate, () -> Fight.teams().forEach(team -> {
|
||||
try{
|
||||
try {
|
||||
WorldeditWrapper.impl.saveSchem(SchematicNode.getSchematicNode(team.getSchematic()), team.getExtendRegion(), team.getSchemRegion().getMinY());
|
||||
}catch(WorldEditException e){
|
||||
} catch (WorldEditException e) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Could not persist schematic state", e);
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -32,9 +32,7 @@ public class TNTDistributor {
|
||||
|
||||
public TNTDistributor() {
|
||||
new StateDependentTask(Winconditions.TNT_DISTRIBUTION, FightState.Running, () -> Fight.teams().forEach(team -> team.getPlayers().forEach(fp -> {
|
||||
if (!fp.isLiving())
|
||||
return;
|
||||
|
||||
if (!fp.isLiving()) return;
|
||||
fp.ifPlayer(player -> player.getInventory().addItem(new ItemStack(Material.TNT, 1)));
|
||||
})), 20, 20);
|
||||
}
|
||||
|
||||
@@ -31,40 +31,47 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Fight {
|
||||
private Fight(){}
|
||||
private Fight() {
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, Config.RedLeader);
|
||||
@Getter
|
||||
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, Config.BlueLeader);
|
||||
private static final Collection<FightTeam> teams = new HashSet<>();
|
||||
|
||||
static {
|
||||
teams.add(redTeam);
|
||||
teams.add(blueTeam);
|
||||
}
|
||||
|
||||
public static FightTeam getPlayerTeam(LivingEntity player) {
|
||||
if(redTeam.isPlayerInTeam(player))
|
||||
if (redTeam.isPlayerInTeam(player)) {
|
||||
return redTeam;
|
||||
if(blueTeam.isPlayerInTeam(player))
|
||||
}
|
||||
if (blueTeam.isPlayerInTeam(player)) {
|
||||
return blueTeam;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FightTeam getOpposite(FightTeam fightTeam) {
|
||||
if(fightTeam == redTeam)
|
||||
if (fightTeam == redTeam) {
|
||||
return blueTeam;
|
||||
else if(fightTeam == blueTeam)
|
||||
} else if (fightTeam == blueTeam) {
|
||||
return redTeam;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public static FightPlayer getFightPlayer(LivingEntity player) {
|
||||
if(redTeam.isPlayerInTeam(player))
|
||||
if (redTeam.isPlayerInTeam(player)) {
|
||||
return redTeam.getFightPlayer(player);
|
||||
if(blueTeam.isPlayerInTeam(player))
|
||||
}
|
||||
if (blueTeam.isPlayerInTeam(player)) {
|
||||
return blueTeam.getFightPlayer(player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -87,10 +94,12 @@ public class Fight {
|
||||
}
|
||||
|
||||
public static FightTeam getTeamByName(String name) {
|
||||
if(redTeam.getName().equalsIgnoreCase(name))
|
||||
if (redTeam.getName().equalsIgnoreCase(name)) {
|
||||
return redTeam;
|
||||
if(blueTeam.getName().equalsIgnoreCase(name))
|
||||
}
|
||||
if (blueTeam.getName().equalsIgnoreCase(name)) {
|
||||
return blueTeam;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ public class FightPlayer {
|
||||
this.team = team;
|
||||
this.isOut = false;
|
||||
kit = Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault);
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
PersonalKit personalKit = PersonalKit.getKitInUse(user.getId(), Config.GameModeConfig.Schematic.Type.toDB());
|
||||
if(personalKit != null){
|
||||
if (personalKit != null) {
|
||||
kit = new Kit(personalKit);
|
||||
}
|
||||
}
|
||||
@@ -75,12 +75,13 @@ public class FightPlayer {
|
||||
}
|
||||
|
||||
public void startEnternCountdown(Countdown countdown) {
|
||||
if(Config.GameModeConfig.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0)
|
||||
if (Config.GameModeConfig.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0) {
|
||||
enternCountdown = new EnternCountdown(this, countdown);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopEnternCountdown(){
|
||||
if(enternCountdown != null){
|
||||
public void stopEnternCountdown() {
|
||||
if (enternCountdown != null) {
|
||||
enternCountdown.disable();
|
||||
}
|
||||
enternCountdown = null;
|
||||
@@ -88,8 +89,7 @@ public class FightPlayer {
|
||||
|
||||
public LivingEntity getEntity() {
|
||||
LivingEntity bukkit = Bukkit.getPlayer(entity.getUniqueId());
|
||||
if(bukkit != null)
|
||||
entity = bukkit;
|
||||
if (bukkit != null) entity = bukkit;
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -98,16 +98,15 @@ public class FightPlayer {
|
||||
}
|
||||
|
||||
public void ifAI(Consumer<AI> function) {
|
||||
if(entity instanceof Player)
|
||||
return;
|
||||
if (entity instanceof Player) return;
|
||||
AI ai = AI.getAI(entity.getUniqueId());
|
||||
if(ai != null)
|
||||
function.accept(ai);
|
||||
if (ai != null) function.accept(ai);
|
||||
}
|
||||
|
||||
public void ifPlayer(Consumer<Player> function) {
|
||||
if(entity instanceof Player)
|
||||
if (entity instanceof Player) {
|
||||
function.accept((Player) entity);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLiving() {
|
||||
@@ -119,13 +118,12 @@ public class FightPlayer {
|
||||
return leader != null && leader.getEntity() == entity;
|
||||
}
|
||||
|
||||
public void addKill(){
|
||||
public void addKill() {
|
||||
kills++;
|
||||
}
|
||||
|
||||
public boolean canEntern(){
|
||||
if(enternCountdown == null)
|
||||
return false;
|
||||
public boolean canEntern() {
|
||||
if (enternCountdown == null) return false;
|
||||
return enternCountdown.getTimeLeft() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
+20
-22
@@ -79,7 +79,7 @@ public class FightSchematic extends StateDependent {
|
||||
return clipboard != null;
|
||||
}
|
||||
|
||||
public int getId(){
|
||||
public int getId() {
|
||||
return schematic;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,7 @@ public class FightSchematic extends StateDependent {
|
||||
try {
|
||||
clipboard = new SchematicData(schem, revision).load();
|
||||
|
||||
if(schem.replaceColor())
|
||||
replaceTeamColor(clipboard);
|
||||
if (schem.replaceColor()) replaceTeamColor(clipboard);
|
||||
} catch (IOException e) {
|
||||
team.broadcastSystem("SCHEMATIC_UNLOADABLE");
|
||||
Bukkit.getLogger().log(Level.SEVERE, e, () -> "Couldn't load Schematic " + schem.getName());
|
||||
@@ -105,19 +104,18 @@ public class FightSchematic extends StateDependent {
|
||||
this.clipboard = clipboard;
|
||||
}
|
||||
|
||||
public void reset(){
|
||||
public void reset() {
|
||||
schematic = 0;
|
||||
clipboard = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
if(FightState.getFightState() == FightState.SPECTATE)
|
||||
return;
|
||||
if (FightState.getFightState() == FightState.SPECTATE) return;
|
||||
|
||||
if(clipboard == null){
|
||||
if (clipboard == null) {
|
||||
List<SchematicNode> publics = SchematicNode.getAllSchematicsOfType(0, Config.GameModeConfig.Schematic.Type.toDB());
|
||||
if(publics.isEmpty()) {
|
||||
if (publics.isEmpty()) {
|
||||
for (SchematicType type : Config.GameModeConfig.Schematic.SubTypes) {
|
||||
publics = SchematicNode.getAllSchematicsOfType(0, type.toDB());
|
||||
if (!publics.isEmpty()) {
|
||||
@@ -132,13 +130,13 @@ public class FightSchematic extends StateDependent {
|
||||
setSchematic(publics.get(new Random().nextInt(publics.size())));
|
||||
}
|
||||
|
||||
if(ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
if (ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
boolean changeRotation = false;
|
||||
if (Config.GameModeConfig.WinConditions.contains(Winconditions.RANDOM_ROTATE)) {
|
||||
changeRotation = new Random().nextBoolean();
|
||||
usedRotate = rotate ^ changeRotation;
|
||||
}
|
||||
if(team.isBlue())
|
||||
if (team.isBlue())
|
||||
GlobalRecorder.getInstance().blueSchem(schematic, changeRotation);
|
||||
else
|
||||
GlobalRecorder.getInstance().redSchem(schematic, changeRotation);
|
||||
@@ -155,7 +153,7 @@ public class FightSchematic extends StateDependent {
|
||||
}
|
||||
}
|
||||
|
||||
private void paste(){
|
||||
private void paste() {
|
||||
FreezeWorld freezer = new FreezeWorld();
|
||||
|
||||
team.teleportToSpawn();
|
||||
@@ -164,16 +162,17 @@ public class FightSchematic extends StateDependent {
|
||||
clipboard,
|
||||
new Location(Config.world, region.centerX(), region.getMinY(), region.centerZ()),
|
||||
new Vector(
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX()/2.0 - dims.getBlockX() : -dims.getBlockX()/2.0,
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX() / 2.0 - dims.getBlockX() : -dims.getBlockX() / 2.0,
|
||||
Config.GameModeConfig.Arena.WaterDepth != 0 ? Config.GameModeConfig.Arena.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ()/2.0 - dims.getBlockZ() : -dims.getBlockZ()/2.0
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ() / 2.0 - dims.getBlockZ() : -dims.getBlockZ() / 2.0
|
||||
).add(new Vector(usedRotate ? 1 : 0, 0, usedRotate ? 1 : 0)),
|
||||
new AffineTransform().rotateY(usedRotate ? 180 : 0)
|
||||
);
|
||||
FightSystem.getHullHider().initialize(team);
|
||||
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
|
||||
if(ArenaMode.Check.contains(Config.mode) && !team.isBlue())
|
||||
if (ArenaMode.Check.contains(Config.mode) && !team.isBlue()) {
|
||||
replaceSync(Material.TNT, Material.RED_WOOL);
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), freezer::disable, 3);
|
||||
}
|
||||
@@ -200,14 +199,14 @@ public class FightSchematic extends StateDependent {
|
||||
}
|
||||
}
|
||||
|
||||
public void pasteTeamName(){
|
||||
public void pasteTeamName() {
|
||||
char[] chars = team.getName().toCharArray();
|
||||
Clipboard[] characters = new Clipboard[chars.length];
|
||||
|
||||
int length = 0;
|
||||
int[] offsets = new int[chars.length];
|
||||
|
||||
for(int i = 0; i < chars.length; i++){
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
Clipboard character;
|
||||
try {
|
||||
if (Character.isLowerCase(chars[i])) {
|
||||
@@ -224,7 +223,7 @@ public class FightSchematic extends StateDependent {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Could not display character {} due to missing file!", chars[i]);
|
||||
try {
|
||||
character = WorldeditWrapper.impl.loadChar("");
|
||||
}catch (IOException exc) {
|
||||
} catch (IOException exc) {
|
||||
throw new SecurityException("Could not load text", exc);
|
||||
}
|
||||
}
|
||||
@@ -240,16 +239,15 @@ public class FightSchematic extends StateDependent {
|
||||
length -= 1;
|
||||
AffineTransform aT = new AffineTransform().rotateY(((team == Fight.getRedTeam()) == (Config.BlueToRedZ > 0)) ? 180 : 0);
|
||||
Location base = new Location(Config.world, region.centerX(), team.getExtendRegion().getMaxY(), region.centerZ());
|
||||
for(int i = 0; i < characters.length; i++){
|
||||
WorldeditWrapper.impl.pasteClipboard(characters[i], base, new Vector(offsets[i] - length/2, 0, -region.getSizeZ()/2), aT);
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
WorldeditWrapper.impl.pasteClipboard(characters[i], base, new Vector(offsets[i] - length / 2, 0, -region.getSizeZ() / 2), aT);
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceSync(Material target, Material replacement){
|
||||
private void replaceSync(Material target, Material replacement) {
|
||||
region.forEach((x, y, z) -> {
|
||||
Block block = Config.world.getBlockAt(x, y, z);
|
||||
if(block.getType() == target)
|
||||
block.setType(replacement);
|
||||
if (block.getType() == target) block.setType(replacement);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,38 +56,48 @@ import java.util.function.Consumer;
|
||||
public class FightTeam {
|
||||
|
||||
private static void setKitButton(HotbarKit kit, boolean leader) {
|
||||
if (Kit.getAvailableKits(leader).size() > 1 || Config.GameModeConfig.Kits.PersonalKits)
|
||||
if (Kit.getAvailableKits(leader).size() > 1 || Config.GameModeConfig.Kits.PersonalKits) {
|
||||
kit.setItem(1, "CHOOSE_KIT", new ItemBuilder(Material.LEATHER_CHESTPLATE).enchant().build(), player -> GUI.kitSelection(player, ""));
|
||||
else
|
||||
} else {
|
||||
kit.setItem(1, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static final HotbarKit memberKit = new HotbarKit();
|
||||
|
||||
static {
|
||||
setKitButton(memberKit, false);
|
||||
memberKit.setItem(7, "RESPAWN", new ItemBuilder(Material.BEACON).build(), player -> player.teleport(Objects.requireNonNull(Fight.getPlayerTeam(player)).getSpawn()));
|
||||
}
|
||||
|
||||
private static final HotbarKit notReadyKit = new HotbarKit(memberKit);
|
||||
|
||||
static {
|
||||
setKitButton(notReadyKit, true);
|
||||
|
||||
if(ArenaMode.VariableTeams.contains(Config.mode)){
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode)) {
|
||||
notReadyKit.setItem(2, "REQUESTS", new ItemBuilder(Material.PAPER).build(), GUI::chooseJoinRequests);
|
||||
if(!AIManager.availableAIs().isEmpty())
|
||||
if (!AIManager.availableAIs().isEmpty()) {
|
||||
notReadyKit.setItem(6, "ADD_AI", new ItemBuilder(Material.REDSTONE).build(), GUI::addAI);
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.test())
|
||||
if (Config.test()) {
|
||||
notReadyKit.setItem(5, "CHOOSE_SCHEMATIC", new ItemBuilder(Material.CAULDRON).enchant().build(), GUI::preSchemDialog);
|
||||
}
|
||||
|
||||
notReadyKit.setItem(3, "MANAGE_PLAYERS", SWItem.getPlayerSkull("AdmiralSeekrank").getItemStack(), GUI::managePlayers);
|
||||
notReadyKit.setItem(4, "TEAM_NOT_READY", new ItemBuilder(Material.LIME_DYE, (short) 10).enchant().build(), player -> Objects.requireNonNull(Fight.getPlayerTeam(player)).setReady(true));
|
||||
}
|
||||
|
||||
private static final HotbarKit chooseSchemKit = new HotbarKit(notReadyKit);
|
||||
|
||||
static {
|
||||
chooseSchemKit.setItem(4, "CHOOSE_SCHEMATIC", new ItemBuilder(Material.CAULDRON).enchant().build(), GUI::preSchemDialog);
|
||||
}
|
||||
|
||||
private static final HotbarKit readyKit = new HotbarKit(memberKit);
|
||||
|
||||
static {
|
||||
readyKit.setItem(1, null, null, null);
|
||||
readyKit.setItem(4, "TEAM_READY", new ItemBuilder(Material.GRAY_DYE, (short) 8).enchant().build(), player -> Objects.requireNonNull(Fight.getPlayerTeam(player)).setReady(false));
|
||||
@@ -151,22 +161,21 @@ public class FightTeam {
|
||||
new OneShotStateDependent(ArenaMode.Restartable, FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(Config.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(ArenaMode.All, FightState.PostSchemSetup, () -> {
|
||||
if(leader != null)
|
||||
leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
if (leader != null) leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
});
|
||||
}
|
||||
|
||||
public void setPrefixAndName(String prefix, String name){
|
||||
public void setPrefixAndName(String prefix, String name) {
|
||||
this.name = name;
|
||||
this.prefix = prefix;
|
||||
this.color = ChatColor.getByChar(ChatColor.getLastColors(prefix).replace("§", ""));
|
||||
}
|
||||
|
||||
public boolean canbeLeader(Player p){
|
||||
public boolean canbeLeader(Player p) {
|
||||
return isLeaderless() && (designatedLeader == null || designatedLeader.equals(p.getUniqueId()));
|
||||
}
|
||||
|
||||
public void teleportToSpawn(){
|
||||
public void teleportToSpawn() {
|
||||
players.forEach((player, fp) -> fp.getEntity().teleport(spawn));
|
||||
}
|
||||
|
||||
@@ -175,9 +184,8 @@ public class FightTeam {
|
||||
}
|
||||
|
||||
public boolean allPlayersOut() {
|
||||
for(FightPlayer fightPlayer : players.values()) {
|
||||
if(fightPlayer.isLiving())
|
||||
return false;
|
||||
for (FightPlayer fightPlayer : players.values()) {
|
||||
if (fightPlayer.isLiving()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -191,10 +199,11 @@ public class FightTeam {
|
||||
}
|
||||
|
||||
public boolean isPlayerLeader(LivingEntity player) {
|
||||
if(leader != null)
|
||||
if (leader != null) {
|
||||
return leader.getEntity().equals(player);
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -205,7 +214,7 @@ public class FightTeam {
|
||||
Set<UUID> playerSet = new HashSet<>(players.keySet());
|
||||
playerSet.removeIf(uuid -> {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player == null) {
|
||||
if (player == null) {
|
||||
removePlayer(players.get(uuid).getEntity());
|
||||
return true;
|
||||
}
|
||||
@@ -216,18 +225,18 @@ public class FightTeam {
|
||||
players.clear();
|
||||
leader = null;
|
||||
|
||||
if(leaderBackup != null){
|
||||
if (leaderBackup != null) {
|
||||
playerSet.remove(leaderBackup.getEntity().getUniqueId());
|
||||
addMember(leaderBackup.getEntity(), leaderBackup.getUser(), true);
|
||||
}
|
||||
|
||||
playerSet.forEach(uuid -> addMember(Bukkit.getPlayer(uuid), SteamwarUser.get(uuid), true));
|
||||
|
||||
if(ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()){
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()) {
|
||||
List<Player> onlinePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
|
||||
Collections.shuffle(onlinePlayers);
|
||||
for(Player player : onlinePlayers) {
|
||||
if(Fight.getPlayerTeam(player) == null && canbeLeader(player)){
|
||||
for (Player player : onlinePlayers) {
|
||||
if (Fight.getPlayerTeam(player) == null && canbeLeader(player)) {
|
||||
addMember(player);
|
||||
break;
|
||||
}
|
||||
@@ -250,8 +259,7 @@ public class FightTeam {
|
||||
private void broadcast(Consumer<Player> f) {
|
||||
players.forEach((uuid, fightPlayer) -> {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player != null)
|
||||
f.accept(player);
|
||||
if (player != null) f.accept(player);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -281,7 +289,7 @@ public class FightTeam {
|
||||
player.getInventory().clear();
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
|
||||
if(FightState.Spectate.contains(FightState.getFightState())) {
|
||||
if (FightState.Spectate.contains(FightState.getFightState())) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
} else {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
@@ -289,15 +297,17 @@ public class FightTeam {
|
||||
}
|
||||
});
|
||||
|
||||
if(FightState.Running.contains(FightState.getFightState()))
|
||||
if (FightState.Running.contains(FightState.getFightState())) {
|
||||
fightPlayer.startEnternCountdown(Wincondition.getTimeOverCountdown());
|
||||
}
|
||||
|
||||
fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, fightPlayer.canEntern() ? Region.EMPTY : Fight.getOpposite(this).getExtendRegion()));
|
||||
|
||||
if(isLeaderless())
|
||||
if (isLeaderless()) {
|
||||
setLeader(fightPlayer, silent);
|
||||
else if(!silent)
|
||||
} else if (!silent) {
|
||||
FightUI.addSubtitle("UI_PLAYER_JOINS", prefix, entity.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(LivingEntity entity) {
|
||||
@@ -311,8 +321,7 @@ public class FightTeam {
|
||||
|
||||
FightUI.addSubtitle("UI_PLAYER_LEAVES", prefix, entity.getName());
|
||||
|
||||
if(fightPlayer.equals(leader))
|
||||
removeLeader();
|
||||
if (fightPlayer.equals(leader)) removeLeader();
|
||||
|
||||
entity.teleport(Config.SpecSpawn);
|
||||
|
||||
@@ -320,12 +329,13 @@ public class FightTeam {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
player.getInventory().clear();
|
||||
|
||||
if(player.isOnline()){
|
||||
if (player.isOnline()) {
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, Fight.getOpposite(this).getExtendRegion());
|
||||
|
||||
if(ArenaMode.VariableTeams.contains(Config.mode))
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode)) {
|
||||
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -339,9 +349,9 @@ public class FightTeam {
|
||||
this.leader.setKit(Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault));
|
||||
}
|
||||
this.leader = null;
|
||||
if(!players.isEmpty()) {
|
||||
if (!players.isEmpty()) {
|
||||
setLeader(players.values().iterator().next(), false);
|
||||
}else if(FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)){
|
||||
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)) {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> FightState.setFightState(FightState.PRE_LEADER_SETUP), 1);
|
||||
}
|
||||
}
|
||||
@@ -358,25 +368,27 @@ public class FightTeam {
|
||||
|
||||
this.leader = leader;
|
||||
designatedLeader = null;
|
||||
if(ready)
|
||||
setReady(false);
|
||||
if (ready) setReady(false);
|
||||
|
||||
if(!silent)
|
||||
if (!silent) {
|
||||
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getEntity().getName());
|
||||
}
|
||||
|
||||
publicsOnly = SchematicNode.getAllAccessibleSchematicsOfType(leader.getUser().getId(), Config.GameModeConfig.Schematic.Type.toDB()).isEmpty();
|
||||
|
||||
if(!Config.GameModeConfig.Kits.PersonalKits)
|
||||
if (!Config.GameModeConfig.Kits.PersonalKits) {
|
||||
leader.setKit(Kit.getKitByName(Config.GameModeConfig.Kits.LeaderDefault));
|
||||
}
|
||||
|
||||
leader.ifPlayer(player -> {
|
||||
if(FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
if (FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
chooseSchemKit.loadToPlayer(player);
|
||||
else
|
||||
} else {
|
||||
notReadyKit.loadToPlayer(player);
|
||||
}
|
||||
});
|
||||
|
||||
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP && !Fight.getOpposite(this).isLeaderless()){
|
||||
if (FightState.getFightState() == FightState.PRE_LEADER_SETUP && !Fight.getOpposite(this).isLeaderless()) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
}
|
||||
|
||||
@@ -391,8 +403,8 @@ public class FightTeam {
|
||||
testPasteAction();
|
||||
}
|
||||
|
||||
public void pasteSchem(SchematicNode schematic){
|
||||
if(schematic.getSchemtype().check()) {
|
||||
public void pasteSchem(SchematicNode schematic) {
|
||||
if (schematic.getSchemtype().check()) {
|
||||
FightSystem.getMessage().broadcast("SCHEMATIC_UNCHECKED", getColoredName());
|
||||
}
|
||||
|
||||
@@ -400,28 +412,28 @@ public class FightTeam {
|
||||
testPasteAction();
|
||||
}
|
||||
|
||||
public void pasteSchem(int schemId, Clipboard clipboard){
|
||||
public void pasteSchem(int schemId, Clipboard clipboard) {
|
||||
this.schematic.setSchematic(schemId, clipboard);
|
||||
testPasteAction();
|
||||
}
|
||||
|
||||
private void testPasteAction(){
|
||||
if(Config.test())
|
||||
private void testPasteAction() {
|
||||
if (Config.test()) {
|
||||
this.schematic.enable();
|
||||
else if(Fight.getOpposite(this).schematic.hasSchematic()){
|
||||
} else if (Fight.getOpposite(this).schematic.hasSchematic()) {
|
||||
FightState.setFightState(FightState.POST_SCHEM_SETUP);
|
||||
}
|
||||
}
|
||||
|
||||
public void pasteTeamName(){
|
||||
public void pasteTeamName() {
|
||||
schematic.pasteTeamName();
|
||||
}
|
||||
|
||||
public void setSchem(SchematicNode schematic){
|
||||
public void setSchem(SchematicNode schematic) {
|
||||
setSchem(schematic, -1);
|
||||
}
|
||||
|
||||
public void setSchem(SchematicNode schematic, int revision){
|
||||
public void setSchem(SchematicNode schematic, int revision) {
|
||||
this.schematic.setSchematic(schematic, revision);
|
||||
broadcast("SCHEMATIC_CHOSEN", Config.GameModeConfig.GameName, schematic.getName());
|
||||
}
|
||||
@@ -429,33 +441,34 @@ public class FightTeam {
|
||||
public void setReady(boolean ready) {
|
||||
LivingEntity l = leader.getEntity();
|
||||
|
||||
if(!schematic.hasSchematic()){
|
||||
if (!schematic.hasSchematic()) {
|
||||
FightSystem.getMessage().sendPrefixless("SCHEMATIC_REQUIRED", l, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ready = ready;
|
||||
if(ready) {
|
||||
if (ready) {
|
||||
broadcast("TEAM_READY");
|
||||
leader.ifPlayer(readyKit::loadToPlayer);
|
||||
if(Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode))
|
||||
if (Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode)) {
|
||||
FightState.setFightState(FightState.PRE_RUNNING);
|
||||
}
|
||||
} else {
|
||||
broadcast("TEAM_NOT_READY");
|
||||
leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public void skip(){
|
||||
public void skip() {
|
||||
this.skip = !skip;
|
||||
if(skip){
|
||||
if (skip) {
|
||||
broadcast("SKIP_READY");
|
||||
if(Fight.getOpposite(this).skip || Config.test()){
|
||||
if (Fight.getOpposite(this).skip || Config.test()) {
|
||||
skip = false;
|
||||
Fight.getOpposite(this).skip = false;
|
||||
Countdown.skip();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
broadcast("SKIP_NOT_READY");
|
||||
}
|
||||
}
|
||||
@@ -480,7 +493,7 @@ public class FightTeam {
|
||||
return players.values().stream().filter(FightPlayer::isLiving).mapToDouble(fp -> fp.getEntity().getHealth()).sum();
|
||||
}
|
||||
|
||||
public double getHeartRatio(){
|
||||
public double getHeartRatio() {
|
||||
int maximumHearts = players.size() * 20;
|
||||
return maximumHearts != 0 ? getCurrentHearts() / maximumHearts : 0;
|
||||
}
|
||||
@@ -506,7 +519,7 @@ public class FightTeam {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
for(FightPlayer fightPlayer : players.values()) {
|
||||
for (FightPlayer fightPlayer : players.values()) {
|
||||
fightPlayer.ifPlayer(player -> {
|
||||
PersonalKitCreator.closeIfInKitCreator(player);
|
||||
|
||||
|
||||
@@ -61,18 +61,19 @@ public class FightWorld extends StateDependent {
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), FightWorld::resetWorld); //Delay to prevent raceconditions with techhider and hullhider
|
||||
}
|
||||
|
||||
public static void forceLoad(){
|
||||
public static void forceLoad() {
|
||||
Config.ArenaRegion.forEachChunk((cX, cZ) -> {
|
||||
Config.world.loadChunk(cX, cZ);
|
||||
FlatteningWrapper.impl.forceLoadChunk(Config.world, cX, cZ);
|
||||
});
|
||||
}
|
||||
|
||||
public static void resetWorld(){
|
||||
public static void resetWorld() {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
Recording.iterateOverEntities(Objects::nonNull, entity -> {
|
||||
if(entity.getType() != EntityType.PLAYER && (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(entity.getLocation())))
|
||||
if (entity.getType() != EntityType.PLAYER && (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(entity.getLocation()))) {
|
||||
entities.add(entity);
|
||||
}
|
||||
});
|
||||
entities.forEach(Entity::remove);
|
||||
entities.clear();
|
||||
@@ -81,7 +82,7 @@ public class FightWorld extends StateDependent {
|
||||
assert backup != null;
|
||||
Config.ArenaRegion.forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z);
|
||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
de.steamwar.core.CraftbukkitWrapper.sendChunk(p, x, z);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,57 +35,58 @@ public class FreezeWorld implements Listener {
|
||||
|
||||
private final Listener denyHandSwap = BountifulWrapper.impl.newDenyHandSwapListener();
|
||||
|
||||
public FreezeWorld(){
|
||||
public FreezeWorld() {
|
||||
Bukkit.getPluginManager().registerEvents(this, FightSystem.getPlugin());
|
||||
Bukkit.getPluginManager().registerEvents(denyHandSwap, FightSystem.getPlugin());
|
||||
}
|
||||
|
||||
public void disable(){
|
||||
public void disable() {
|
||||
HandlerList.unregisterAll(this);
|
||||
HandlerList.unregisterAll(denyHandSwap);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPhysicsEvent(BlockPhysicsEvent e){
|
||||
public void onBlockPhysicsEvent(BlockPhysicsEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonExtend(BlockPistonExtendEvent e){
|
||||
public void onPistonExtend(BlockPistonExtendEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonRetract(BlockPistonRetractEvent e){
|
||||
public void onPistonRetract(BlockPistonRetractEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockGrow(BlockGrowEvent e){
|
||||
public void onBlockGrow(BlockGrowEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRedstoneEvent(BlockRedstoneEvent e){
|
||||
public void onRedstoneEvent(BlockRedstoneEvent e) {
|
||||
e.setNewCurrent(e.getOldCurrent());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockDispense(BlockDispenseEvent e){
|
||||
public void onBlockDispense(BlockDispenseEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryMoveEvent(InventoryMoveItemEvent e){
|
||||
public void onInventoryMoveEvent(InventoryMoveItemEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockExplosion(BlockExplodeEvent e){
|
||||
public void onBlockExplosion(BlockExplodeEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockExplosion(ItemSpawnEvent e){
|
||||
public void onBlockExplosion(ItemSpawnEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,9 @@ import java.util.function.Consumer;
|
||||
public class HotbarKit extends Kit {
|
||||
|
||||
public static final HotbarKit SPECTATOR_KIT = new HotbarKit();
|
||||
|
||||
static {
|
||||
for(int i = 0; i < 9; i++)
|
||||
for (int i = 0; i < 9; i++)
|
||||
SPECTATOR_KIT.setItem(i, "JOIN_REQUEST", new ItemBuilder(Material.PAPER).build(), GUI::joinRequest);
|
||||
}
|
||||
|
||||
@@ -68,8 +69,8 @@ public class HotbarKit extends Kit {
|
||||
|
||||
@Override
|
||||
public synchronized void loadToPlayer(Player player) {
|
||||
for(int i = 0; i < HOTBAR_SIZE; i++) {
|
||||
if(nameTags[i] != null) {
|
||||
for (int i = 0; i < HOTBAR_SIZE; i++) {
|
||||
if (nameTags[i] != null) {
|
||||
ItemMeta meta = Objects.requireNonNull(getInventory()[i].getItemMeta());
|
||||
meta.setDisplayName(FightSystem.getMessage().parse(nameTags[i], player, Config.GameModeConfig.GameName));
|
||||
getInventory()[i].setItemMeta(meta);
|
||||
|
||||
+4
-5
@@ -50,8 +50,7 @@ public class HotbarKitListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||
if (event.getAction() == Action.PHYSICAL || event.getHand() != EquipmentSlot.HAND)
|
||||
return;
|
||||
if (event.getAction() == Action.PHYSICAL || event.getHand() != EquipmentSlot.HAND) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
int slot = player.getInventory().getHeldItemSlot();
|
||||
@@ -70,12 +69,12 @@ public class HotbarKitListener implements Listener {
|
||||
|
||||
private void click(Player player, int slot, Cancellable event) {
|
||||
Kit activeKit = Kit.activeKits.get(player);
|
||||
if (!(activeKit instanceof HotbarKit) || PersonalKitCreator.inKitCreator(player) || activeKit.getInventory()[slot] == null)
|
||||
if (!(activeKit instanceof HotbarKit) || PersonalKitCreator.inKitCreator(player) || activeKit.getInventory()[slot] == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
if (!clicked.add(player))
|
||||
return;
|
||||
if (!clicked.add(player)) return;
|
||||
|
||||
((HotbarKit) activeKit).onClicks[slot].accept(player);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public class JoinRequest {
|
||||
|
||||
private static final Map<Player, JoinRequest> playerRequests = new HashMap<>();
|
||||
private static final List<JoinRequest> activeRequests = new ArrayList<>();
|
||||
|
||||
public static JoinRequest get(Player player) {
|
||||
return playerRequests.get(player);
|
||||
}
|
||||
@@ -63,17 +64,37 @@ public class JoinRequest {
|
||||
|
||||
public static void forPlayer(Player player, FightTeam team) {
|
||||
new JoinRequest(new Enquirer() {
|
||||
@Override public String name() { return player.getName(); }
|
||||
@Override public void ifPlayer(Consumer<Player> function) { function.accept(player); }
|
||||
@Override public void ifAI(Consumer<AIManager> function) {}
|
||||
@Override
|
||||
public String name() {
|
||||
return player.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifPlayer(Consumer<Player> function) {
|
||||
function.accept(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifAI(Consumer<AIManager> function) {
|
||||
}
|
||||
}, team, FightState.ingame() ? Fight.teams() : Collections.singleton(team));
|
||||
}
|
||||
|
||||
public static void forAI(AIManager manager, FightTeam team) {
|
||||
new JoinRequest(new Enquirer() {
|
||||
@Override public String name() { return manager.name(); }
|
||||
@Override public void ifPlayer(Consumer<Player> function) {}
|
||||
@Override public void ifAI(Consumer<AIManager> function) { function.accept(manager); }
|
||||
@Override
|
||||
public String name() {
|
||||
return manager.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifPlayer(Consumer<Player> function) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifAI(Consumer<AIManager> function) {
|
||||
function.accept(manager);
|
||||
}
|
||||
}, team, Collections.singleton(Fight.getOpposite(team)));
|
||||
}
|
||||
|
||||
@@ -89,18 +110,17 @@ public class JoinRequest {
|
||||
|
||||
enquirer.ifPlayer(player -> playerRequests.put(player, this));
|
||||
activeRequests.add(this);
|
||||
for(FightTeam t : waitOnApproval) {
|
||||
for (FightTeam t : waitOnApproval) {
|
||||
FightPlayer leader = t.getLeader();
|
||||
if(leader == null)
|
||||
continue;
|
||||
if (leader == null) continue;
|
||||
|
||||
if(leader.getEntity() == null)
|
||||
continue;
|
||||
if (leader.getEntity() == null) continue;
|
||||
|
||||
leader.ifPlayer(leaderPlayer -> FightSystem.getMessage().sendPrefixless("JOIN_REQUEST_NOTIFICATION", leaderPlayer, "REQUESTS", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/requests"), enquirer.name(), team.getColoredName()));
|
||||
leader.ifAI(ai -> {
|
||||
if(ai.acceptJoinRequest(enquirer, team))
|
||||
if (ai.acceptJoinRequest(enquirer, team)) {
|
||||
alreadyAccepted.add(t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,7 +135,7 @@ public class JoinRequest {
|
||||
public void accept(FightTeam acceptor) {
|
||||
waitOnApproval.remove(acceptor);
|
||||
|
||||
if(waitOnApproval.isEmpty()) {
|
||||
if (waitOnApproval.isEmpty()) {
|
||||
enquirer.ifPlayer(team::addMember);
|
||||
enquirer.ifAI(manager -> manager.join(team));
|
||||
close();
|
||||
@@ -135,7 +155,9 @@ public class JoinRequest {
|
||||
|
||||
public interface Enquirer {
|
||||
String name();
|
||||
|
||||
void ifPlayer(Consumer<Player> function);
|
||||
|
||||
void ifAI(Consumer<AIManager> function);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,14 +58,14 @@ public class Kit {
|
||||
}
|
||||
|
||||
static {
|
||||
if(!kits.exists()) {
|
||||
if (!kits.exists()) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Kitconfig fehlend!" + kits.getAbsolutePath());
|
||||
}
|
||||
|
||||
FileConfiguration kitData = YamlConfiguration.loadConfiguration(kits);
|
||||
ConfigurationSection kitSection = kitData.getConfigurationSection("Kits");
|
||||
|
||||
for(String key : Objects.requireNonNull(kitSection).getKeys(false)) {
|
||||
for (String key : Objects.requireNonNull(kitSection).getKeys(false)) {
|
||||
loadedKits.add(new Kit(Objects.requireNonNull(kitSection.getConfigurationSection(key))));
|
||||
}
|
||||
}
|
||||
@@ -106,23 +106,25 @@ public class Kit {
|
||||
this(name, player.getInventory().getContents(), player.getInventory().getArmorContents(), player.getActivePotionEffects());
|
||||
}
|
||||
|
||||
public Kit(PersonalKit kit){
|
||||
public Kit(PersonalKit kit) {
|
||||
this(kit.getName(), kit.getInventory(), kit.getArmor(), Collections.emptyList());
|
||||
}
|
||||
|
||||
public Kit(ConfigurationSection kit){
|
||||
public Kit(ConfigurationSection kit) {
|
||||
name = kit.getName();
|
||||
inventory = Objects.requireNonNull(kit.getList("Items")).toArray(new ItemStack[0]);
|
||||
if(kit.isList("Armor"))
|
||||
if (kit.isList("Armor")) {
|
||||
armor = Objects.requireNonNull(kit.getList("Armor")).toArray(new ItemStack[0]);
|
||||
else
|
||||
armor = new ItemStack[]{ null, null, null, null};
|
||||
} else {
|
||||
armor = new ItemStack[]{null, null, null, null};
|
||||
}
|
||||
leaderAllowed = kit.getBoolean("LeaderAllowed");
|
||||
memberAllowed = kit.getBoolean("MemberAllowed");
|
||||
if(kit.isList("Effects"))
|
||||
if (kit.isList("Effects")) {
|
||||
effects = (List<PotionEffect>) kit.getList("Effects");
|
||||
else
|
||||
} else {
|
||||
effects = null;
|
||||
}
|
||||
enterStage = kit.getInt("EnterStage", 0);
|
||||
tnt = kit.getBoolean("TNT", true);
|
||||
}
|
||||
@@ -132,24 +134,23 @@ public class Kit {
|
||||
}
|
||||
|
||||
public static Kit getKitByName(String kitName) {
|
||||
for(Kit kit : loadedKits) {
|
||||
if(kit.getName().equalsIgnoreCase(kitName))
|
||||
return kit;
|
||||
for (Kit kit : loadedKits) {
|
||||
if (kit.getName().equalsIgnoreCase(kitName)) return kit;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Kit> getAvailableKits(boolean leader){
|
||||
public static List<Kit> getAvailableKits(boolean leader) {
|
||||
List<Kit> kits = new ArrayList<>();
|
||||
for (Kit k : loadedKits) {
|
||||
if (k.canUseKit(leader)){
|
||||
if (k.canUseKit(leader)) {
|
||||
kits.add(k);
|
||||
}
|
||||
}
|
||||
return kits;
|
||||
}
|
||||
|
||||
public boolean canUseKit(boolean leader){
|
||||
public boolean canUseKit(boolean leader) {
|
||||
if (leader) {
|
||||
return leaderAllowed;
|
||||
} else {
|
||||
@@ -162,13 +163,11 @@ public class Kit {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stack) {
|
||||
for(ItemStack i : inventory) {
|
||||
if(similar(i, stack))
|
||||
return true;
|
||||
for (ItemStack i : inventory) {
|
||||
if (similar(i, stack)) return true;
|
||||
}
|
||||
for(ItemStack i : armor) {
|
||||
if(similar(i, stack))
|
||||
return true;
|
||||
for (ItemStack i : armor) {
|
||||
if (similar(i, stack)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -177,78 +176,66 @@ public class Kit {
|
||||
kit.setContainer(inventory, armor);
|
||||
}
|
||||
|
||||
public void removeBadItems(){
|
||||
public void removeBadItems() {
|
||||
Kit normal = Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault);
|
||||
assert normal != null;
|
||||
|
||||
for(int i = 0; i < inventory.length; i++){
|
||||
if(isBadItem(inventory[i]))
|
||||
inventory[i] = null;
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
if (isBadItem(inventory[i])) inventory[i] = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isBadItem(ItemStack stack){
|
||||
if(stack == null)
|
||||
return false;
|
||||
public static boolean isBadItem(ItemStack stack) {
|
||||
if (stack == null) return false;
|
||||
|
||||
//Check for forbidden item
|
||||
if(Config.GameModeConfig.Kits.ForbiddenItems.contains(stack.getType()))
|
||||
return true;
|
||||
if (Config.GameModeConfig.Kits.ForbiddenItems.contains(stack.getType())) return true;
|
||||
|
||||
//Check for attribute modifiers
|
||||
if(FlatteningWrapper.impl.hasAttributeModifier(stack)){
|
||||
if (FlatteningWrapper.impl.hasAttributeModifier(stack)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(stack.hasItemMeta()){
|
||||
if (stack.hasItemMeta()) {
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
if(FlatteningWrapper.impl.containsBlockMeta(meta))
|
||||
return true; //Blocks always upwards slabs etc.
|
||||
|
||||
if(hasItems(stack))
|
||||
return true; //Blocks prefilled inventories
|
||||
if (FlatteningWrapper.impl.containsBlockMeta(meta)) return true; //Blocks always upwards slabs etc.
|
||||
if (hasItems(stack)) return true; //Blocks prefilled inventories
|
||||
}
|
||||
|
||||
Kit normal = Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault);
|
||||
assert normal != null;
|
||||
return !normal.isEnchantmentInKit(stack) && !stack.getEnchantments().isEmpty();
|
||||
}
|
||||
|
||||
public static boolean hasItems(ItemStack stack) {
|
||||
return ReflectionWrapper.impl.hasItems(stack);
|
||||
}
|
||||
|
||||
private boolean isEnchantmentInKit(ItemStack stack){
|
||||
for(ItemStack is : inventory){
|
||||
if(similar(stack, is))
|
||||
return true;
|
||||
private boolean isEnchantmentInKit(ItemStack stack) {
|
||||
for (ItemStack is : inventory) {
|
||||
if (similar(stack, is)) return true;
|
||||
}
|
||||
if(armor != null){
|
||||
for(ItemStack is : armor){
|
||||
if(similar(stack, is))
|
||||
return true;
|
||||
if (armor != null) {
|
||||
for (ItemStack is : armor) {
|
||||
if (similar(stack, is)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean similar(ItemStack stack, ItemStack stack2){
|
||||
if(stack == null || stack2 == null)
|
||||
return false;
|
||||
if(stack.getType() != stack2.getType())
|
||||
return false;
|
||||
if(stack.hasItemMeta() != stack2.hasItemMeta())
|
||||
return false;
|
||||
if(stack.getItemMeta() == null || stack2.getItemMeta() == null)
|
||||
return true;
|
||||
private boolean similar(ItemStack stack, ItemStack stack2) {
|
||||
if (stack == null || stack2 == null) return false;
|
||||
if (stack.getType() != stack2.getType()) return false;
|
||||
if (stack.hasItemMeta() != stack2.hasItemMeta()) return false;
|
||||
if (stack.getItemMeta() == null || stack2.getItemMeta() == null) return true;
|
||||
|
||||
//Enchantment Map comparison used for default similarity check does not work
|
||||
Map<Enchantment, Integer> en = stack.getItemMeta().getEnchants();
|
||||
Map<Enchantment, Integer> en2 = new HashMap<>(stack.getItemMeta().getEnchants());
|
||||
|
||||
for(Map.Entry<Enchantment, Integer> e : en.entrySet()){
|
||||
if(!en2.remove(e.getKey(), e.getValue()))
|
||||
return false;
|
||||
for (Map.Entry<Enchantment, Integer> e : en.entrySet()) {
|
||||
if (!en2.remove(e.getKey(), e.getValue())) return false;
|
||||
}
|
||||
return en2.isEmpty();
|
||||
}
|
||||
@@ -258,42 +245,42 @@ public class Kit {
|
||||
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setContents(inventory);
|
||||
if(armor != null)
|
||||
if (armor != null) {
|
||||
player.getInventory().setArmorContents(armor);
|
||||
}
|
||||
player.updateInventory(); //TODO issue in 1.21.6?
|
||||
if(effects != null)
|
||||
if (effects != null) {
|
||||
player.addPotionEffects(effects);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a kit preview with the options to go back to kit selection or to select the kit.
|
||||
*/
|
||||
public void preview(Player player){
|
||||
public void preview(Player player) {
|
||||
SWInventory inv = new SWInventory(player, 54, name);
|
||||
|
||||
//36 = Inventargröße
|
||||
for(int i = 0; i < 36; i++){
|
||||
if(inventory[i] == null)
|
||||
continue;
|
||||
for (int i = 0; i < 36; i++) {
|
||||
if (inventory[i] == null) continue;
|
||||
SWItem item = new SWItem();
|
||||
item.setItemStack(inventory[i]);
|
||||
inv.setItem(i, item);
|
||||
}
|
||||
|
||||
if(armor != null){
|
||||
for(int i = 0; i < 4; i++){
|
||||
if(armor[i] == null)
|
||||
continue;
|
||||
if (armor != null) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (armor[i] == null) continue;
|
||||
SWItem item = new SWItem();
|
||||
item.setItemStack(armor[i]);
|
||||
inv.setItem(36 + i, item);
|
||||
}
|
||||
}
|
||||
|
||||
if(effects != null){
|
||||
if (effects != null) {
|
||||
Iterator<PotionEffect> it = effects.iterator();
|
||||
int pos = 44;
|
||||
while(it.hasNext()){
|
||||
while (it.hasNext()) {
|
||||
PotionEffect effect = it.next();
|
||||
SWItem item = new SWItem(Material.POTION, effect.getType().getName());
|
||||
inv.setItem(pos, item);
|
||||
@@ -302,7 +289,7 @@ public class Kit {
|
||||
}
|
||||
|
||||
inv.setCallback(-999, click -> player.closeInventory());
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
inv.setItem(49, Material.WOODEN_AXE, FightSystem.getMessage().parse("KIT_PREVIEW_EDIT", player), clickType -> PersonalKitCreator.openKitCreator(player, PersonalKit.get(SteamwarUser.get(player.getUniqueId()).getId(), Config.GameModeConfig.Schematic.Type.toDB(), name)));
|
||||
inv.setItem(53, Material.BARRIER, FightSystem.getMessage().parse("KIT_PREVIEW_DELETE", player), clickType -> {
|
||||
player.closeInventory();
|
||||
@@ -312,9 +299,9 @@ public class Kit {
|
||||
player.closeInventory();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
PersonalKit kit = PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), name);
|
||||
if(kit.isInUse()) {
|
||||
if (kit.isInUse()) {
|
||||
List<PersonalKit> kits = PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB());
|
||||
if(!kits.isEmpty()){
|
||||
if (!kits.isEmpty()) {
|
||||
PersonalKit kit1 = kits.get(0);
|
||||
kit1.setInUse();
|
||||
FightPlayer fightPlayer = Fight.getFightPlayer(player);
|
||||
@@ -327,22 +314,23 @@ public class Kit {
|
||||
conf.open();
|
||||
});
|
||||
}
|
||||
inv.setItem(45, Material.LIME_DYE, (byte)10, FightSystem.getMessage().parse("KIT_PREVIEW_CHOOSE", player), click -> {
|
||||
inv.setItem(45, Material.LIME_DYE, (byte) 10, FightSystem.getMessage().parse("KIT_PREVIEW_CHOOSE", player), click -> {
|
||||
Commands.kit(player, name);
|
||||
player.closeInventory();
|
||||
});
|
||||
inv.setItem(53, Material.RED_DYE, (byte)1, FightSystem.getMessage().parse("KIT_PREVIEW_BACK", player), click -> GUI.kitSelection(player, ""));
|
||||
inv.setItem(53, Material.RED_DYE, (byte) 1, FightSystem.getMessage().parse("KIT_PREVIEW_BACK", player), click -> GUI.kitSelection(player, ""));
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void createKit(String kitName, Player player){
|
||||
public static void createKit(String kitName, Player player) {
|
||||
loadedKits.add(new Kit(kitName, player));
|
||||
YamlConfiguration yamlConfiguration = new YamlConfiguration();
|
||||
for(Kit k : loadedKits){
|
||||
for (Kit k : loadedKits) {
|
||||
ConfigurationSection section = yamlConfiguration.createSection("Kits." + k.getName());
|
||||
section.set("Items", k.inventory);
|
||||
if(k.armor != null)
|
||||
if (k.armor != null) {
|
||||
section.set("Armor", k.armor);
|
||||
}
|
||||
section.set("LeaderAllowed", k.leaderAllowed);
|
||||
section.set("MemberAllowed", k.memberAllowed);
|
||||
section.set("Effects", k.effects);
|
||||
@@ -352,7 +340,7 @@ public class Kit {
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(kits);
|
||||
}catch(IOException e){
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException("Failed to save kits.data", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,9 @@ public class ArenaBorder implements Listener {
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if(e.getTo().getY() <= Config.PlayerRegion.getMinY() && playerBorder.contains(player))
|
||||
if (e.getTo().getY() <= Config.PlayerRegion.getMinY() && playerBorder.contains(player)) {
|
||||
player.teleport(Fight.getPlayerTeam(player).getSpawn());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -93,18 +94,17 @@ public class ArenaBorder implements Listener {
|
||||
|
||||
private void damage() {
|
||||
Fight.teams().forEach(team -> {
|
||||
for(FightPlayer fp : team.getPlayers()) {
|
||||
for (FightPlayer fp : team.getPlayers()) {
|
||||
LivingEntity entity = fp.getEntity();
|
||||
if(fp.isLiving() && entity.getLocation().getY() <= Config.PlayerRegion.getMinY())
|
||||
if (fp.isLiving() && entity.getLocation().getY() <= Config.PlayerRegion.getMinY()) {
|
||||
entity.damage(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addToSpectator(Player player) {
|
||||
if(Config.GameModeConfig.Arena.Leaveable || !player.isOnline() || playerBorder.contains(player))
|
||||
return;
|
||||
|
||||
if (Config.GameModeConfig.Arena.Leaveable || !player.isOnline() || playerBorder.contains(player)) return;
|
||||
spectatorBorder.addPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,16 +46,16 @@ public class ArrowStopper {
|
||||
private void run() {
|
||||
Recording.iterateOverEntities(AbstractArrow.class::isInstance, entity -> {
|
||||
Projectile arrow = (Projectile) entity;
|
||||
if (invalidEntity(arrow))
|
||||
return;
|
||||
if (invalidEntity(arrow)) return;
|
||||
|
||||
Location prevLocation = arrow.getLocation().toVector().subtract(arrow.getVelocity()).toLocation(arrow.getWorld());
|
||||
if (arrow.getTicksLived() == 0){
|
||||
if (arrow.getTicksLived() == 0) {
|
||||
ProjectileSource projSource = arrow.getShooter();
|
||||
if(projSource instanceof Player)
|
||||
if (projSource instanceof Player) {
|
||||
prevLocation = ((Player) arrow.getShooter()).getEyeLocation();
|
||||
else
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (checkBlocks(arrow.getLocation().getBlock(), prevLocation.getBlock())) {
|
||||
arrow.remove();
|
||||
@@ -72,14 +72,13 @@ public class ArrowStopper {
|
||||
for (BlockFace face : BLOCK_FACES) {
|
||||
Block relative = cursor.getRelative(face);
|
||||
double distance = relative.getLocation().distance(end.getLocation());
|
||||
if(distance < nearestDistance) {
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
nearest = face;
|
||||
}
|
||||
}
|
||||
cursor = cursor.getRelative(nearest);
|
||||
if(checkBlock(cursor))
|
||||
return true;
|
||||
if (checkBlock(cursor)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -94,7 +93,7 @@ public class ArrowStopper {
|
||||
boolean teamFrom = entity.getVelocity().getZ() > 0;
|
||||
boolean overMid = location.getZ() > Config.SpecSpawn.getZ();
|
||||
boolean otherSide = teamFrom == overMid;
|
||||
return otherSide || !Config.ArenaRegion.inRegion(location) ||
|
||||
return otherSide || !Config.ArenaRegion.inRegion(location) ||
|
||||
WorldOfColorWrapper.impl.isInBlock(entity) ||
|
||||
entity.getVelocity().equals(NULL_VECTOR);
|
||||
}
|
||||
|
||||
+6
-6
@@ -41,8 +41,7 @@ public class BlockPlaceCollision implements Listener {
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if(!block.getType().isSolid())
|
||||
return;
|
||||
if (!block.getType().isSolid()) return;
|
||||
|
||||
// Hitbox size: 0.6xz, 1.8y, 1.5y when sneaking
|
||||
Player player = event.getPlayer();
|
||||
@@ -51,12 +50,13 @@ public class BlockPlaceCollision implements Listener {
|
||||
|
||||
Location blockmin = block.getLocation();
|
||||
Location blockmax = block.getLocation().add(1.0, 1.0, 1.0);
|
||||
if(
|
||||
if (
|
||||
max.getX() <= blockmin.getX() || min.getX() >= blockmax.getX() ||
|
||||
max.getY() <= blockmin.getY() || min.getY() >= blockmax.getY() ||
|
||||
max.getZ() <= blockmin.getZ() || min.getZ() >= blockmax.getZ()
|
||||
)
|
||||
max.getY() <= blockmin.getY() || min.getY() >= blockmax.getY() ||
|
||||
max.getZ() <= blockmin.getZ() || min.getZ() >= blockmax.getZ()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@@ -53,14 +53,13 @@ public class Border {
|
||||
this.name = name;
|
||||
this.region = region;
|
||||
this.ghostRange = ghostRange;
|
||||
this.ghostSize = 2*ghostRange + 1;
|
||||
this.ghostSize = 2 * ghostRange + 1;
|
||||
|
||||
new StateDependentTask(ArenaMode.All, FightState.All, this::run, 1, 1);
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
if(ghostBarriers.containsKey(player.getUniqueId()))
|
||||
return;
|
||||
if (ghostBarriers.containsKey(player.getUniqueId())) return;
|
||||
|
||||
ghostBarriers.put(player.getUniqueId(), new HashSet<>());
|
||||
lastLocation.put(player.getUniqueId(), player.getLocation());
|
||||
@@ -73,25 +72,25 @@ public class Border {
|
||||
public void removePlayer(Player player) {
|
||||
lastLocation.remove(player.getUniqueId());
|
||||
Set<Block> blocks = ghostBarriers.remove(player.getUniqueId());
|
||||
if(blocks == null || !player.isOnline())
|
||||
return;
|
||||
if (blocks == null || !player.isOnline()) return;
|
||||
|
||||
for(Block block : blocks)
|
||||
for (Block block : blocks) {
|
||||
sendChange(player, block, Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
private void run() {
|
||||
List<UUID> offline = new ArrayList<>();
|
||||
for(Map.Entry<UUID, Set<Block>> entry : ghostBarriers.entrySet()) {
|
||||
for (Map.Entry<UUID, Set<Block>> entry : ghostBarriers.entrySet()) {
|
||||
UUID uuid = entry.getKey();
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player == null) {
|
||||
if (player == null) {
|
||||
offline.add(uuid);
|
||||
continue;
|
||||
}
|
||||
|
||||
Location location = player.getLocation();
|
||||
if(region.playerInRegion(location) != contain) {
|
||||
if (region.playerInRegion(location) != contain) {
|
||||
player.teleport(lastLocation.get(uuid));
|
||||
FightSystem.getMessage().sendPrefixless(resetMessage, player, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
@@ -100,17 +99,17 @@ public class Border {
|
||||
Set<Block> ghostBlocks = entry.getValue();
|
||||
Region ghostRegion = Region.fromSize(location.getBlockX() - ghostRange, location.getBlockY() - ghostRange, location.getBlockZ() - ghostRange, ghostSize, ghostSize, ghostSize);
|
||||
ghostBlocks.removeIf(block -> {
|
||||
if(!ghostRegion.inRegion(block)) {
|
||||
if (!ghostRegion.inRegion(block)) {
|
||||
sendChange(player, block, Material.AIR);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if(contain) {
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX()-1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY()-1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ()-1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
if (contain) {
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX() - 1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY() - 1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ() - 1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMaxX(), region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMaxY(), region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMaxZ(), region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
@@ -118,9 +117,9 @@ public class Border {
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ(), region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMaxX()-1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMaxY()-1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMaxZ()-1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMaxX() - 1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMaxY() - 1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMaxZ() - 1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
}
|
||||
|
||||
lastLocation.put(entry.getKey(), location);
|
||||
@@ -134,13 +133,15 @@ public class Border {
|
||||
private void borderIteration(Player player, Set<Block> ghostBlocks, Region border) {
|
||||
border.forEach((x, y, z) -> {
|
||||
Block block = Config.world.getBlockAt(x, y, z);
|
||||
if(ghostBlocks.add(block))
|
||||
if (ghostBlocks.add(block)) {
|
||||
sendChange(player, block, Material.BARRIER);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendChange(Player player, Block block, Material type) {
|
||||
if(block.getType() == Material.AIR)
|
||||
if (block.getType() == Material.AIR) {
|
||||
FlatteningWrapper.impl.sendBlockChange(player, block, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.logging.Level;
|
||||
@Linked
|
||||
public class Chat implements Listener {
|
||||
|
||||
public Chat(){
|
||||
public Chat() {
|
||||
new StateDependentListener(ArenaMode.All, FightState.All, this);
|
||||
}
|
||||
|
||||
@@ -49,16 +49,16 @@ public class Chat implements Listener {
|
||||
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, player.getName() + "» " + message);
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
if(fightTeam != null) {
|
||||
if (fightTeam != null) {
|
||||
String teamName = fightTeam.getColoredName();
|
||||
if(message.startsWith(Config.GameModeConfig.TeamChatPrefix)) {
|
||||
if (message.startsWith(Config.GameModeConfig.TeamChatPrefix)) {
|
||||
fightTeam.broadcastChat(player, message.substring(1));
|
||||
} else {
|
||||
broadcastChat("PARTICIPANT_CHAT", teamName, player.getName(), message);
|
||||
}
|
||||
}else if(Config.isReferee(player)){
|
||||
} else if (Config.isReferee(player)) {
|
||||
broadcastChat("FIGHTLEADER_CHAT", player.getName(), message);
|
||||
}else{
|
||||
} else {
|
||||
broadcastChat("SPECTATOR_CHAT", player.getName(), message);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,16 +45,14 @@ public class Check implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e){
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
|
||||
if(user.hasPerm(UserPerm.CHECK))
|
||||
return;
|
||||
if (user.hasPerm(UserPerm.CHECK)) return;
|
||||
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
if(user.getId() == schem.getOwner())
|
||||
return;
|
||||
if (user.getId() == schem.getOwner()) return;
|
||||
|
||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||
player.kickPlayer("");
|
||||
@@ -63,8 +61,9 @@ public class Check implements Listener {
|
||||
@EventHandler
|
||||
public void handlePlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(!event.getMessage().contains("copy") && !event.getMessage().contains("cut"))
|
||||
if (!event.getMessage().contains("copy") && !event.getMessage().contains("cut")) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().send("CHECK_COMMAND_LOCKED", player);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class ClickAnalyzer {
|
||||
}
|
||||
|
||||
public Object onBlockPlace(Player player, Object packet) {
|
||||
synchronized(output) {
|
||||
synchronized (output) {
|
||||
output.println(player.getName() + "," + System.nanoTime() + "," + CraftbukkitWrapper.impl.headRotation(player) + "," + player.getLocation().getPitch());
|
||||
}
|
||||
return packet;
|
||||
|
||||
+2
-4
@@ -42,14 +42,12 @@ public class DenyInventoryMovement implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
|
||||
event.setCancelled(true);
|
||||
if (!PersonalKitCreator.inKitCreator(event.getWhoClicked())) event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryDrag(InventoryDragEvent event) {
|
||||
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
|
||||
event.setCancelled(true);
|
||||
if (!PersonalKitCreator.inKitCreator(event.getWhoClicked())) event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
+12
-11
@@ -50,7 +50,7 @@ public class DenyWorldInteraction implements Listener {
|
||||
@EventHandler
|
||||
public void handleBlockBreak(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
@@ -59,14 +59,14 @@ public class DenyWorldInteraction implements Listener {
|
||||
@EventHandler
|
||||
public void handleItemDrop(PlayerDropItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleHangingBreak(HangingBreakEvent event) {
|
||||
if(Config.ArenaRegion.inRegion(event.getEntity().getLocation())) {
|
||||
if (Config.ArenaRegion.inRegion(event.getEntity().getLocation())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class DenyWorldInteraction implements Listener {
|
||||
@EventHandler
|
||||
public void handleBlockPlace(BlockPlaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
@@ -82,27 +82,28 @@ public class DenyWorldInteraction implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleEntityExplode(EntityExplodeEvent event) {
|
||||
if(!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getLocation()))
|
||||
if (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getLocation())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleBlockBurn(BlockIgniteEvent event) {
|
||||
if(!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getBlock()))
|
||||
if (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getBlock())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerKickEvent(PlayerKickEvent e){
|
||||
if(e.getReason().contains("Flying is not enabled"))
|
||||
e.setCancelled(true);
|
||||
public void handlePlayerKickEvent(PlayerKickEvent e) {
|
||||
if (e.getReason().contains("Flying is not enabled")) e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
if(event.getEntity().getShooter() instanceof Player) {
|
||||
if (event.getEntity().getShooter() instanceof Player) {
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BOW_USAGE", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
@@ -38,13 +38,11 @@ public class EntityDamage implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleEntityDamage(EntityDamageEvent event) {
|
||||
if(Config.ArenaRegion.in2dRegion(event.getEntity().getLocation()))
|
||||
event.setCancelled(true);
|
||||
if (Config.ArenaRegion.in2dRegion(event.getEntity().getLocation())) event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
if(Config.ArenaRegion.in2dRegion(event.getEntity().getLocation()))
|
||||
event.setCancelled(true);
|
||||
if (Config.ArenaRegion.in2dRegion(event.getEntity().getLocation())) event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,15 +43,15 @@ public class EventJoin implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void playerLogin(PlayerLoginEvent event) {
|
||||
if(!Config.LiveReplay)
|
||||
return;
|
||||
if (!Config.LiveReplay) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
if(user.getTeam() == Config.EventTeamBlueID ||
|
||||
user.getTeam() == Config.EventTeamRedID ||
|
||||
Config.isReferee(player))
|
||||
if (user.getTeam() == Config.EventTeamBlueID ||
|
||||
user.getTeam() == Config.EventTeamRedID ||
|
||||
Config.isReferee(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, FightSystem.getMessage().parse("NO_PARTICIPANT", player));
|
||||
}
|
||||
@@ -61,35 +61,38 @@ public class EventJoin implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
|
||||
if(Config.isReferee(player))
|
||||
return;
|
||||
if (Config.isReferee(player)) return;
|
||||
|
||||
if(FightState.Setup.contains(FightState.getFightState())){
|
||||
if (FightState.Setup.contains(FightState.getFightState())) {
|
||||
FightTeam team = null;
|
||||
if(user.getTeam() == Config.EventTeamBlueID)
|
||||
if (user.getTeam() == Config.EventTeamBlueID) {
|
||||
team = Fight.getBlueTeam();
|
||||
else if(user.getTeam() == Config.EventTeamRedID)
|
||||
} else if (user.getTeam() == Config.EventTeamRedID) {
|
||||
team = Fight.getRedTeam();
|
||||
|
||||
if(Config.BothTeamsPublic){
|
||||
if(Fight.getRedTeam().getPlayers().size() < Fight.getBlueTeam().getPlayers().size())
|
||||
team = Fight.getRedTeam();
|
||||
else
|
||||
team = Fight.getBlueTeam();
|
||||
}else if(team == null){
|
||||
if(Config.EventTeamRedID == 0)
|
||||
team = Fight.getRedTeam();
|
||||
else if(Config.EventTeamBlueID == 0)
|
||||
team = Fight.getBlueTeam();
|
||||
}
|
||||
|
||||
if(team != null && team.getPlayers().size() < Config.MaximumTeamMembers){
|
||||
if (Config.BothTeamsPublic) {
|
||||
if (Fight.getRedTeam().getPlayers().size() < Fight.getBlueTeam().getPlayers().size()) {
|
||||
team = Fight.getRedTeam();
|
||||
} else {
|
||||
team = Fight.getBlueTeam();
|
||||
}
|
||||
} else if (team == null) {
|
||||
if (Config.EventTeamRedID == 0) {
|
||||
team = Fight.getRedTeam();
|
||||
} else if (Config.EventTeamBlueID == 0) {
|
||||
team = Fight.getBlueTeam();
|
||||
}
|
||||
}
|
||||
|
||||
if (team != null && team.getPlayers().size() < Config.MaximumTeamMembers) {
|
||||
team.addMember(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.LiveReplay)
|
||||
if (Config.LiveReplay) {
|
||||
player.kickPlayer(FightSystem.getMessage().parse("NO_PARTICIPANT", player));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -40,17 +40,15 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
|
||||
public static Team getBukkitTeam(String name) {
|
||||
Scoreboard scoreboard = Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard();
|
||||
Team team = scoreboard.getTeam(name);
|
||||
if(team != null)
|
||||
return team;
|
||||
if (team != null) return team;
|
||||
|
||||
return scoreboard.registerNewTeam(name);
|
||||
}
|
||||
|
||||
private static FightScoreboard scoreboard;
|
||||
|
||||
public static FightScoreboard getScoreboard(){
|
||||
if(scoreboard == null)
|
||||
scoreboard = new FightScoreboard();
|
||||
public static FightScoreboard getScoreboard() {
|
||||
if (scoreboard == null) scoreboard = new FightScoreboard();
|
||||
return scoreboard;
|
||||
}
|
||||
|
||||
@@ -58,7 +56,7 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
|
||||
private final HashMap<String, Integer> scores = new HashMap<>();
|
||||
|
||||
|
||||
private FightScoreboard(){
|
||||
private FightScoreboard() {
|
||||
new StateDependentListener(ArenaMode.Replay, FightState.All, this);
|
||||
Bukkit.getOnlinePlayers().forEach(player -> SWScoreboard.impl.createScoreboard(player, this));
|
||||
}
|
||||
|
||||
+12
-11
@@ -44,46 +44,47 @@ public class InFightDamage implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
if(!(event.getEntity() instanceof LivingEntity))
|
||||
if (!(event.getEntity() instanceof LivingEntity)) {
|
||||
//Target is not a player
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity player = ((LivingEntity) event.getEntity());
|
||||
if(!Fight.fighting(player))
|
||||
return;
|
||||
if (!Fight.fighting(player)) return;
|
||||
|
||||
LivingEntity damager;
|
||||
|
||||
if(event.getDamager() instanceof LivingEntity) {
|
||||
if (event.getDamager() instanceof LivingEntity) {
|
||||
damager = (LivingEntity) event.getDamager();
|
||||
}else if(event.getDamager() instanceof Arrow) {
|
||||
} else if (event.getDamager() instanceof Arrow) {
|
||||
Arrow damagerArrow = (Arrow) event.getDamager();
|
||||
if(!(damagerArrow.getShooter() instanceof LivingEntity))
|
||||
if (!(damagerArrow.getShooter() instanceof LivingEntity)) {
|
||||
//Shooter is not a player
|
||||
return;
|
||||
}
|
||||
|
||||
damager = (LivingEntity) damagerArrow.getShooter();
|
||||
}else{
|
||||
} else {
|
||||
//Damager is not a player
|
||||
return;
|
||||
}
|
||||
|
||||
if(!Fight.fighting(damager)){
|
||||
if (!Fight.fighting(damager)) {
|
||||
event.setCancelled(true);
|
||||
//Damager is not fighting
|
||||
return;
|
||||
}
|
||||
|
||||
if(Fight.getPlayerTeam(player) == Fight.getPlayerTeam(damager)) {
|
||||
if (Fight.getPlayerTeam(player) == Fight.getPlayerTeam(damager)) {
|
||||
event.setCancelled(true);
|
||||
if(event.getDamager() instanceof Arrow){
|
||||
if (event.getDamager() instanceof Arrow) {
|
||||
event.getDamager().setFireTicks(0);
|
||||
player.setFireTicks(0);
|
||||
}
|
||||
FightSystem.getMessage().sendPrefixless("NO_FRIENDLY_FIRE", damager, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
if(player.getHealth() - event.getFinalDamage() <= 0){
|
||||
if (player.getHealth() - event.getFinalDamage() <= 0) {
|
||||
Objects.requireNonNull(Fight.getFightPlayer(damager)).addKill();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -47,21 +47,21 @@ public class InFightInventory implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if(!Fight.fighting((Player) event.getWhoClicked()))
|
||||
return;
|
||||
if (!Fight.fighting(event.getWhoClicked())) return;
|
||||
|
||||
InventoryType top = event.getView().getTopInventory().getType();
|
||||
if(top == InventoryType.CRAFTING)
|
||||
return;
|
||||
if (top == InventoryType.CRAFTING) return;
|
||||
|
||||
if ((event.getCursor() != null && !allowed.contains(event.getCursor().getType())) || (event.getCurrentItem() != null && !allowed.contains(event.getCurrentItem().getType())))
|
||||
if ((event.getCursor() != null && !allowed.contains(event.getCursor().getType())) || (event.getCurrentItem() != null && !allowed.contains(event.getCurrentItem().getType()))) {
|
||||
event.setCancelled(true); // Deny if transferred item is not TNT
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryDrag(InventoryDragEvent event) {
|
||||
if(!Fight.fighting((Player) event.getWhoClicked()))
|
||||
if (!Fight.fighting(event.getWhoClicked())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getInventory().getType() != InventoryType.PLAYER) {
|
||||
int inventorySize = event.getInventory().getSize();
|
||||
|
||||
@@ -68,12 +68,10 @@ public class IngameDeath implements Listener {
|
||||
}
|
||||
|
||||
private void onPlayerEnd(Entity player, Consumer<FightPlayer> withLivingPlayer) {
|
||||
if(!(player instanceof LivingEntity))
|
||||
return;
|
||||
if (!(player instanceof LivingEntity)) return;
|
||||
|
||||
FightPlayer fightPlayer = Fight.getFightPlayer((LivingEntity) player);
|
||||
if(fightPlayer == null || !fightPlayer.isLiving())
|
||||
return;
|
||||
if (fightPlayer == null || !fightPlayer.isLiving()) return;
|
||||
|
||||
withLivingPlayer.accept(fightPlayer);
|
||||
}
|
||||
|
||||
+3
-4
@@ -62,15 +62,14 @@ public class JoinRequestListener implements Listener {
|
||||
@EventHandler
|
||||
public void handlePlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
|
||||
if (Fight.fighting(player)) {
|
||||
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent event) {
|
||||
JoinRequest request = JoinRequest.get(event.getPlayer());
|
||||
if(request != null)
|
||||
request.close();
|
||||
if (request != null) request.close();
|
||||
}
|
||||
}
|
||||
|
||||
+8
-11
@@ -48,10 +48,9 @@ public class LeaveableArena implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onJoin(PlayerSpawnLocationEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player))
|
||||
return;
|
||||
if (Fight.fighting(player)) return;
|
||||
|
||||
if(Config.ArenaRegion.in2dRegion(event.getSpawnLocation())) {
|
||||
if (Config.ArenaRegion.in2dRegion(event.getSpawnLocation())) {
|
||||
markInArena(player);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +58,7 @@ public class LeaveableArena implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Config.ArenaRegion.in2dRegion(event.getRespawnLocation())) {
|
||||
if (Config.ArenaRegion.in2dRegion(event.getRespawnLocation())) {
|
||||
markInArena(player);
|
||||
} else {
|
||||
spectatorsInArena.remove(player);
|
||||
@@ -67,20 +66,18 @@ public class LeaveableArena implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void arenaBorder(PlayerMoveEvent event){
|
||||
public void arenaBorder(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player))
|
||||
return;
|
||||
if (Fight.fighting(player)) return;
|
||||
|
||||
boolean inArena = Config.ArenaRegion.in2dRegion(event.getTo());
|
||||
boolean spectator = spectatorsInArena.containsKey(player);
|
||||
|
||||
if(inArena && !spectator) {
|
||||
if (inArena && !spectator) {
|
||||
markInArena(player);
|
||||
} else if(!inArena && spectator) {
|
||||
} else if (!inArena && spectator) {
|
||||
GameMode mode = spectatorsInArena.remove(player);
|
||||
if(mode != null)
|
||||
player.setGameMode(mode);
|
||||
if (mode != null) player.setGameMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,12 +40,10 @@ public class NormalJoin implements Listener {
|
||||
@EventHandler
|
||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (Fight.getPlayerTeam(player) != null)
|
||||
return;
|
||||
if (Fight.getPlayerTeam(player) != null) return;
|
||||
|
||||
FightTeam team = Fight.teams().stream().filter(t -> player.getUniqueId().equals(t.getDesignatedLeader())).findAny( // Player is designated leader of a team
|
||||
).orElse(Fight.teams().stream().filter(t -> t.canbeLeader(player)).findAny().orElse(null)); // Else search empty team
|
||||
if(team != null)
|
||||
team.addMember(player);
|
||||
if (team != null) team.addMember(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ import org.bukkit.scoreboard.Team;
|
||||
public class Permanent implements Listener {
|
||||
|
||||
private static final Team spectatorTeam = FightScoreboard.getBukkitTeam("Spectator");
|
||||
|
||||
static {
|
||||
BountifulWrapper.impl.setNametagVisibility(spectatorTeam);
|
||||
spectatorTeam.setNameTagVisibility(NameTagVisibility.NEVER);
|
||||
@@ -74,9 +75,9 @@ public class Permanent implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerRespawn(PlayerRespawnEvent event){
|
||||
public void handlePlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
@@ -104,7 +105,7 @@ public class Permanent implements Listener {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
spectatorTeam.addEntry(player.getName());
|
||||
player.teleport(Config.SpecSpawn);
|
||||
} else if(fp != null && !fp.isLiving()) {
|
||||
} else if (fp != null && !fp.isLiving()) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
player.teleport(fp.getTeam().getSpawn());
|
||||
}
|
||||
@@ -112,20 +113,23 @@ public class Permanent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void handlePlayerDeath(PlayerDeathEvent event) {
|
||||
if(!Config.GameModeConfig.Arena.Leaveable || Fight.fighting(event.getEntity()))
|
||||
if (!Config.GameModeConfig.Arena.Leaveable || Fight.fighting(event.getEntity())) {
|
||||
event.setDeathMessage(null);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void handlePlayerLeave(PlayerQuitEvent event) {
|
||||
if(!Config.GameModeConfig.Arena.Leaveable)
|
||||
if (!Config.GameModeConfig.Arena.Leaveable) {
|
||||
event.setQuitMessage(null);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
if(Fight.fighting((Player) event.getEntity()))
|
||||
if (Fight.fighting(event.getEntity())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -134,46 +138,48 @@ public class Permanent implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpawnerSpawn(SpawnerSpawnEvent e){
|
||||
if(Config.ArenaRegion.inRegion(e.getSpawner().getBlock()))
|
||||
public void onSpawnerSpawn(SpawnerSpawnEvent e) {
|
||||
if (Config.ArenaRegion.inRegion(e.getSpawner().getBlock())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSleep(PlayerBedEnterEvent e) {
|
||||
if(Fight.fighting(e.getPlayer()))
|
||||
if (Fight.fighting(e.getPlayer())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCrafting(CraftItemEvent e) {
|
||||
if(Fight.fighting((Player) e.getWhoClicked()))
|
||||
if (Fight.fighting(e.getWhoClicked())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFurnace(FurnaceSmeltEvent e){
|
||||
if(Config.ArenaRegion.inRegion(e.getBlock()))
|
||||
public void onFurnace(FurnaceSmeltEvent e) {
|
||||
if (Config.ArenaRegion.inRegion(e.getBlock())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDropPickup(PlayerPickupItemEvent e) {
|
||||
if(!(Config.ArenaRegion.inRegion(e.getItem().getLocation())))
|
||||
return;
|
||||
if (!(Config.ArenaRegion.inRegion(e.getItem().getLocation()))) return;
|
||||
Player player = e.getPlayer();
|
||||
|
||||
ItemStack stack = e.getItem().getItemStack();
|
||||
if(Config.GameModeConfig.Kits.PersonalKits) {
|
||||
if(Config.GameModeConfig.Kits.ForbiddenItems.contains(stack.getType())) {
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
if (Config.GameModeConfig.Kits.ForbiddenItems.contains(stack.getType())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
FightPlayer fp = Fight.getFightPlayer(player);
|
||||
if(fp == null)
|
||||
return;
|
||||
if (fp == null) return;
|
||||
|
||||
if(!fp.getKit().contains(stack)) {
|
||||
if (!fp.getKit().contains(stack)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -189,7 +195,7 @@ public class Permanent implements Listener {
|
||||
}
|
||||
if (!Config.GameModeConfig.Arena.WaterDamage) return;
|
||||
e.blockList().removeIf(block -> {
|
||||
if(block.getType() == Material.TNT) {
|
||||
if (block.getType() == Material.TNT) {
|
||||
return false;
|
||||
} else {
|
||||
block.setType(Material.AIR);
|
||||
@@ -200,18 +206,19 @@ public class Permanent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onWorldLoad(WorldLoadEvent e) {
|
||||
if(!Config.GameModeConfig.Arena.Leaveable)
|
||||
if (!Config.GameModeConfig.Arena.Leaveable) {
|
||||
e.getWorld().setAutoSave(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
if(!event.getBlock().getType().equals(Material.DRAGON_EGG)) return;
|
||||
if (!event.getBlock().getType().equals(Material.DRAGON_EGG)) return;
|
||||
|
||||
for (FightTeam team : Fight.teams()) {
|
||||
if(team.getExtendRegion().inRegion(event.getBlock())){
|
||||
if (team.getExtendRegion().inRegion(event.getBlock())) {
|
||||
|
||||
if(team.getExtendRegion().inRegion(event.getToBlock())) return;
|
||||
if (team.getExtendRegion().inRegion(event.getToBlock())) return;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -223,19 +230,22 @@ public class Permanent implements Listener {
|
||||
public void onBlockDispense(BlockDispenseEvent e) {
|
||||
Block block = e.getBlock();
|
||||
|
||||
if(!Config.ArenaRegion.inRegion(block))
|
||||
if (!Config.ArenaRegion.inRegion(block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.getItem().getType() == Material.TNT || FlatteningWrapper.impl.isFacingWater(block))
|
||||
if (e.getItem().getType() == Material.TNT || FlatteningWrapper.impl.isFacingWater(block)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockPlace(BlockPlaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
if(Fight.teams().stream().anyMatch(team -> team.getExtendRegion().inRegion(block)))
|
||||
if (Fight.teams().stream().anyMatch(team -> team.getExtendRegion().inRegion(block))) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
|
||||
@@ -244,8 +254,7 @@ public class Permanent implements Listener {
|
||||
@EventHandler
|
||||
public void blockBreak(BlockBreakEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if(Config.BlueExtendRegion.getMinY() <= block.getY())
|
||||
return;
|
||||
if (Config.BlueExtendRegion.getMinY() <= block.getY()) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", event.getPlayer(), ChatMessageType.ACTION_BAR);
|
||||
|
||||
+20
-27
@@ -50,11 +50,11 @@ public class PersonalKitCreator implements Listener {
|
||||
|
||||
private static final Map<HumanEntity, InventoryBackup> openKitCreators = new HashMap<>();
|
||||
|
||||
public PersonalKitCreator(){
|
||||
public PersonalKitCreator() {
|
||||
new StateDependentListener(Config.GameModeConfig.Kits.PersonalKits, FightState.Setup, this);
|
||||
}
|
||||
|
||||
public static void openKitCreator(Player player, PersonalKit kit){
|
||||
public static void openKitCreator(Player player, PersonalKit kit) {
|
||||
player.closeInventory();
|
||||
new InventoryBackup(player, kit);
|
||||
new Kit(kit).loadToPlayer(player);
|
||||
@@ -62,44 +62,39 @@ public class PersonalKitCreator implements Listener {
|
||||
FightSystem.getMessage().sendPrefixless("OPEN_INVENTORY_TO_CUSTOMIZE", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
public static boolean inKitCreator(HumanEntity player){
|
||||
public static boolean inKitCreator(HumanEntity player) {
|
||||
return openKitCreators.containsKey(player);
|
||||
}
|
||||
|
||||
public static void closeIfInKitCreator(HumanEntity player){
|
||||
public static void closeIfInKitCreator(HumanEntity player) {
|
||||
InventoryBackup backup = openKitCreators.get(player);
|
||||
if(backup == null)
|
||||
return;
|
||||
if (backup == null) return;
|
||||
|
||||
backup.close();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e){
|
||||
if(!openKitCreators.containsKey(e.getWhoClicked()))
|
||||
return;
|
||||
|
||||
if(Kit.isBadItem(e.getCursor()))
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
if (!openKitCreators.containsKey(e.getWhoClicked())) return;
|
||||
if (Kit.isBadItem(e.getCursor())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMoveEvent(PlayerMoveEvent e){
|
||||
public void onMoveEvent(PlayerMoveEvent e) {
|
||||
InventoryBackup backup = openKitCreators.get(e.getPlayer());
|
||||
if(backup == null)
|
||||
return;
|
||||
|
||||
if (backup == null) return;
|
||||
backup.close();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onOpenEvent(InventoryOpenEvent e){
|
||||
public void onOpenEvent(InventoryOpenEvent e) {
|
||||
InventoryBackup backup = openKitCreators.get(e.getPlayer());
|
||||
if(backup == null)
|
||||
return;
|
||||
if (backup == null) return;
|
||||
|
||||
InventoryType type = e.getInventory().getType();
|
||||
if(type != InventoryType.PLAYER && type != InventoryType.CREATIVE) {
|
||||
if (type != InventoryType.PLAYER && type != InventoryType.CREATIVE) {
|
||||
backup.close();
|
||||
}
|
||||
}
|
||||
@@ -107,34 +102,32 @@ public class PersonalKitCreator implements Listener {
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent e) {
|
||||
InventoryBackup backup = openKitCreators.get(e.getPlayer());
|
||||
if(backup == null)
|
||||
return;
|
||||
if (backup == null) return;
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), backup::close, 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerExit(PlayerQuitEvent e){
|
||||
public void onPlayerExit(PlayerQuitEvent e) {
|
||||
InventoryBackup backup = openKitCreators.get(e.getPlayer());
|
||||
if(backup == null)
|
||||
return;
|
||||
if (backup == null) return;
|
||||
|
||||
backup.close();
|
||||
}
|
||||
|
||||
private static class InventoryBackup{
|
||||
private static class InventoryBackup {
|
||||
private final Player player;
|
||||
private final PersonalKit kit;
|
||||
private final Kit backup;
|
||||
|
||||
private InventoryBackup(Player player, PersonalKit kit){
|
||||
private InventoryBackup(Player player, PersonalKit kit) {
|
||||
openKitCreators.put(player, this);
|
||||
this.player = player;
|
||||
this.backup = Kit.getActiveKit(player);
|
||||
this.kit = kit;
|
||||
}
|
||||
|
||||
private void close(){
|
||||
private void close() {
|
||||
Kit kit1 = new Kit(kit.getName(), player);
|
||||
kit1.removeBadItems();
|
||||
|
||||
|
||||
+9
-12
@@ -41,8 +41,7 @@ public class PistonListener implements Listener {
|
||||
|
||||
public PistonListener(Set<ArenaMode> condition, Consumer<BlockPistonEvent> leftAreaHandler) {
|
||||
this.leftAreaHandler = leftAreaHandler;
|
||||
if(!condition.contains(Config.mode))
|
||||
return;
|
||||
if (!condition.contains(Config.mode)) return;
|
||||
|
||||
//Wenn Entern aktiv ist, sollen Raketen etc. entern können
|
||||
new StateDependentListener(!Config.GameModeConfig.Arena.AllowMissiles, FightState.All, this);
|
||||
@@ -50,14 +49,13 @@ public class PistonListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePistonExtend(BlockPistonExtendEvent e){
|
||||
if(!Config.ArenaRegion.inRegion(e.getBlock()))
|
||||
return;
|
||||
public void handlePistonExtend(BlockPistonExtendEvent e) {
|
||||
if (!Config.ArenaRegion.inRegion(e.getBlock())) return;
|
||||
|
||||
BlockFace face = e.getDirection();
|
||||
for(Block block : e.getBlocks()){
|
||||
for (Block block : e.getBlocks()) {
|
||||
Block target = block.getRelative(face);
|
||||
if(!Config.BlueExtendRegion.inRegion(target) && !Config.RedExtendRegion.inRegion(target) && block.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
|
||||
if (!Config.BlueExtendRegion.inRegion(target) && !Config.RedExtendRegion.inRegion(target) && block.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
|
||||
leftAreaHandler.accept(e);
|
||||
return;
|
||||
}
|
||||
@@ -65,12 +63,11 @@ public class PistonListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePistonRetract(BlockPistonRetractEvent e){
|
||||
if(!Config.ArenaRegion.inRegion(e.getBlock()))
|
||||
return;
|
||||
public void handlePistonRetract(BlockPistonRetractEvent e) {
|
||||
if (!Config.ArenaRegion.inRegion(e.getBlock())) return;
|
||||
|
||||
for(Block block : e.getBlocks()){
|
||||
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)) {
|
||||
for (Block block : e.getBlocks()) {
|
||||
if (!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)) {
|
||||
leftAreaHandler.accept(e);
|
||||
return;
|
||||
}
|
||||
|
||||
+11
-10
@@ -52,12 +52,13 @@ public class PrepareSchem implements Listener {
|
||||
new OneShotStateDependent(ArenaMode.Prepare, FightState.PostSchemSetup, () -> Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
stationaryMovingPistons.clear();
|
||||
Fight.getUnrotated().getSchemRegion().forEach((x, y, z) -> {
|
||||
if(FlatteningWrapper.impl.checkPistonMoving(Config.world.getBlockAt(x, y, z)))
|
||||
if (FlatteningWrapper.impl.checkPistonMoving(Config.world.getBlockAt(x, y, z))) {
|
||||
stationaryMovingPistons.add(new Vector(x, y, z));
|
||||
}
|
||||
});
|
||||
}, 1));
|
||||
|
||||
new StateDependentListener(ArenaMode.Prepare, FightState.Setup, this){
|
||||
new StateDependentListener(ArenaMode.Prepare, FightState.Setup, this) {
|
||||
@Override
|
||||
public void disable() {
|
||||
super.disable();
|
||||
@@ -65,32 +66,32 @@ public class PrepareSchem implements Listener {
|
||||
int minY = Fight.getUnrotated().getSchemRegion().getMinY();
|
||||
|
||||
SchematicNode schem;
|
||||
try{
|
||||
try {
|
||||
schem = SchematicNode.getSchematicNode(Config.PrepareSchemID);
|
||||
}catch(SecurityException e){
|
||||
} catch (SecurityException e) {
|
||||
FightSystem.getMessage().broadcast("PREPARE_SCHEM_DELETED");
|
||||
Bukkit.shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
try {
|
||||
region.forEach((x, y, z) -> {
|
||||
if(FlatteningWrapper.impl.checkPistonMoving(Config.world.getBlockAt(x, y, z)) && !stationaryMovingPistons.contains(new Vector(x, y, z))){
|
||||
if (FlatteningWrapper.impl.checkPistonMoving(Config.world.getBlockAt(x, y, z)) && !stationaryMovingPistons.contains(new Vector(x, y, z))) {
|
||||
FightSystem.getMessage().broadcast("PREPARE_ACTIVE_PISTON");
|
||||
Bukkit.shutdown();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
});
|
||||
}catch (IllegalStateException e){
|
||||
} catch (IllegalStateException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
schem.setSchemtype(Config.GameModeConfig.Schematic.Type.checkType());
|
||||
schem.setPrepared(true);
|
||||
|
||||
try{
|
||||
try {
|
||||
WorldeditWrapper.impl.saveSchem(schem, region, minY);
|
||||
}catch(WorldEditException e){
|
||||
} catch (WorldEditException e) {
|
||||
FightSystem.getMessage().broadcast("PREPARE_FAILED_SAVING");
|
||||
Bukkit.shutdown();
|
||||
schem.delete();
|
||||
@@ -112,7 +113,7 @@ public class PrepareSchem implements Listener {
|
||||
Fight.getUnrotated().addMember(player);
|
||||
}
|
||||
|
||||
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP) {
|
||||
if (FightState.getFightState() == FightState.PRE_LEADER_SETUP) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
FightState.setFightState(FightState.POST_SCHEM_SETUP);
|
||||
}
|
||||
|
||||
@@ -70,18 +70,19 @@ public class Recording implements Listener {
|
||||
private static final int AIR = 0;
|
||||
private static final Random random = new Random();
|
||||
|
||||
public static ItemStack disarmNull(ItemStack stack){
|
||||
if(stack == null)
|
||||
public static ItemStack disarmNull(ItemStack stack) {
|
||||
if (stack == null)
|
||||
return new ItemStack(Material.AIR);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static boolean isNotSent(LivingEntity p){
|
||||
public static boolean isNotSent(LivingEntity p) {
|
||||
FightPlayer fp = Fight.getFightPlayer(p);
|
||||
return fp == null || !fp.isLiving() || FightState.getFightState() == FightState.SPECTATE;
|
||||
}
|
||||
|
||||
public static final Class<?> primedTnt = PrimedTnt.class;
|
||||
|
||||
public static void iterateOverEntities(Predicate<Object> filter, Consumer<Entity> consumer) {
|
||||
CraftbukkitWrapper.impl.entityIterator().filter(filter).map(net.minecraft.world.entity.Entity::getBukkitEntity).forEach(consumer);
|
||||
}
|
||||
@@ -89,7 +90,7 @@ public class Recording implements Listener {
|
||||
public Recording() {
|
||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.All, this);
|
||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.All, BountifulWrapper.impl.newHandSwapRecorder());
|
||||
new StateDependent(ArenaMode.AntiReplay, FightState.Ingame){
|
||||
new StateDependent(ArenaMode.AntiReplay, FightState.Ingame) {
|
||||
@Override
|
||||
public void enable() {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> Fight.teams().forEach(Recording.this::setKitItems), 1);
|
||||
@@ -120,7 +121,7 @@ public class Recording implements Listener {
|
||||
new StateDependentTask(ArenaMode.AntiReplay, FightState.All, () -> {
|
||||
GlobalRecorder.getInstance().tick();
|
||||
|
||||
if(FightState.getFightState() == FightState.SPECTATE || !GlobalRecorder.getInstance().recording())
|
||||
if (FightState.getFightState() == FightState.SPECTATE || !GlobalRecorder.getInstance().recording())
|
||||
return;
|
||||
|
||||
iterateOverEntities(primedTnt::isInstance, this::trackEntity);
|
||||
@@ -136,16 +137,18 @@ public class Recording implements Listener {
|
||||
private static final Class<?> playerDigType = blockDigPacket.getDeclaredClasses()[0];
|
||||
private static final Reflection.Field<?> blockDigType = Reflection.getField(blockDigPacket, playerDigType, 0);
|
||||
private static final Object releaseUseItem = playerDigType.getEnumConstants()[5];
|
||||
|
||||
private Object blockDig(Player p, Object packet) {
|
||||
if(!isNotSent(p) && blockDigType.get(packet) == releaseUseItem)
|
||||
if (!isNotSent(p) && blockDigType.get(packet) == releaseUseItem)
|
||||
GlobalRecorder.getInstance().bowSpan(p, false, false);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static final Class<?> blockPlacePacket = ServerboundUseItemPacket.class;
|
||||
|
||||
private Object blockPlace(Player p, Object packet) {
|
||||
boolean mainHand = BountifulWrapper.impl.mainHand(packet);
|
||||
if(!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p))
|
||||
if (!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p))
|
||||
GlobalRecorder.getInstance().bowSpan(p, true, !mainHand);
|
||||
return packet;
|
||||
}
|
||||
@@ -156,8 +159,8 @@ public class Recording implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerMove(PlayerMoveEvent e){
|
||||
if(isNotSent(e.getPlayer()))
|
||||
public void onPlayerMove(PlayerMoveEvent e) {
|
||||
if (isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
GlobalRecorder.getInstance().entityMoves(e.getPlayer());
|
||||
@@ -174,66 +177,66 @@ public class Recording implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onBlockPhysics(BlockPhysicsEvent e){
|
||||
if(FlatteningWrapper.impl.doRecord(e))
|
||||
public void onBlockPhysics(BlockPhysicsEvent e) {
|
||||
if (FlatteningWrapper.impl.doRecord(e))
|
||||
GlobalRecorder.getInstance().blockChange(e.getBlock());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onSneak(PlayerToggleSneakEvent e){
|
||||
if(isNotSent(e.getPlayer()))
|
||||
public void onSneak(PlayerToggleSneakEvent e) {
|
||||
if (isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
GlobalRecorder.getInstance().playerSneak(e.getPlayer(), e.isSneaking());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onAnimation(PlayerAnimationEvent e){
|
||||
if(isNotSent(e.getPlayer()))
|
||||
public void onAnimation(PlayerAnimationEvent e) {
|
||||
if (isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
if(e.getAnimationType() == PlayerAnimationType.ARM_SWING)
|
||||
if (e.getAnimationType() == PlayerAnimationType.ARM_SWING)
|
||||
GlobalRecorder.getInstance().entityAnimation(e.getPlayer(), AIR);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent e) {
|
||||
if(!e.getEntityType().isAlive())
|
||||
if (!e.getEntityType().isAlive())
|
||||
return;
|
||||
|
||||
LivingEntity p = (LivingEntity) e.getEntity();
|
||||
if(isNotSent(p))
|
||||
if (isNotSent(p))
|
||||
return;
|
||||
|
||||
GlobalRecorder.getInstance().damageAnimation(p);
|
||||
|
||||
if(e.getCause() == EntityDamageEvent.DamageCause.FIRE_TICK || e.getCause() == EntityDamageEvent.DamageCause.FIRE)
|
||||
if (e.getCause() == EntityDamageEvent.DamageCause.FIRE_TICK || e.getCause() == EntityDamageEvent.DamageCause.FIRE)
|
||||
GlobalRecorder.getInstance().setOnFire(p, false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onEntityCombust(EntityCombustEvent e) {
|
||||
if(!e.getEntityType().isAlive())
|
||||
if (!e.getEntityType().isAlive())
|
||||
return;
|
||||
|
||||
LivingEntity p = (LivingEntity) e.getEntity();
|
||||
if(isNotSent(p))
|
||||
if (isNotSent(p))
|
||||
return;
|
||||
|
||||
GlobalRecorder.getInstance().setOnFire(p, false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onTNTSpawn(EntitySpawnEvent e){
|
||||
if(e.getEntityType() != EntityType.TNT)
|
||||
public void onTNTSpawn(EntitySpawnEvent e) {
|
||||
if (e.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
GlobalRecorder.getInstance().tntSpawn(e.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onExplosion(EntityExplodeEvent e){
|
||||
if(e.getEntityType() != EntityType.TNT)
|
||||
public void onExplosion(EntityExplodeEvent e) {
|
||||
if (e.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
Location loc = e.getLocation();
|
||||
@@ -243,31 +246,31 @@ public class Recording implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onItem(PlayerItemHeldEvent e){
|
||||
if(isNotSent(e.getPlayer()))
|
||||
public void onItem(PlayerItemHeldEvent e) {
|
||||
if (isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
GlobalRecorder.getInstance().item(e.getPlayer(), disarmNull(e.getPlayer().getInventory().getItem(e.getNewSlot())), "MAINHAND");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onProjectileSpawn(ProjectileLaunchEvent e){
|
||||
if(e.getEntityType() == EntityType.FIREBALL)
|
||||
public void onProjectileSpawn(ProjectileLaunchEvent e) {
|
||||
if (e.getEntityType() == EntityType.FIREBALL)
|
||||
GlobalRecorder.getInstance().fireballSpawn(e.getEntity());
|
||||
else if(e.getEntityType() == EntityType.ARROW)
|
||||
else if (e.getEntityType() == EntityType.ARROW)
|
||||
GlobalRecorder.getInstance().arrowSpawn(e.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onInventoryClick(InventoryClickEvent e){
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
if(isNotSent(player))
|
||||
if (isNotSent(player))
|
||||
return;
|
||||
|
||||
if(e.getSlotType() != InventoryType.SlotType.ARMOR)
|
||||
if (e.getSlotType() != InventoryType.SlotType.ARMOR)
|
||||
return;
|
||||
|
||||
switch(e.getSlot()){
|
||||
switch (e.getSlot()) {
|
||||
case 103:
|
||||
GlobalRecorder.getInstance().item(player, disarmNull(e.getCurrentItem()), "HEAD");
|
||||
break;
|
||||
@@ -283,12 +286,12 @@ public class Recording implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void setKitItems(FightTeam team){
|
||||
if(FightState.getFightState() != FightState.PRE_RUNNING)
|
||||
private void setKitItems(FightTeam team) {
|
||||
if (FightState.getFightState() != FightState.PRE_RUNNING)
|
||||
return;
|
||||
|
||||
for(FightPlayer fp : team.getPlayers()){
|
||||
if(!fp.isLiving())
|
||||
for (FightPlayer fp : team.getPlayers()) {
|
||||
if (!fp.isLiving())
|
||||
continue;
|
||||
|
||||
fp.ifPlayer(player -> {
|
||||
@@ -301,14 +304,14 @@ public class Recording implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void despawnTeam(FightTeam team){
|
||||
for(FightPlayer player : team.getPlayers()){
|
||||
if(player.isLiving())
|
||||
private void despawnTeam(FightTeam team) {
|
||||
for (FightPlayer player : team.getPlayers()) {
|
||||
if (player.isLiving())
|
||||
GlobalRecorder.getInstance().entityDespawns(player.getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
private void despawnTNT(){
|
||||
private void despawnTNT() {
|
||||
iterateOverEntities(primedTnt::isInstance, GlobalRecorder.getInstance()::entityDespawns);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class RunningWorldInteraction implements Listener {
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent e) {
|
||||
FightPlayer fp = Fight.getFightPlayer(e.getPlayer());
|
||||
if(fp != null && !fp.getKit().isTnt() && e.getBlockPlaced().getType() == Material.TNT){
|
||||
if (fp != null && !fp.getKit().isTnt() && e.getBlockPlaced().getType() == Material.TNT) {
|
||||
FightSystem.getMessage().sendPrefixless("NO_TNT_PLACE", e.getPlayer(), ChatMessageType.ACTION_BAR);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@Linked
|
||||
public class SetupQuit implements Listener {
|
||||
|
||||
public SetupQuit(){
|
||||
public SetupQuit() {
|
||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.Setup, this);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SetupQuit implements Listener {
|
||||
public void handlePlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
if(team == null)
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
team.removePlayer(player);
|
||||
|
||||
@@ -32,17 +32,17 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@Linked
|
||||
public class Shutdown implements Listener {
|
||||
|
||||
public Shutdown(){
|
||||
public Shutdown() {
|
||||
new StateDependentListener(ArenaMode.AntiEvent.contains(Config.mode) && !Config.replayserver(), FightState.All, this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerQuit(PlayerQuitEvent event) {
|
||||
if(Config.replayserver() || Config.GameModeConfig.Arena.Leaveable)
|
||||
if (Config.replayserver() || Config.GameModeConfig.Arena.Leaveable)
|
||||
return;
|
||||
|
||||
//Shutdown server if nobody online
|
||||
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer())))
|
||||
if (Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer())))
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Spectator implements Listener {
|
||||
public void handlePlayerJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
|
||||
if(player.getGameMode() == GameMode.SPECTATOR)
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
gameModeChange(player, GameMode.SPECTATOR);
|
||||
}
|
||||
|
||||
@@ -69,13 +69,13 @@ public class Spectator implements Listener {
|
||||
@SuppressWarnings("deprecation")
|
||||
private void gameModeChange(Player player, GameMode gameMode) {
|
||||
if (gameMode == GameMode.SPECTATOR) {
|
||||
for(Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if(p.getUniqueId() != player.getUniqueId())
|
||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (p.getUniqueId() != player.getUniqueId())
|
||||
p.hidePlayer(player);
|
||||
}
|
||||
} else {
|
||||
for(Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if(p.getUniqueId() != player.getUniqueId())
|
||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (p.getUniqueId() != player.getUniqueId())
|
||||
p.showPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,14 +55,14 @@ public class TeamArea implements Listener {
|
||||
@EventHandler
|
||||
public void playerJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if(Fight.getPlayerTeam(player) != team && !Config.isReferee(player))
|
||||
if (Fight.getPlayerTeam(player) != team && !Config.isReferee(player))
|
||||
spectatorBorder.addPlayer(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamJoin(TeamSpawnEvent e) {
|
||||
FightPlayer fightPlayer = e.getFightPlayer();
|
||||
if(fightPlayer.getTeam() == team) {
|
||||
if (fightPlayer.getTeam() == team) {
|
||||
fightPlayer.ifPlayer(player -> {
|
||||
spectatorBorder.removePlayer(player);
|
||||
bordingBorder.addPlayer(player);
|
||||
@@ -74,14 +74,14 @@ public class TeamArea implements Listener {
|
||||
public void teamLeave(TeamLeaveEvent e) {
|
||||
FightPlayer fightPlayer = e.getFightPlayer();
|
||||
fightPlayer.ifPlayer(spectatorBorder::addPlayer);
|
||||
if(fightPlayer.getTeam() == team)
|
||||
if (fightPlayer.getTeam() == team)
|
||||
fightPlayer.ifPlayer(bordingBorder::removePlayer);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void boarding(BoardingEvent e) {
|
||||
FightPlayer fightPlayer = e.getFightPlayer();
|
||||
if(fightPlayer.getTeam() == team) {
|
||||
if (fightPlayer.getTeam() == team) {
|
||||
fightPlayer.ifPlayer(bordingBorder::removePlayer);
|
||||
} else {
|
||||
fightPlayer.ifPlayer(spectatorBorder::removePlayer);
|
||||
@@ -94,7 +94,7 @@ public class TeamArea implements Listener {
|
||||
}
|
||||
|
||||
private void teamSpectator(FightPlayer fightPlayer) {
|
||||
if(fightPlayer.getTeam() == team) {
|
||||
if (fightPlayer.getTeam() == team) {
|
||||
fightPlayer.ifPlayer(bordingBorder::removePlayer);
|
||||
} else {
|
||||
fightPlayer.ifPlayer(spectatorBorder::addPlayer);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class TestJoin implements Listener {
|
||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
|
||||
if (Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
|
||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||
player.kickPlayer("");
|
||||
return;
|
||||
@@ -51,7 +51,7 @@ public class TestJoin implements Listener {
|
||||
|
||||
player.setOp(true);
|
||||
|
||||
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP){
|
||||
if (FightState.getFightState() == FightState.PRE_LEADER_SETUP) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
FightState.setFightState(FightState.POST_SCHEM_SETUP);
|
||||
}
|
||||
|
||||
+10
-10
@@ -47,7 +47,7 @@ public class WaterRemover implements Listener {
|
||||
private final Map<Integer, FightTeam> tnt = new HashMap<>();
|
||||
|
||||
public WaterRemover() {
|
||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.Running, this){
|
||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.Running, this) {
|
||||
@Override
|
||||
public void enable() {
|
||||
tnt.clear();
|
||||
@@ -58,12 +58,12 @@ public class WaterRemover implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleEntitySpawn(EntitySpawnEvent event) {
|
||||
if(event.getEntityType() != EntityType.TNT)
|
||||
if (event.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
Location location = event.getLocation();
|
||||
Fight.teams().forEach(team -> {
|
||||
if(team.getExtendRegion().inRegion(location))
|
||||
if (team.getExtendRegion().inRegion(location))
|
||||
tnt.put(event.getEntity().getEntityId(), team);
|
||||
});
|
||||
}
|
||||
@@ -73,11 +73,11 @@ public class WaterRemover implements Listener {
|
||||
event.setYield(0); //No drops (additionally to world config)
|
||||
|
||||
FightTeam spawn = tnt.remove(event.getEntity().getEntityId());
|
||||
if(Config.GameModeConfig.Arena.WaterDamage && spawn != null && !spawn.getExtendRegion().inRegion(event.getLocation())) {
|
||||
if (Config.GameModeConfig.Arena.WaterDamage && spawn != null && !spawn.getExtendRegion().inRegion(event.getLocation())) {
|
||||
Block b = event.getLocation().getBlock();
|
||||
for(int y = -1; y <= 1; y++) {
|
||||
for(int z = -1; z <= 1; z++) {
|
||||
for(int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
checkBlock(b.getRelative(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -98,14 +98,14 @@ public class WaterRemover implements Listener {
|
||||
|
||||
private void checkBlock(Block b) {
|
||||
//do not remove outside teamareas
|
||||
if(!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b))
|
||||
if (!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b))
|
||||
return;
|
||||
|
||||
//checks for water and removes it, if present
|
||||
if(!FlatteningWrapper.impl.removeWater(b))
|
||||
if (!FlatteningWrapper.impl.removeWater(b))
|
||||
return;
|
||||
|
||||
if(b.getY() < MIN_Y)
|
||||
if (b.getY() < MIN_Y)
|
||||
return;
|
||||
|
||||
checkNeighbours(b);
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class WindchargeStopper {
|
||||
boolean passedMiddle = location.getBlockZ() > middleLine && prevLocation.getBlockZ() > middleLine ||
|
||||
location.getBlockZ() < middleLine && prevLocation.getBlockZ() < middleLine;
|
||||
|
||||
if(!passedMiddle) {
|
||||
if (!passedMiddle) {
|
||||
entity.remove();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ public class FileRecorder extends StateDependent implements Recorder {
|
||||
private static final File file = new File(Config.world.getWorldFolder(), "recording.recording");
|
||||
private DataOutputStream outputStream;
|
||||
|
||||
public FileRecorder(){
|
||||
public FileRecorder() {
|
||||
super(Config.ReplayID == 0, FightState.Recording);
|
||||
register();
|
||||
}
|
||||
@@ -47,8 +47,8 @@ public class FileRecorder extends StateDependent implements Recorder {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
try{
|
||||
outputStream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file), 4096)){
|
||||
try {
|
||||
outputStream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file), 4096)) {
|
||||
@Override
|
||||
public synchronized void flush() {
|
||||
//Don't flush explicitly (performance)
|
||||
@@ -56,15 +56,15 @@ public class FileRecorder extends StateDependent implements Recorder {
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
try{
|
||||
try {
|
||||
super.flush();
|
||||
}catch(IOException e){
|
||||
} catch (IOException e) {
|
||||
//do nothing
|
||||
}
|
||||
super.close();
|
||||
}
|
||||
});
|
||||
}catch(IOException e){
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException("Could not open file", e);
|
||||
}
|
||||
Recorder.super.enable();
|
||||
|
||||
@@ -33,7 +33,7 @@ public class FileSource extends PacketSource {
|
||||
}
|
||||
|
||||
public static void startReplay() {
|
||||
if(Config.replayserver()) {
|
||||
if (Config.replayserver()) {
|
||||
try {
|
||||
new LiveServer();
|
||||
} catch (IOException e) {
|
||||
@@ -42,7 +42,7 @@ public class FileSource extends PacketSource {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Config.ReplayID > 0) {
|
||||
if (Config.ReplayID > 0) {
|
||||
try {
|
||||
new FileSource(replayFile(Config.ReplayID));
|
||||
} catch (IOException e) {
|
||||
@@ -58,9 +58,9 @@ public class FileSource extends PacketSource {
|
||||
|
||||
@Override
|
||||
boolean isClosed() {
|
||||
try{
|
||||
try {
|
||||
return available() == 0;
|
||||
}catch (IOException e){
|
||||
} catch (IOException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,22 +32,22 @@ public class GlobalRecorder extends OutputStream implements Recorder {
|
||||
|
||||
private static final GlobalRecorder recorder = new GlobalRecorder();
|
||||
|
||||
public static GlobalRecorder getInstance(){
|
||||
public static GlobalRecorder getInstance() {
|
||||
return recorder;
|
||||
}
|
||||
|
||||
private final List<Recorder> recorders = new ArrayList<>();
|
||||
private final DataOutputStream outputStream = new DataOutputStream(this);
|
||||
|
||||
public void add(Recorder recorder){
|
||||
public void add(Recorder recorder) {
|
||||
recorders.add(recorder);
|
||||
}
|
||||
|
||||
public void remove(Recorder recorder){
|
||||
public void remove(Recorder recorder) {
|
||||
recorders.remove(recorder);
|
||||
}
|
||||
|
||||
public boolean recording(){
|
||||
|
||||
public boolean recording() {
|
||||
return !recorders.isEmpty();
|
||||
}
|
||||
|
||||
@@ -77,11 +77,11 @@ public class GlobalRecorder extends OutputStream implements Recorder {
|
||||
}
|
||||
|
||||
private void foreach(IOThrower thrower) {
|
||||
for(int i = 0; i < recorders.size(); i++) {
|
||||
for (int i = 0; i < recorders.size(); i++) {
|
||||
Recorder stream = recorders.get(i);
|
||||
try{
|
||||
try {
|
||||
thrower.run(stream.getStream());
|
||||
}catch (IOException e){
|
||||
} catch (IOException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not operate on OutputStream", e);
|
||||
stream.disable();
|
||||
i--; // Recorder was removed from recorders
|
||||
@@ -89,7 +89,7 @@ public class GlobalRecorder extends OutputStream implements Recorder {
|
||||
}
|
||||
}
|
||||
|
||||
interface IOThrower{
|
||||
interface IOThrower {
|
||||
void run(OutputStream stream) throws IOException;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LiveRecorder extends StateDependent implements Recorder {
|
||||
private DataOutputStream outputStream;
|
||||
private Socket socket;
|
||||
|
||||
public LiveRecorder(){
|
||||
public LiveRecorder() {
|
||||
super(Config.LiveReplay, FightState.AntiSpectate);
|
||||
register();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LiveServer {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::acceptConnections);
|
||||
}
|
||||
|
||||
public void close(){
|
||||
public void close() {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
@@ -45,13 +45,13 @@ public class LiveServer {
|
||||
}
|
||||
}
|
||||
|
||||
private void acceptConnections(){
|
||||
private void acceptConnections() {
|
||||
try {
|
||||
while(!socket.isClosed()){
|
||||
while (!socket.isClosed()) {
|
||||
Socket s = socket.accept();
|
||||
if(PacketProcessor.isReplaying()){
|
||||
if (PacketProcessor.isReplaying()) {
|
||||
s.close();
|
||||
}else{
|
||||
} else {
|
||||
new LiveSource(s);
|
||||
}
|
||||
}
|
||||
|
||||
+42
-41
@@ -70,6 +70,7 @@ import java.util.stream.Collectors;
|
||||
public class PacketProcessor implements Listener {
|
||||
|
||||
private static final org.bukkit.scoreboard.Team team = FightScoreboard.getBukkitTeam("Replay");
|
||||
|
||||
static {
|
||||
BountifulWrapper.impl.setNametagVisibility(team);
|
||||
team.setNameTagVisibility(NameTagVisibility.NEVER);
|
||||
@@ -81,7 +82,7 @@ public class PacketProcessor implements Listener {
|
||||
return currentProcessor;
|
||||
}
|
||||
|
||||
public static boolean isReplaying(){
|
||||
public static boolean isReplaying() {
|
||||
return currentProcessor != null;
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ public class PacketProcessor implements Listener {
|
||||
private int arenaMinZ = Config.ArenaRegion.getMinZ();
|
||||
|
||||
private boolean skipToSubtitle = false;
|
||||
|
||||
|
||||
private boolean tickFinished = false;
|
||||
private final List<Integer> lastPackets = new LinkedList<>();
|
||||
|
||||
@@ -158,14 +159,14 @@ public class PacketProcessor implements Listener {
|
||||
|
||||
execSync(FightWorld::forceLoad);
|
||||
|
||||
if(source.async()) {
|
||||
if (source.async()) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::process);
|
||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::runSync, 1, 1);
|
||||
}else
|
||||
} else
|
||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::process, 1, 1);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, FightSystem.getPlugin());
|
||||
for(Player player : Bukkit.getOnlinePlayers())
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
entityServer.addPlayer(player);
|
||||
}
|
||||
|
||||
@@ -189,9 +190,9 @@ public class PacketProcessor implements Listener {
|
||||
|
||||
execSync(() -> {
|
||||
FightTeam winner = null;
|
||||
if(team == 0x01)
|
||||
if (team == 0x01)
|
||||
winner = Fight.getBlueTeam();
|
||||
else if(team == 0x02)
|
||||
else if (team == 0x02)
|
||||
winner = Fight.getRedTeam();
|
||||
|
||||
FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams());
|
||||
@@ -216,10 +217,10 @@ public class PacketProcessor implements Listener {
|
||||
|
||||
private void runSync() {
|
||||
synchronized (syncList) {
|
||||
for(Runnable runnable : syncList) {
|
||||
try{
|
||||
for (Runnable runnable : syncList) {
|
||||
try {
|
||||
runnable.run();
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to execute packet LastPacket: " + Arrays.toString(lastPackets.toArray()), e);
|
||||
}
|
||||
}
|
||||
@@ -227,7 +228,7 @@ public class PacketProcessor implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void execSync(Runnable runnable){
|
||||
private void execSync(Runnable runnable) {
|
||||
if (!source.async()) {
|
||||
runnable.run();
|
||||
return;
|
||||
@@ -247,7 +248,7 @@ public class PacketProcessor implements Listener {
|
||||
addREntity(entityId, new RPlayer(entityServer, user.getUUID(), user.getUserName(), Config.SpecSpawn));
|
||||
team.addEntry(user.getUserName());
|
||||
|
||||
if(ArenaMode.Test.contains(Config.mode))
|
||||
if (ArenaMode.Test.contains(Config.mode))
|
||||
entities.get(entityId).setGlowing(true);
|
||||
});
|
||||
}
|
||||
@@ -257,7 +258,7 @@ public class PacketProcessor implements Listener {
|
||||
double x = source.readDouble() - arenaMinX;
|
||||
double locY = source.readDouble() - arenaMinY + Config.BluePasteRegion.getMinY();
|
||||
double z = source.readDouble() - arenaMinZ;
|
||||
if(rotateZ) {
|
||||
if (rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
@@ -265,11 +266,11 @@ public class PacketProcessor implements Listener {
|
||||
double locZ = z + Config.ArenaRegion.getMinZ();
|
||||
float pitch = source.readFloat();
|
||||
float yaw = source.readFloat() + (rotateZ ? 180 : 0);
|
||||
byte headYaw = (byte)((source.readByte() + (rotateZ ? 128 : 0)) % 256);
|
||||
byte headYaw = (byte) ((source.readByte() + (rotateZ ? 128 : 0)) % 256);
|
||||
|
||||
execSync(() -> {
|
||||
REntity entity = entities.get(entityId);
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
entity.move(locX, locY, locZ, pitch, yaw, headYaw);
|
||||
FightSystem.getHullHider().updateREntity(entity);
|
||||
}
|
||||
@@ -281,7 +282,7 @@ public class PacketProcessor implements Listener {
|
||||
|
||||
execSync(() -> {
|
||||
REntity entity = entities.remove(entityId);
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
FightSystem.getHullHider().despawnREntity(entity);
|
||||
entity.die();
|
||||
}
|
||||
@@ -317,7 +318,7 @@ public class PacketProcessor implements Listener {
|
||||
|
||||
execSync(() -> {
|
||||
REntity entity = entities.get(entityId);
|
||||
if(entity != null)
|
||||
if (entity != null)
|
||||
entity.setVelocity(dX, dY, dZ);
|
||||
});
|
||||
}
|
||||
@@ -329,11 +330,11 @@ public class PacketProcessor implements Listener {
|
||||
String slotName = source.readUTF();
|
||||
|
||||
ItemStack stack = new ItemStack(Material.valueOf(item.replace("minecraft:", "").toUpperCase()), 1);
|
||||
if(enchanted)
|
||||
if (enchanted)
|
||||
stack.addUnsafeEnchantment(Enchantment.UNBREAKING, 1);
|
||||
|
||||
EquipmentSlot slot;
|
||||
switch(slotName){
|
||||
switch (slotName) {
|
||||
case "HEAD":
|
||||
slot = EquipmentSlot.HEAD;
|
||||
break;
|
||||
@@ -414,7 +415,7 @@ public class PacketProcessor implements Listener {
|
||||
int z = Byte.toUnsignedInt(source.readByte());
|
||||
int blockState = source.readShort();
|
||||
|
||||
if(rotateZ) {
|
||||
if (rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
@@ -428,7 +429,7 @@ public class PacketProcessor implements Listener {
|
||||
int z = source.readInt() - arenaMinZ;
|
||||
int blockState = source.readInt();
|
||||
|
||||
if(rotateZ) {
|
||||
if (rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
@@ -442,7 +443,7 @@ public class PacketProcessor implements Listener {
|
||||
int z = source.readInt() - arenaMinZ;
|
||||
int blockState = source.readInt();
|
||||
|
||||
if(rotateZ) {
|
||||
if (rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
@@ -450,8 +451,8 @@ public class PacketProcessor implements Listener {
|
||||
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState);
|
||||
}
|
||||
|
||||
private void setBlock(int x, int y, int z, int blockState){
|
||||
if(!Config.ArenaRegion.in2dRegion(x, z))
|
||||
private void setBlock(int x, int y, int z, int blockState) {
|
||||
if (!Config.ArenaRegion.in2dRegion(x, z))
|
||||
return; //Outside of the arena
|
||||
|
||||
execSync(() -> {
|
||||
@@ -466,7 +467,7 @@ public class PacketProcessor implements Listener {
|
||||
double z = source.readDouble() - arenaMinZ;
|
||||
String particleName = source.readUTF();
|
||||
|
||||
if(rotateZ) {
|
||||
if (rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
@@ -481,7 +482,7 @@ public class PacketProcessor implements Listener {
|
||||
int y = source.readInt() - arenaMinY + Config.BluePasteRegion.getMinY();
|
||||
int rawZ = source.readInt() - arenaMinZ;
|
||||
|
||||
if(rotateZ) {
|
||||
if (rotateZ) {
|
||||
rawX = Config.ArenaRegion.getSizeX() - rawX;
|
||||
rawZ = Config.ArenaRegion.getSizeZ() - rawZ;
|
||||
}
|
||||
@@ -513,7 +514,7 @@ public class PacketProcessor implements Listener {
|
||||
|
||||
private void pasteSchem(FightTeam team) throws IOException {
|
||||
int schemId = source.readInt();
|
||||
if(schemId == 0)
|
||||
if (schemId == 0)
|
||||
return;
|
||||
|
||||
execSync(() -> team.pasteSchem(SchematicNode.getSchematicNode(schemId)));
|
||||
@@ -549,7 +550,7 @@ public class PacketProcessor implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
private void pasteForTeam(int teamId, FightTeam fightTeam){
|
||||
private void pasteForTeam(int teamId, FightTeam fightTeam) {
|
||||
Team team = Team.byId(teamId);
|
||||
fightTeam.setPrefixAndName("§" + team.getTeamColor(), team.getTeamKuerzel());
|
||||
fightTeam.pasteTeamName();
|
||||
@@ -610,7 +611,7 @@ public class PacketProcessor implements Listener {
|
||||
entities.clear();
|
||||
|
||||
freezer.disable();
|
||||
if(!Config.replayserver()) {
|
||||
if (!Config.replayserver()) {
|
||||
FightSystem.getMessage().broadcast("REPLAY_ENDS");
|
||||
}
|
||||
if (FightSystem.getLastWinner() != null) {
|
||||
@@ -648,17 +649,17 @@ public class PacketProcessor implements Listener {
|
||||
execSync(() -> entities.get(entityId).setOnFire(perma));
|
||||
}
|
||||
|
||||
private void tick(){
|
||||
private void tick() {
|
||||
execSync(entityServer::tick);
|
||||
|
||||
if(!source.async() && !skipToSubtitle)
|
||||
if (!source.async() && !skipToSubtitle)
|
||||
tickFinished = true;
|
||||
}
|
||||
|
||||
private void process(){
|
||||
private void process() {
|
||||
tickFinished = false;
|
||||
try{
|
||||
while(!source.isClosed() && !tickFinished){
|
||||
try {
|
||||
while (!source.isClosed() && !tickFinished) {
|
||||
int packetType = Byte.toUnsignedInt(source.readByte());
|
||||
|
||||
lastPackets.add(packetType);
|
||||
@@ -666,9 +667,9 @@ public class PacketProcessor implements Listener {
|
||||
lastPackets.remove(0);
|
||||
|
||||
PacketParser parser = packetDecoder[packetType];
|
||||
if(parser != null){
|
||||
if (parser != null) {
|
||||
parser.process();
|
||||
}else{
|
||||
} else {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet " + packetType + " recieved, closing. LastPacket: " + Arrays.toString(lastPackets.toArray()));
|
||||
source.close();
|
||||
}
|
||||
@@ -676,12 +677,12 @@ public class PacketProcessor implements Listener {
|
||||
} catch (EOFException e) {
|
||||
Bukkit.getLogger().log(Level.INFO, "The FightServer is offline");
|
||||
source.close();
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Could not recieve packet, LastPacket: " + Arrays.toString(lastPackets.toArray()), e);
|
||||
source.close();
|
||||
}
|
||||
|
||||
if(source.isClosed()){
|
||||
if (source.isClosed()) {
|
||||
execSync(() -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::endReplay));
|
||||
}
|
||||
}
|
||||
@@ -690,9 +691,9 @@ public class PacketProcessor implements Listener {
|
||||
String msg = source.readUTF();
|
||||
List<Object> params = new ArrayList<>();
|
||||
|
||||
while(true) {
|
||||
while (true) {
|
||||
int type = source.readUnsignedByte();
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case 0x00:
|
||||
return new Message(msg, params.toArray());
|
||||
case 0x01:
|
||||
@@ -725,7 +726,7 @@ public class PacketProcessor implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private interface PacketParser{
|
||||
private interface PacketParser {
|
||||
void process() throws IOException;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ import java.util.logging.Level;
|
||||
|
||||
public abstract class PacketSource extends DataInputStream {
|
||||
|
||||
protected PacketSource(InputStream inputStream){
|
||||
protected PacketSource(InputStream inputStream) {
|
||||
super(inputStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
public void close() {
|
||||
try {
|
||||
super.close();
|
||||
} catch (IOException e) {
|
||||
@@ -42,5 +42,6 @@ public abstract class PacketSource extends DataInputStream {
|
||||
}
|
||||
|
||||
abstract boolean isClosed();
|
||||
|
||||
abstract boolean async();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface Recorder {
|
||||
default void enable() {
|
||||
GlobalRecorder.getInstance().add(this);
|
||||
|
||||
if(ArenaMode.Event.contains(Config.mode)){
|
||||
if (ArenaMode.Event.contains(Config.mode)) {
|
||||
teamIds(Config.EventTeamBlueID, Config.EventTeamRedID);
|
||||
}
|
||||
|
||||
@@ -58,17 +58,17 @@ public interface Recorder {
|
||||
Fight.teams().forEach(this::enableTeam);
|
||||
}
|
||||
|
||||
default void enableTeam(FightTeam team){
|
||||
if(FightState.Schem.contains(FightState.getFightState())){
|
||||
if(team.isBlue())
|
||||
default void enableTeam(FightTeam team) {
|
||||
if (FightState.Schem.contains(FightState.getFightState())) {
|
||||
if (team.isBlue())
|
||||
blueSchem(team.getSchematic(), false);
|
||||
else
|
||||
redSchem(team.getSchematic(), false);
|
||||
}
|
||||
|
||||
if(FightState.AntiSpectate.contains(FightState.getFightState())){
|
||||
for(FightPlayer player : team.getPlayers()){
|
||||
if(player.isLiving()){
|
||||
if (FightState.AntiSpectate.contains(FightState.getFightState())) {
|
||||
for (FightPlayer player : team.getPlayers()) {
|
||||
if (player.isLiving()) {
|
||||
playerJoins(player.getEntity(), player.getUser());
|
||||
}
|
||||
}
|
||||
@@ -151,52 +151,52 @@ public interface Recorder {
|
||||
* 0x08: Message following
|
||||
* */
|
||||
|
||||
default void playerJoins(LivingEntity p, SteamwarUser user){
|
||||
default void playerJoins(LivingEntity p, SteamwarUser user) {
|
||||
write(0x00, p.getEntityId(), user.getId());
|
||||
entityMoves(p);
|
||||
}
|
||||
|
||||
default void entityMoves(Entity e){
|
||||
default void entityMoves(Entity e) {
|
||||
Location location = e.getLocation();
|
||||
write(0x01, e.getEntityId(), location.getX(), location.getY(), location.getZ(), location.getPitch(), location.getYaw(), (byte) (CraftbukkitWrapper.impl.headRotation(e) * 256 / 360));
|
||||
}
|
||||
|
||||
default void entityDespawns(Entity e){
|
||||
default void entityDespawns(Entity e) {
|
||||
write(0x02, e.getEntityId());
|
||||
}
|
||||
|
||||
default void playerSneak(Player p, boolean sneaks){
|
||||
default void playerSneak(Player p, boolean sneaks) {
|
||||
write(0x03, p.getEntityId(), sneaks);
|
||||
}
|
||||
|
||||
default void entityAnimation(Entity e, int animation){
|
||||
write(0x04, e.getEntityId(), (byte)animation);
|
||||
default void entityAnimation(Entity e, int animation) {
|
||||
write(0x04, e.getEntityId(), (byte) animation);
|
||||
}
|
||||
|
||||
default void tntSpawn(Entity e){
|
||||
default void tntSpawn(Entity e) {
|
||||
write(0x05, e.getEntityId());
|
||||
entityMoves(e);
|
||||
entitySpeed(e);
|
||||
}
|
||||
|
||||
default void entitySpeed(Entity e){
|
||||
default void entitySpeed(Entity e) {
|
||||
Vector velocity = e.getVelocity();
|
||||
write(0x06, e.getEntityId(), velocity.getX(), velocity.getY(), velocity.getZ());
|
||||
}
|
||||
|
||||
default void item(Player p, ItemStack item, String slot){
|
||||
default void item(Player p, ItemStack item, String slot) {
|
||||
write(0x07, p.getEntityId(), "minecraft:" + item.getType().name().toLowerCase(), !item.getEnchantments().isEmpty(), slot);
|
||||
}
|
||||
|
||||
default void arrowSpawn(Entity e){
|
||||
default void arrowSpawn(Entity e) {
|
||||
write(0x08, e.getEntityId());
|
||||
entityMoves(e);
|
||||
entitySpeed(e);
|
||||
if(e.getFireTicks() > 0)
|
||||
if (e.getFireTicks() > 0)
|
||||
setOnFire(e, true);
|
||||
}
|
||||
|
||||
default void fireballSpawn(Entity e){
|
||||
default void fireballSpawn(Entity e) {
|
||||
write(0x09, e.getEntityId());
|
||||
entityMoves(e);
|
||||
entitySpeed(e);
|
||||
@@ -214,34 +214,34 @@ public interface Recorder {
|
||||
write(0x0c, e.getEntityId(), perma);
|
||||
}
|
||||
|
||||
default void arenaInfo(){
|
||||
default void arenaInfo() {
|
||||
write(0x21, Config.blueNegZ(), Config.ArenaRegion.getMinX(), Config.BluePasteRegion.getMinY(), Config.ArenaRegion.getMinZ());
|
||||
}
|
||||
|
||||
default void blockChange(Block block){
|
||||
default void blockChange(Block block) {
|
||||
int blockState = BlockIdWrapper.impl.blockToId(block);
|
||||
|
||||
int shortX = block.getX() - Config.ArenaRegion.getMinX();
|
||||
int shortY = block.getY() - Config.BluePasteRegion.getMinY();
|
||||
int shortZ = block.getZ() - Config.ArenaRegion.getMinZ();
|
||||
if((short)blockState == blockState && shortX >= 0 && shortX < 256 && shortY >= 0 && shortZ >= 0 && shortZ < 256){
|
||||
if ((short) blockState == blockState && shortX >= 0 && shortX < 256 && shortY >= 0 && shortZ >= 0 && shortZ < 256) {
|
||||
//Short block packet
|
||||
write(0x35, (byte)shortX, (byte)shortY, (byte)shortZ, (short)blockState);
|
||||
}else{
|
||||
write(0x35, (byte) shortX, (byte) shortY, (byte) shortZ, (short) blockState);
|
||||
} else {
|
||||
//Block packet
|
||||
write(0x36, block.getX(), (short)block.getY(), block.getZ(), blockState);
|
||||
write(0x36, block.getX(), (short) block.getY(), block.getZ(), blockState);
|
||||
}
|
||||
}
|
||||
|
||||
default void particle(double x, double y, double z, String particleType){
|
||||
default void particle(double x, double y, double z, String particleType) {
|
||||
write(0x31, x, y, z, particleType);
|
||||
}
|
||||
|
||||
default void sound(int x, int y, int z, SWSound soundType, String soundCategory, float volume, float pitch){
|
||||
default void sound(int x, int y, int z, SWSound soundType, String soundCategory, float volume, float pitch) {
|
||||
write(0x32, x, y, z, soundType.getSound().name(), soundCategory, volume, pitch);
|
||||
}
|
||||
|
||||
default void soundAtPlayer(String soundType, float volume, float pitch){
|
||||
default void soundAtPlayer(String soundType, float volume, float pitch) {
|
||||
write(0x34, soundType, volume, pitch);
|
||||
}
|
||||
|
||||
@@ -275,16 +275,16 @@ public interface Recorder {
|
||||
write(packetId, changeRotate);
|
||||
}
|
||||
|
||||
default void schem(int embedId, int noEmbedId, int schemId){
|
||||
if(schemId == 0) {
|
||||
default void schem(int embedId, int noEmbedId, int schemId) {
|
||||
if (schemId == 0) {
|
||||
write(noEmbedId, schemId);
|
||||
return;
|
||||
}
|
||||
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
try{
|
||||
try {
|
||||
copy(NodeData.getLatest(SchematicNode.getSchematicNode(schemId)).schemData(true), buffer);
|
||||
}catch (EOFException e) {
|
||||
} catch (EOFException e) {
|
||||
Bukkit.getLogger().log(Level.INFO, "EOFException ignored");
|
||||
} catch (IOException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e);
|
||||
@@ -297,7 +297,7 @@ public interface Recorder {
|
||||
|
||||
static void copy(InputStream input, OutputStream output) throws IOException {
|
||||
int bytes;
|
||||
for(byte[] buffer = new byte[8192]; (bytes = input.read(buffer)) > 0;) {
|
||||
for (byte[] buffer = new byte[8192]; (bytes = input.read(buffer)) > 0; ) {
|
||||
output.write(buffer, 0, bytes);
|
||||
}
|
||||
}
|
||||
@@ -312,22 +312,22 @@ public interface Recorder {
|
||||
|
||||
default void winMessage(FightTeam team, String subtitle, Object... params) {
|
||||
byte bTeam = 0x00;
|
||||
if(team != null) {
|
||||
if (team != null) {
|
||||
bTeam = (byte) (team.isBlue() ? 0x01 : 0x02);
|
||||
}
|
||||
write(0xc6, bTeam, new Message(subtitle, params));
|
||||
}
|
||||
|
||||
default void tick(){
|
||||
default void tick() {
|
||||
write(0xff);
|
||||
}
|
||||
|
||||
default void write(int id, Object... objects){
|
||||
default void write(int id, Object... objects) {
|
||||
DataOutputStream stream = getStream();
|
||||
synchronized (stream) {
|
||||
try {
|
||||
stream.writeByte(id);
|
||||
for(Object o : objects) {
|
||||
for (Object o : objects) {
|
||||
writeObject(stream, o);
|
||||
}
|
||||
stream.flush();
|
||||
@@ -339,25 +339,25 @@ public interface Recorder {
|
||||
}
|
||||
|
||||
default void writeObject(DataOutputStream stream, Object o) throws IOException {
|
||||
if(o instanceof Boolean)
|
||||
stream.writeBoolean((Boolean)o);
|
||||
else if(o instanceof Byte)
|
||||
stream.writeByte((Byte)o);
|
||||
else if(o instanceof Short)
|
||||
stream.writeShort((Short)o);
|
||||
else if(o instanceof Integer)
|
||||
stream.writeInt((Integer)o);
|
||||
else if(o instanceof Long)
|
||||
stream.writeLong((Long)o);
|
||||
else if(o instanceof Float)
|
||||
stream.writeFloat((Float)o);
|
||||
else if(o instanceof Double)
|
||||
stream.writeDouble((Double)o);
|
||||
else if(o instanceof String)
|
||||
stream.writeUTF((String)o);
|
||||
else if(o instanceof byte[])
|
||||
stream.write((byte[])o);
|
||||
else if(o instanceof Message)
|
||||
if (o instanceof Boolean)
|
||||
stream.writeBoolean((Boolean) o);
|
||||
else if (o instanceof Byte)
|
||||
stream.writeByte((Byte) o);
|
||||
else if (o instanceof Short)
|
||||
stream.writeShort((Short) o);
|
||||
else if (o instanceof Integer)
|
||||
stream.writeInt((Integer) o);
|
||||
else if (o instanceof Long)
|
||||
stream.writeLong((Long) o);
|
||||
else if (o instanceof Float)
|
||||
stream.writeFloat((Float) o);
|
||||
else if (o instanceof Double)
|
||||
stream.writeDouble((Double) o);
|
||||
else if (o instanceof String)
|
||||
stream.writeUTF((String) o);
|
||||
else if (o instanceof byte[])
|
||||
stream.write((byte[]) o);
|
||||
else if (o instanceof Message)
|
||||
writeMessage(stream, (Message) o);
|
||||
else
|
||||
throw new SecurityException("Undefined write for: " + o.getClass().getName());
|
||||
@@ -365,22 +365,22 @@ public interface Recorder {
|
||||
|
||||
default void writeMessage(DataOutputStream stream, Message message) throws IOException {
|
||||
stream.writeUTF(message.getMsg());
|
||||
for(Object o : message.getParams()) {
|
||||
if(o instanceof Boolean)
|
||||
for (Object o : message.getParams()) {
|
||||
if (o instanceof Boolean)
|
||||
stream.writeByte(0x01);
|
||||
else if(o instanceof Byte)
|
||||
else if (o instanceof Byte)
|
||||
stream.writeByte(0x02);
|
||||
else if(o instanceof Short)
|
||||
else if (o instanceof Short)
|
||||
stream.writeByte(0x03);
|
||||
else if(o instanceof Integer)
|
||||
else if (o instanceof Integer)
|
||||
stream.writeByte(0x04);
|
||||
else if(o instanceof Float)
|
||||
else if (o instanceof Float)
|
||||
stream.writeByte(0x05);
|
||||
else if(o instanceof Double)
|
||||
else if (o instanceof Double)
|
||||
stream.writeByte(0x06);
|
||||
else if(o instanceof String)
|
||||
else if (o instanceof String)
|
||||
stream.writeByte(0x07);
|
||||
else if(o instanceof Message)
|
||||
else if (o instanceof Message)
|
||||
stream.writeByte(0x08);
|
||||
else
|
||||
throw new SecurityException("Undefined message serialization for: " + o.getClass().getName());
|
||||
|
||||
@@ -54,42 +54,42 @@ public enum FightState {
|
||||
@Getter
|
||||
private static FightState fightState = PRE_LEADER_SETUP;
|
||||
|
||||
public static void registerStateDependent(IStateDependent stateDependent){
|
||||
if(stateDependent.enabled().isEmpty())
|
||||
public static void registerStateDependent(IStateDependent stateDependent) {
|
||||
if (stateDependent.enabled().isEmpty())
|
||||
return;
|
||||
boolean enabled = stateDependent.enabled().contains(fightState);
|
||||
stateDependentFeatures.put(stateDependent, enabled);
|
||||
if(enabled)
|
||||
if (enabled)
|
||||
stateDependent.enable();
|
||||
}
|
||||
|
||||
public static void setFightState(FightState state){
|
||||
public static void setFightState(FightState state) {
|
||||
fightState = state;
|
||||
|
||||
for(Map.Entry<IStateDependent, Boolean> feature : stateDependentFeatures.entrySet()){
|
||||
for (Map.Entry<IStateDependent, Boolean> feature : stateDependentFeatures.entrySet()) {
|
||||
//Enable feature if should be enabled and currently disabled
|
||||
if(feature.getKey().enabled().contains(fightState) && !feature.getValue()){
|
||||
if (feature.getKey().enabled().contains(fightState) && !feature.getValue()) {
|
||||
feature.getKey().enable();
|
||||
feature.setValue(true);
|
||||
}
|
||||
|
||||
//Disable feature if should be disabled and currently enabled
|
||||
if(!feature.getKey().enabled().contains(fightState) && feature.getValue()){
|
||||
if (!feature.getKey().enabled().contains(fightState) && feature.getValue()) {
|
||||
feature.getKey().disable();
|
||||
feature.setValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean setup(){
|
||||
public static boolean setup() {
|
||||
return Setup.contains(fightState);
|
||||
}
|
||||
|
||||
public static boolean ingame(){
|
||||
public static boolean ingame() {
|
||||
return Ingame.contains(fightState);
|
||||
}
|
||||
|
||||
public static boolean infight(){
|
||||
public static boolean infight() {
|
||||
return fightState == RUNNING;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class OneShotStateDependent extends StateDependent{
|
||||
public class OneShotStateDependent extends StateDependent {
|
||||
|
||||
private final Runnable runnable;
|
||||
|
||||
|
||||
@@ -30,21 +30,21 @@ public abstract class StateDependent implements IStateDependent {
|
||||
private final Set<FightState> enabled;
|
||||
private final boolean register;
|
||||
|
||||
protected StateDependent(Winconditions wincondition, Set<FightState> states){
|
||||
protected StateDependent(Winconditions wincondition, Set<FightState> states) {
|
||||
this(Config.GameModeConfig.WinConditions.contains(wincondition), states);
|
||||
}
|
||||
|
||||
protected StateDependent(Set<ArenaMode> mode, Set<FightState> states){
|
||||
protected StateDependent(Set<ArenaMode> mode, Set<FightState> states) {
|
||||
this(mode.contains(Config.mode), states);
|
||||
}
|
||||
|
||||
protected StateDependent(boolean enabled, Set<FightState> states){
|
||||
protected StateDependent(boolean enabled, Set<FightState> states) {
|
||||
this.enabled = states;
|
||||
this.register = enabled;
|
||||
}
|
||||
|
||||
public void register(){
|
||||
if(register)
|
||||
public void register() {
|
||||
if (register)
|
||||
FightState.registerStateDependent(this);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ public class StateDependentCountdown extends StateDependent {
|
||||
register();
|
||||
}
|
||||
|
||||
public Countdown getCountdown(){
|
||||
public Countdown getCountdown() {
|
||||
return countdown;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class StateDependentCountdown extends StateDependent {
|
||||
@Override
|
||||
public void disable() {
|
||||
countdown.disable();
|
||||
if(mainCountdown == countdown)
|
||||
if (mainCountdown == countdown)
|
||||
mainCountdown = null;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -29,17 +29,17 @@ import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class StateDependentListener extends StateDependent{
|
||||
public class StateDependentListener extends StateDependent {
|
||||
|
||||
private final Listener listener;
|
||||
|
||||
public StateDependentListener(Winconditions wincondition, Set<FightState> states, Listener listener){
|
||||
public StateDependentListener(Winconditions wincondition, Set<FightState> states, Listener listener) {
|
||||
super(Config.GameModeConfig.WinConditions.contains(wincondition), states);
|
||||
this.listener = listener;
|
||||
register();
|
||||
}
|
||||
|
||||
public StateDependentListener(boolean enabled, Set<FightState> states, Listener listener){
|
||||
public StateDependentListener(boolean enabled, Set<FightState> states, Listener listener) {
|
||||
super(enabled, states);
|
||||
this.listener = listener;
|
||||
register();
|
||||
|
||||
+2
-2
@@ -36,11 +36,11 @@ public class StateDependentTask extends StateDependent {
|
||||
|
||||
private BukkitTask task = null;
|
||||
|
||||
public StateDependentTask(Winconditions wincondition, Set<FightState> states, Runnable runnable, long delay, long period){
|
||||
public StateDependentTask(Winconditions wincondition, Set<FightState> states, Runnable runnable, long delay, long period) {
|
||||
this(Config.GameModeConfig.WinConditions.contains(wincondition), states, runnable, delay, period);
|
||||
}
|
||||
|
||||
public StateDependentTask(boolean enabled, Set<FightState> states, Runnable runnable, long delay, long period){
|
||||
public StateDependentTask(boolean enabled, Set<FightState> states, Runnable runnable, long delay, long period) {
|
||||
super(enabled, states);
|
||||
this.runnable = runnable;
|
||||
this.delay = delay;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class BlockIdWrapper {
|
||||
}
|
||||
|
||||
public void trackEntity(Player player, Entity entity) {
|
||||
if(entity instanceof Player)
|
||||
if (entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
|
||||
player.showEntity(FightSystem.getPlugin(), entity);
|
||||
@@ -67,7 +67,7 @@ public class BlockIdWrapper {
|
||||
public void untrackEntity(Player player, Entity entity) {
|
||||
player.hideEntity(FightSystem.getPlugin(), entity);
|
||||
|
||||
if(entity instanceof Player)
|
||||
if (entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
}
|
||||
}
|
||||
|
||||
+11
-10
@@ -69,8 +69,8 @@ public class BountifulWrapper {
|
||||
public Listener newDenyArrowPickupListener() {
|
||||
return new Listener() {
|
||||
@EventHandler
|
||||
public void onArrowPickup(PlayerPickupArrowEvent e){
|
||||
if(Fight.fighting(e.getPlayer()))
|
||||
public void onArrowPickup(PlayerPickupArrowEvent e) {
|
||||
if (Fight.fighting(e.getPlayer()))
|
||||
e.setCancelled(true);
|
||||
}
|
||||
};
|
||||
@@ -80,7 +80,7 @@ public class BountifulWrapper {
|
||||
return new Listener() {
|
||||
@EventHandler
|
||||
public void onSwapItems(PlayerSwapHandItemsEvent event) {
|
||||
if(Fight.fighting(event.getPlayer()))
|
||||
if (Fight.fighting(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
};
|
||||
@@ -94,8 +94,8 @@ public class BountifulWrapper {
|
||||
public Listener newHandSwapRecorder() {
|
||||
return new Listener() {
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onItemSwap(PlayerSwapHandItemsEvent e){
|
||||
if(Recording.isNotSent(e.getPlayer()))
|
||||
public void onItemSwap(PlayerSwapHandItemsEvent e) {
|
||||
if (Recording.isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
Player player = e.getPlayer();
|
||||
@@ -110,10 +110,11 @@ public class BountifulWrapper {
|
||||
}
|
||||
|
||||
private final Map<Player, BossBar> barMap = new HashMap<>();
|
||||
|
||||
public void sendBar(Player player, FightTeam team, double progress, String text) {
|
||||
barMap.keySet().removeIf(p -> !p.isOnline());
|
||||
|
||||
if(!barMap.containsKey(player)) {
|
||||
if (!barMap.containsKey(player)) {
|
||||
BossBar bar = Bukkit.createBossBar(player.getName(), BarColor.WHITE, BarStyle.SOLID);
|
||||
barMap.put(player, bar);
|
||||
bar.addPlayer(player);
|
||||
@@ -121,18 +122,18 @@ public class BountifulWrapper {
|
||||
|
||||
BossBar bar = barMap.get(player);
|
||||
BarColor color = chat2bar(team.getColor());
|
||||
if(bar.getColor() != color)
|
||||
if (bar.getColor() != color)
|
||||
bar.setColor(color);
|
||||
|
||||
if(bar.getProgress() != progress)
|
||||
if (bar.getProgress() != progress)
|
||||
bar.setProgress(progress);
|
||||
|
||||
if(!bar.getTitle().equals(text))
|
||||
if (!bar.getTitle().equals(text))
|
||||
bar.setTitle(text);
|
||||
}
|
||||
|
||||
private BarColor chat2bar(ChatColor color) {
|
||||
switch(color) {
|
||||
switch (color) {
|
||||
case DARK_BLUE:
|
||||
case DARK_AQUA:
|
||||
case BLUE:
|
||||
|
||||
@@ -27,12 +27,13 @@ import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ColorConverter {
|
||||
private ColorConverter(){}
|
||||
private ColorConverter() {
|
||||
}
|
||||
|
||||
private static final Map<ChatColor, DyeColor> chat2dyeColor = new EnumMap<>(ChatColor.class);
|
||||
private static final Map<ChatColor, Material> chat2dye = new EnumMap<>(ChatColor.class);
|
||||
|
||||
static{
|
||||
static {
|
||||
chat2dyeColor.put(ChatColor.WHITE, DyeColor.WHITE);
|
||||
chat2dyeColor.put(ChatColor.GOLD, DyeColor.ORANGE);
|
||||
chat2dyeColor.put(ChatColor.LIGHT_PURPLE, DyeColor.MAGENTA);
|
||||
@@ -68,11 +69,11 @@ public class ColorConverter {
|
||||
chat2dye.put(ChatColor.GRAY, Material.LIGHT_GRAY_DYE);
|
||||
}
|
||||
|
||||
public static DyeColor chat2dyeColor(ChatColor color){
|
||||
public static DyeColor chat2dyeColor(ChatColor color) {
|
||||
return chat2dyeColor.get(color);
|
||||
}
|
||||
|
||||
public static Material chat2dye(ChatColor color){
|
||||
public static Material chat2dye(ChatColor color) {
|
||||
return chat2dye.get(color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.Set;
|
||||
public class EnterHandler implements IStateDependent {
|
||||
private static final Set<FightState> enabled = FightState.Running;
|
||||
|
||||
public EnterHandler(){
|
||||
public EnterHandler() {
|
||||
FightState.registerStateDependent(this);
|
||||
}
|
||||
|
||||
@@ -51,14 +51,14 @@ public class EnterHandler implements IStateDependent {
|
||||
Fight.teams().forEach(this::unregisterTeam);
|
||||
}
|
||||
|
||||
private void registerTeam(FightTeam team){
|
||||
for(FightPlayer fp : team.getPlayers()){
|
||||
private void registerTeam(FightTeam team) {
|
||||
for (FightPlayer fp : team.getPlayers()) {
|
||||
fp.startEnternCountdown(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void unregisterTeam(FightTeam team){
|
||||
for(FightPlayer fp : team.getPlayers()){
|
||||
private void unregisterTeam(FightTeam team) {
|
||||
for (FightPlayer fp : team.getPlayers()) {
|
||||
fp.stopEnternCountdown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,21 +65,21 @@ public class FightUI {
|
||||
double blueHearts = blue.getCurrentHearts();
|
||||
double redHearts = red.getCurrentHearts();
|
||||
double totalHearts = blueHearts + redHearts;
|
||||
if(redHearts == 0.0 || blueHearts == 0.0) {
|
||||
if (redHearts == 0.0 || blueHearts == 0.0) {
|
||||
blueHearts = 0.5;
|
||||
redHearts = 0.5;
|
||||
totalHearts = 1.0;
|
||||
}
|
||||
|
||||
int timeLeft = StateDependentCountdown.getMainCountdown() != null ? StateDependentCountdown.getMainCountdown().getTimeLeft() : 0;
|
||||
String time = "§7" + (timeLeft/60) + "§8:§7" + (timeLeft%60<10 ? "0" : "") + (timeLeft%60);
|
||||
String time = "§7" + (timeLeft / 60) + "§8:§7" + (timeLeft % 60 < 10 ? "0" : "") + (timeLeft % 60);
|
||||
String bluePlayers = blue.getPrefix() + blue.getAlivePlayers() + "§8/§7" + blue.getPlayerCount();
|
||||
String redPlayers = red.getPrefix() + red.getAlivePlayers() + "§8/§7" + red.getPlayerCount();
|
||||
List<Message> redAdditional = Wincondition.getPrintableWinconditions().stream().map(w -> w.getDisplay(red)).collect(Collectors.toList());
|
||||
List<Message> blueAdditional = Wincondition.getPrintableWinconditions().stream().map(w -> w.getDisplay(blue)).collect(Collectors.toList());
|
||||
|
||||
Generator generator;
|
||||
switch(FightState.getFightState()){
|
||||
switch (FightState.getFightState()) {
|
||||
case PRE_LEADER_SETUP:
|
||||
generator = (l, r, lP, rP, lW, rW) -> new Message("BAR_PRE_LEADER");
|
||||
break;
|
||||
@@ -100,7 +100,7 @@ public class FightUI {
|
||||
params.add(r.getColoredName());
|
||||
params.add(lP);
|
||||
params.add(rP);
|
||||
for(int i = 0; i < lW.size(); i++) {
|
||||
for (int i = 0; i < lW.size(); i++) {
|
||||
params.add(lW.get(i));
|
||||
params.add(rW.get(i));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class FightUI {
|
||||
case SPECTATE:
|
||||
default:
|
||||
generator = (l, r, lP, rP, lW, rW) -> {
|
||||
if(FightSystem.getLastWinner() == null)
|
||||
if (FightSystem.getLastWinner() == null)
|
||||
return new Message("BAR_TIE", time, l.getColoredName(), r.getColoredName());
|
||||
else
|
||||
return new Message("BAR_WIN", time, l.getColoredName(), r.getColoredName(), FightSystem.getLastWinner().getColoredName());
|
||||
@@ -146,8 +146,8 @@ public class FightUI {
|
||||
BossBarType bar = BossBarType.byAngle(CraftbukkitWrapper.impl.headRotation(player));
|
||||
|
||||
Object[] params = bar.text.getParams().clone();
|
||||
for(int i = 0; i < params.length; i++) {
|
||||
if(params[i] instanceof Message) {
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
if (params[i] instanceof Message) {
|
||||
Message msg = (Message) params[i];
|
||||
params[i] = FightSystem.getMessage().parse(msg.getMsg(), player, msg.getParams());
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public class FightUI {
|
||||
|
||||
private void tpsWatcher() {
|
||||
double tps = TPSWatcher.getTPS();
|
||||
if(tps < 15.0)
|
||||
if (tps < 15.0)
|
||||
FightSystem.getMessage().broadcastActionbar("TPS_WARNING", tps);
|
||||
}
|
||||
|
||||
@@ -183,12 +183,12 @@ public class FightUI {
|
||||
}
|
||||
|
||||
private static BossBarType byAngle(double angle) {
|
||||
if(BLUE_NEG_Z)
|
||||
if (BLUE_NEG_Z)
|
||||
angle += 180;
|
||||
angle = ((angle % 360) + 360) % 360;
|
||||
|
||||
for(BossBarType type : values()) {
|
||||
if(type.minAngle < type.maxAngle ? type.minAngle <= angle && angle < type.maxAngle : type.minAngle <= angle || angle < type.maxAngle)
|
||||
for (BossBarType type : values()) {
|
||||
if (type.minAngle < type.maxAngle ? type.minAngle <= angle && angle < type.maxAngle : type.minAngle <= angle || angle < type.maxAngle)
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class FightUI {
|
||||
}
|
||||
|
||||
public static void addSubtitle(String msg, Object... params) {
|
||||
if(FightState.Spectate.contains(FightState.getFightState()))
|
||||
if (FightState.Spectate.contains(FightState.getFightState()))
|
||||
return;
|
||||
|
||||
Message message = new Message(msg, params);
|
||||
@@ -222,12 +222,12 @@ public class FightUI {
|
||||
GlobalRecorder.getInstance().subtitle(message);
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, FightSystem.getMessage().parse(msg, null, params));
|
||||
|
||||
if(!subtitleScheduled)
|
||||
if (!subtitleScheduled)
|
||||
printSubtitle();
|
||||
}
|
||||
|
||||
private static void printSubtitle() {
|
||||
if(queue.isEmpty()) {
|
||||
if (queue.isEmpty()) {
|
||||
subtitleScheduled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
+6
-6
@@ -36,11 +36,11 @@ public class FlatteningWrapper {
|
||||
public static final FlatteningWrapper impl = new FlatteningWrapper();
|
||||
|
||||
public boolean isWater(Block block) {
|
||||
if(block.getType() == Material.WATER)
|
||||
if (block.getType() == Material.WATER)
|
||||
return true;
|
||||
|
||||
BlockData data = block.getBlockData();
|
||||
if(!(data instanceof Waterlogged))
|
||||
if (!(data instanceof Waterlogged))
|
||||
return false;
|
||||
|
||||
return ((Waterlogged) data).isWaterlogged();
|
||||
@@ -48,17 +48,17 @@ public class FlatteningWrapper {
|
||||
|
||||
public boolean removeWater(Block block) {
|
||||
Material type = block.getType();
|
||||
if(type == Material.WATER || type == Material.LAVA){
|
||||
if (type == Material.WATER || type == Material.LAVA) {
|
||||
block.setType(Material.AIR);
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockData data = block.getBlockData();
|
||||
if(!(data instanceof Waterlogged))
|
||||
if (!(data instanceof Waterlogged))
|
||||
return false;
|
||||
|
||||
Waterlogged waterlogged = (Waterlogged) data;
|
||||
if(waterlogged.isWaterlogged()){
|
||||
if (waterlogged.isWaterlogged()) {
|
||||
block.setType(Material.AIR);
|
||||
return true;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class FlatteningWrapper {
|
||||
}
|
||||
|
||||
public boolean containsBlockMeta(ItemMeta meta) {
|
||||
return meta instanceof BlockDataMeta && ((BlockDataMeta)meta).hasBlockData();
|
||||
return meta instanceof BlockDataMeta && ((BlockDataMeta) meta).hasBlockData();
|
||||
}
|
||||
|
||||
public boolean hasAttributeModifier(ItemStack stack) {
|
||||
|
||||
@@ -67,11 +67,11 @@ public class Hull {
|
||||
|
||||
IntVector primaryDirection = new IntVector(0, 0, team.isBlue() == (Config.BlueToRedZ > 0) ? -1 : 1);
|
||||
directions = IntStream.range(0, 27)
|
||||
.mapToObj(v -> new IntVector(v%3 -1, (v/3)%3 -1, v/9 -1))
|
||||
.filter(v -> v.sqLength() == 1 || v.x*primaryDirection.x + v.y*primaryDirection.y + v.z*primaryDirection.z == 1) // Not pointing away from primary direction
|
||||
.mapToObj(v -> new IntVector(v % 3 - 1, (v / 3) % 3 - 1, v / 9 - 1))
|
||||
.filter(v -> v.sqLength() == 1 || v.x * primaryDirection.x + v.y * primaryDirection.y + v.z * primaryDirection.z == 1) // Not pointing away from primary direction
|
||||
.toArray(IntVector[]::new);
|
||||
|
||||
for(IntVector direction : directions)
|
||||
for (IntVector direction : directions)
|
||||
visibilityDirections.put(direction, new BitSet(region.volume()));
|
||||
}
|
||||
|
||||
@@ -88,15 +88,15 @@ public class Hull {
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
if(players.add(player)) {
|
||||
for(Entity entity : entities)
|
||||
if (players.add(player)) {
|
||||
for (Entity entity : entities)
|
||||
BlockIdWrapper.impl.untrackEntity(player, entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(Player player, boolean activeRemoval) {
|
||||
if(players.remove(player) && activeRemoval) {
|
||||
for(Entity entity : entities)
|
||||
if (players.remove(player) && activeRemoval) {
|
||||
for (Entity entity : entities)
|
||||
BlockIdWrapper.impl.trackEntity(player, entity);
|
||||
// techhider triggers block change sending
|
||||
}
|
||||
@@ -104,14 +104,14 @@ public class Hull {
|
||||
|
||||
public void checkEntity(Entity entity) {
|
||||
Location location = entity.getLocation();
|
||||
if(region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) {
|
||||
if(entities.add(entity)) {
|
||||
for(Player player : players)
|
||||
if (region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) {
|
||||
if (entities.add(entity)) {
|
||||
for (Player player : players)
|
||||
BlockIdWrapper.impl.untrackEntity(player, entity);
|
||||
}
|
||||
} else {
|
||||
if(entities.remove(entity)) {
|
||||
for(Player player : players)
|
||||
if (entities.remove(entity)) {
|
||||
for (Player player : players)
|
||||
BlockIdWrapper.impl.trackEntity(player, entity);
|
||||
}
|
||||
}
|
||||
@@ -123,11 +123,11 @@ public class Hull {
|
||||
|
||||
public void checkREntity(REntity entity) {
|
||||
Location location = new Location(Config.world, entity.getX(), entity.getY(), entity.getZ());
|
||||
if(region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) {
|
||||
if(rentities.add(entity))
|
||||
if (region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) {
|
||||
if (rentities.add(entity))
|
||||
entity.hide(true);
|
||||
} else {
|
||||
if(rentities.remove(entity))
|
||||
if (rentities.remove(entity))
|
||||
entity.hide(false);
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class Hull {
|
||||
visibility.clear();
|
||||
occluding.clear();
|
||||
uncoveredSurface.clear();
|
||||
for(BitSet directionalVisibility : visibilityDirections.values())
|
||||
for (BitSet directionalVisibility : visibilityDirections.values())
|
||||
directionalVisibility.clear();
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
@@ -163,12 +163,12 @@ public class Hull {
|
||||
return;
|
||||
|
||||
occluding.clear(id);
|
||||
if(!visibility.get(id))
|
||||
if (!visibility.get(id))
|
||||
return;
|
||||
|
||||
List<IntVector> uncovered = new ArrayList<>();
|
||||
for(Map.Entry<IntVector, BitSet> directionalVisibility : visibilityDirections.entrySet()) {
|
||||
if(directionalVisibility.getValue().get(id)) {
|
||||
for (Map.Entry<IntVector, BitSet> directionalVisibility : visibilityDirections.entrySet()) {
|
||||
if (directionalVisibility.getValue().get(id)) {
|
||||
directionalVisibility.getValue().clear(id);
|
||||
uncoverBlocks(uncovered, root, directionalVisibility.getKey());
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public class Hull {
|
||||
public void sendUncoveredBlocks() {
|
||||
Map<IntVector, List<IntVector>> sectionWise = new HashMap<>();
|
||||
|
||||
for(IntVector uncovered : uncoveredSurface) {
|
||||
for (IntVector uncovered : uncoveredSurface) {
|
||||
sectionWise.computeIfAbsent(new IntVector(uncovered.x >> 4, uncovered.y >> 4, uncovered.z >> 4), section -> new ArrayList<>()).add(uncovered);
|
||||
}
|
||||
uncoveredSurface.clear();
|
||||
@@ -221,8 +221,8 @@ public class Hull {
|
||||
uncovered, block, direction, visibilityDirections.get(direction),
|
||||
direction.sqLength() == 1
|
||||
? Arrays.stream(directions)
|
||||
.filter(v -> v.sqLength() >= 2 && v.x*direction.x + v.y*direction.y + v.z*direction.z == 1)
|
||||
.toArray(IntVector[]::new)
|
||||
.filter(v -> v.sqLength() >= 2 && v.x * direction.x + v.y * direction.y + v.z * direction.z == 1)
|
||||
.toArray(IntVector[]::new)
|
||||
: NO_BRANCHES
|
||||
);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ public class Hull {
|
||||
return;
|
||||
|
||||
int id = block.toId(region);
|
||||
if(directionalVisibility.get(id))
|
||||
if (directionalVisibility.get(id))
|
||||
return;
|
||||
directionalVisibility.set(id);
|
||||
|
||||
@@ -245,7 +245,7 @@ public class Hull {
|
||||
return;
|
||||
|
||||
uncoverBlocks(uncovered, block.add(direction), direction, directionalVisibility, branchDirections);
|
||||
for(IntVector branchDirection : branchDirections)
|
||||
for (IntVector branchDirection : branchDirections)
|
||||
uncoverBlocks(uncovered, block.add(branchDirection), branchDirection, visibilityDirections.get(branchDirection), NO_BRANCHES);
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ public class Hull {
|
||||
}
|
||||
|
||||
public int sqLength() {
|
||||
return x*x + y*y + z*z;
|
||||
return x * x + y * y + z * z;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,7 +290,7 @@ public class Hull {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(o == null || this.getClass() != o.getClass())
|
||||
if (o == null || this.getClass() != o.getClass())
|
||||
return false;
|
||||
|
||||
IntVector v = (IntVector) o;
|
||||
|
||||
@@ -66,8 +66,9 @@ public class HullHider implements Listener {
|
||||
private final Map<Class<?>, BiFunction<Player, Object, Object>> packetHiders = new HashMap<>();
|
||||
|
||||
private static final Class<?> packetPlayOutExplosion = ClientboundExplodePacket.class;
|
||||
|
||||
public HullHider() {
|
||||
if(!TechHiderWrapper.ENABLED) {
|
||||
if (!TechHiderWrapper.ENABLED) {
|
||||
hulls = new Hull[0];
|
||||
return;
|
||||
}
|
||||
@@ -98,7 +99,7 @@ public class HullHider implements Listener {
|
||||
}
|
||||
|
||||
public void initialize(FightTeam team) {
|
||||
if(!TechHiderWrapper.ENABLED)
|
||||
if (!TechHiderWrapper.ENABLED)
|
||||
return;
|
||||
|
||||
hullMap.get(team).initialize();
|
||||
@@ -116,13 +117,13 @@ public class HullHider implements Listener {
|
||||
}
|
||||
|
||||
public void updatePlayer(Player player) {
|
||||
if(!TechHiderWrapper.ENABLED)
|
||||
if (!TechHiderWrapper.ENABLED)
|
||||
return;
|
||||
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
FightPlayer fp = Fight.getFightPlayer(player);
|
||||
for(Map.Entry<FightTeam, Hull> hull : hullMap.entrySet()) {
|
||||
if(Config.isReferee(player) || hull.getKey() == team || (fp != null && fp.canEntern())) {
|
||||
for (Map.Entry<FightTeam, Hull> hull : hullMap.entrySet()) {
|
||||
if (Config.isReferee(player) || hull.getKey() == team || (fp != null && fp.canEntern())) {
|
||||
hull.getValue().removePlayer(player, true);
|
||||
} else {
|
||||
hull.getValue().addPlayer(player);
|
||||
@@ -138,7 +139,7 @@ public class HullHider implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPhysic(BlockPhysicsEvent e) {
|
||||
if(FlatteningWrapper.impl.doRecord(e))
|
||||
if (FlatteningWrapper.impl.doRecord(e))
|
||||
blockUpdate(e.getBlock(), e.getChangedType());
|
||||
}
|
||||
|
||||
@@ -148,22 +149,22 @@ public class HullHider implements Listener {
|
||||
}
|
||||
|
||||
public boolean isBlockHidden(Player player, int x, int y, int z) {
|
||||
if(!TechHiderWrapper.ENABLED)
|
||||
if (!TechHiderWrapper.ENABLED)
|
||||
return false;
|
||||
|
||||
for (Hull hull : hulls)
|
||||
if(hull.isBlockHidden(player, x, y, z))
|
||||
if (hull.isBlockHidden(player, x, y, z))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean blockPrecise(Player player, int chunkX, int chunkY, int chunkZ) {
|
||||
if(!TechHiderWrapper.ENABLED)
|
||||
if (!TechHiderWrapper.ENABLED)
|
||||
return false;
|
||||
|
||||
for (Hull hull : hulls)
|
||||
if(hull.blockPrecise(player, chunkX, chunkY, chunkZ))
|
||||
if (hull.blockPrecise(player, chunkX, chunkY, chunkZ))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -187,17 +188,17 @@ public class HullHider implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onDeath(EntityDeathEvent e) {
|
||||
for(Hull hull : hulls)
|
||||
for (Hull hull : hulls)
|
||||
hull.removeEntity(e.getEntity());
|
||||
}
|
||||
|
||||
public void updateREntity(REntity e) {
|
||||
for(Hull hull : hulls)
|
||||
for (Hull hull : hulls)
|
||||
hull.checkREntity(e);
|
||||
}
|
||||
|
||||
public void despawnREntity(REntity e) {
|
||||
for(Hull hull : hulls)
|
||||
for (Hull hull : hulls)
|
||||
hull.removeREntity(e);
|
||||
}
|
||||
|
||||
@@ -205,6 +206,7 @@ public class HullHider implements Listener {
|
||||
private static final Class<?> packetPlayOutWorldEvent = ClientboundLevelEventPacket.class;
|
||||
private static final Reflection.Field<?> worldEventPosition = Reflection.getField(packetPlayOutWorldEvent, TechHider.blockPosition, 0);
|
||||
public static final Reflection.Field<Integer> blockPositionY = Reflection.getField(Vec3i.class, int.class, 1);
|
||||
|
||||
private Object worldEventHider(Player player, Object packet) {
|
||||
Object baseBlock = worldEventPosition.get(packet);
|
||||
return packetHider(player, packet, new Location(Config.world, TechHider.blockPositionX.get(baseBlock), blockPositionY.get(baseBlock), TechHider.blockPositionZ.get(baseBlock)));
|
||||
@@ -224,12 +226,12 @@ public class HullHider implements Listener {
|
||||
Reflection.Field<? extends Number> y = Reflection.getField(type, posType, 1);
|
||||
Reflection.Field<? extends Number> z = Reflection.getField(type, posType, 2);
|
||||
|
||||
return packet -> new Location(Config.world, x.get(packet).doubleValue()/factor, y.get(packet).doubleValue()/factor, z.get(packet).doubleValue()/factor);
|
||||
return packet -> new Location(Config.world, x.get(packet).doubleValue() / factor, y.get(packet).doubleValue() / factor, z.get(packet).doubleValue() / factor);
|
||||
}
|
||||
|
||||
private Object packetHider(Player player, Object packet, Location location) {
|
||||
for(Hull hull : hulls) {
|
||||
if(hull.isLocationHidden(player, location))
|
||||
for (Hull hull : hulls) {
|
||||
if (hull.isLocationHidden(player, location))
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -35,7 +35,7 @@ public class HullHiderWrapper {
|
||||
|
||||
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
||||
Object[] blockdata = new Object[changes.size()];
|
||||
for(int i = 0; i < blockdata.length; i++) {
|
||||
for (int i = 0; i < blockdata.length; i++) {
|
||||
Hull.IntVector change = changes.get(i);
|
||||
blockdata[i] = ((CraftBlockData) Config.world.getBlockData(change.getX(), change.getY(), change.getZ())).getState();
|
||||
}
|
||||
@@ -44,18 +44,18 @@ public class HullHiderWrapper {
|
||||
}
|
||||
|
||||
private Object generateBlockChangePacket(List<Hull.IntVector> changes, Object[] blockdata) {
|
||||
if(changes.size() > 1) {
|
||||
if (changes.size() > 1) {
|
||||
Hull.IntVector section = changes.get(0);
|
||||
section = new Hull.IntVector(section.getX() >> 4, section.getY() >> 4, section.getZ() >> 4);
|
||||
int xOffset = 16*section.getX();
|
||||
int yOffset = 16*section.getY();
|
||||
int zOffset = 16*section.getZ();
|
||||
int xOffset = 16 * section.getX();
|
||||
int yOffset = 16 * section.getY();
|
||||
int zOffset = 16 * section.getZ();
|
||||
|
||||
short[] pos = new short[changes.size()];
|
||||
for(int i = 0; i < changes.size(); i++) {
|
||||
for (int i = 0; i < changes.size(); i++) {
|
||||
Hull.IntVector change = changes.get(i);
|
||||
|
||||
pos[i] = (short) (((change.getX()-xOffset) << 8) + ((change.getZ()-zOffset) << 4) + (change.getY()-yOffset));
|
||||
pos[i] = (short) (((change.getX() - xOffset) << 8) + ((change.getZ() - zOffset) << 4) + (change.getY() - yOffset));
|
||||
}
|
||||
|
||||
return constructMultiBlockChange(section, pos, blockdata);
|
||||
|
||||
@@ -27,29 +27,29 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class ItemBuilder {
|
||||
|
||||
private final ItemStack item;
|
||||
private final ItemMeta meta;
|
||||
private final ItemStack item;
|
||||
private final ItemMeta meta;
|
||||
|
||||
public ItemBuilder(Material material) {
|
||||
item = new ItemStack(material);
|
||||
meta = item.getItemMeta();
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
}
|
||||
public ItemBuilder(Material material) {
|
||||
item = new ItemStack(material);
|
||||
meta = item.getItemMeta();
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ItemBuilder(Material material, short subid) {
|
||||
item = new ItemStack(material, 1, subid);
|
||||
meta = item.getItemMeta();
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
public ItemBuilder(Material material, short subid) {
|
||||
item = new ItemStack(material, 1, subid);
|
||||
meta = item.getItemMeta();
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
}
|
||||
|
||||
public ItemBuilder enchant() {
|
||||
meta.addEnchant(Enchantment.UNBREAKING, 1, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack build() {
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
public ItemBuilder enchant() {
|
||||
meta.addEnchant(Enchantment.UNBREAKING, 1, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack build() {
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Region {
|
||||
}
|
||||
|
||||
public static Region fromSize(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ) {
|
||||
return new Region(minX, minY, minZ, minX+sizeX, minY+sizeY, minZ+sizeZ);
|
||||
return new Region(minX, minY, minZ, minX + sizeX, minY + sizeY, minZ + sizeZ);
|
||||
}
|
||||
|
||||
private final int minX;
|
||||
@@ -62,19 +62,19 @@ public class Region {
|
||||
return maxZ - minZ;
|
||||
}
|
||||
|
||||
private int getMinChunkX(){
|
||||
private int getMinChunkX() {
|
||||
return ProtocolUtils.posToChunk(minX);
|
||||
}
|
||||
|
||||
private int getMaxChunkX(){
|
||||
private int getMaxChunkX() {
|
||||
return ProtocolUtils.posToChunk(maxX);
|
||||
}
|
||||
|
||||
private int getMinChunkZ(){
|
||||
private int getMinChunkZ() {
|
||||
return ProtocolUtils.posToChunk(minZ);
|
||||
}
|
||||
|
||||
private int getMaxChunkZ(){
|
||||
private int getMaxChunkZ() {
|
||||
return ProtocolUtils.posToChunk(maxZ);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class Region {
|
||||
|
||||
public boolean chunkOutside(int cX, int cZ) {
|
||||
return getMinChunkX() > cX || cX > getMaxChunkX() ||
|
||||
getMinChunkZ() > cZ || cZ > getMaxChunkZ();
|
||||
getMinChunkZ() > cZ || cZ > getMaxChunkZ();
|
||||
}
|
||||
|
||||
public boolean chunkSectionOutside(int cX, int cY, int cZ) {
|
||||
@@ -98,14 +98,14 @@ public class Region {
|
||||
}
|
||||
|
||||
public void forEachChunk(ObjIntConsumer<Integer> executor) {
|
||||
for(int x = getMinChunkX(); x <= getMaxChunkX(); x++)
|
||||
for(int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
|
||||
for (int x = getMinChunkX(); x <= getMaxChunkX(); x++)
|
||||
for (int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
|
||||
executor.accept(x, z);
|
||||
}
|
||||
|
||||
public void forEach(TriConsumer<Integer, Integer, Integer> executor) {
|
||||
for(int x = minX; x < maxX; x++) {
|
||||
for(int y = minY; y < maxY; y++) {
|
||||
for (int x = minX; x < maxX; x++) {
|
||||
for (int y = minY; y < maxY; y++) {
|
||||
for (int z = minZ; z < maxZ; z++) {
|
||||
executor.accept(x, y, z);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class Region {
|
||||
}
|
||||
}
|
||||
|
||||
public int volume(){
|
||||
public int volume() {
|
||||
return (maxX - minX) * (maxY - minY) * (maxZ - minZ);
|
||||
}
|
||||
|
||||
@@ -125,19 +125,19 @@ public class Region {
|
||||
return (maxZ - minZ) / 2.0 + minZ;
|
||||
}
|
||||
|
||||
public boolean in2dRegion(Location location){
|
||||
public boolean in2dRegion(Location location) {
|
||||
return minX <= location.getX() && location.getX() < maxX && minZ <= location.getZ() && location.getZ() <= maxZ;
|
||||
}
|
||||
|
||||
public boolean inRegion(Location location){
|
||||
public boolean inRegion(Location location) {
|
||||
return in2dRegion(location) && minY < location.getY() && location.getY() < maxY;
|
||||
}
|
||||
|
||||
public boolean playerInRegion(Location location){
|
||||
public boolean playerInRegion(Location location) {
|
||||
return in2dRegion(location) && minY <= location.getY() && location.getY() < maxY;
|
||||
}
|
||||
|
||||
public boolean in2dRegion(Block block){
|
||||
public boolean in2dRegion(Block block) {
|
||||
return in2dRegion(block.getX(), block.getZ());
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class Region {
|
||||
return minX <= x && x < maxX && minZ <= z && z < maxZ;
|
||||
}
|
||||
|
||||
public boolean inRegion(Block block){
|
||||
public boolean inRegion(Block block) {
|
||||
return in2dRegion(block) && minY <= block.getY() && block.getY() < maxY;
|
||||
}
|
||||
|
||||
@@ -162,10 +162,10 @@ public class Region {
|
||||
}
|
||||
|
||||
public Region to2d() {
|
||||
return new Region(minX, Integer.MIN_VALUE/2, minZ, maxX, Integer.MAX_VALUE/2, maxZ);
|
||||
return new Region(minX, Integer.MIN_VALUE / 2, minZ, maxX, Integer.MAX_VALUE / 2, maxZ);
|
||||
}
|
||||
|
||||
public interface TriConsumer<T, V, U>{
|
||||
public interface TriConsumer<T, V, U> {
|
||||
void accept(T x, V y, U z);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum SWSound {
|
||||
ENTITY_GENERIC_EXPLODE;
|
||||
|
||||
public Sound getSound() {
|
||||
switch(this){
|
||||
switch (this) {
|
||||
case ENTITY_WITHER_DEATH:
|
||||
return Sound.ENTITY_WITHER_DEATH;
|
||||
case BLOCK_NOTE_BASS:
|
||||
|
||||
+13
-12
@@ -96,7 +96,7 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
||||
@EventHandler
|
||||
public void teamLeave(TeamLeaveEvent e) {
|
||||
e.getFightPlayer().ifPlayer(player -> {
|
||||
if(player.isOnline())
|
||||
if (player.isOnline())
|
||||
hiddenRegion.put(player, getHiddenRegion(player));
|
||||
});
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
||||
}
|
||||
|
||||
public void reloadChunks(Player player, Region region, Region exclusion) {
|
||||
if(!ENABLED || !FightState.Schem.contains(FightState.getFightState()) || !player.isOnline())
|
||||
if (!ENABLED || !FightState.Schem.contains(FightState.getFightState()) || !player.isOnline())
|
||||
return;
|
||||
|
||||
region.forEachChunk((chunkX, chunkZ) -> {
|
||||
@@ -135,9 +135,9 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
||||
|
||||
@Override
|
||||
public TechHider.State check(Player player, int x, int y, int z) {
|
||||
if(hiddenRegion.computeIfAbsent(player, this::getHiddenRegion).inRegion(x, y, z)) {
|
||||
if(FightSystem.getHullHider().isBlockHidden(player, x, y, z)) {
|
||||
int id = ((y&3) << 4) + ((z&3) << 2) + (x&3);
|
||||
if (hiddenRegion.computeIfAbsent(player, this::getHiddenRegion).inRegion(x, y, z)) {
|
||||
if (FightSystem.getHullHider().isBlockHidden(player, x, y, z)) {
|
||||
int id = ((y & 3) << 4) + ((z & 3) << 2) + (x & 3);
|
||||
return (patterns.computeIfAbsent(player, this::getPattern) & (1L << id)) == 0 ? TechHider.State.HIDE_AIR : TechHider.State.HIDE;
|
||||
} else {
|
||||
return TechHider.State.CHECK;
|
||||
@@ -161,7 +161,8 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
||||
Cipher cipher = Cipher.getInstance("AES_256/CFB/NoPadding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key);
|
||||
bytes = cipher.doFinal(bytes);
|
||||
} catch (IllegalBlockSizeException | BadPaddingException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) {
|
||||
} catch (IllegalBlockSizeException | BadPaddingException | NoSuchAlgorithmException | NoSuchPaddingException |
|
||||
InvalidKeyException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
|
||||
@@ -171,9 +172,9 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
||||
((bytes[3] & 0xFFL) << 24);
|
||||
|
||||
/* XXXO OOOX
|
||||
* XXXO OOOX
|
||||
* XXOX OOXO
|
||||
* OOXX XXOO */
|
||||
* XXXO OOOX
|
||||
* XXOX OOXO
|
||||
* OOXX XXOO */
|
||||
pattern |= 0b1110_1110_1101_0011___0001_0001_0010_1100___0000_0000_0000_0000___0000_0000_0000_0000L;
|
||||
return pattern;
|
||||
}
|
||||
@@ -184,14 +185,14 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
||||
}
|
||||
|
||||
private Region getHiddenRegion(Player player) {
|
||||
if(Config.isReferee(player))
|
||||
if (Config.isReferee(player))
|
||||
return Region.EMPTY;
|
||||
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
if(team == null)
|
||||
if (team == null)
|
||||
return Config.ArenaRegion;
|
||||
|
||||
if(team.canPlayerEntern(player))
|
||||
if (team.canPlayerEntern(player))
|
||||
return Region.EMPTY;
|
||||
|
||||
return Fight.getOpposite(team).getExtendRegion();
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class WorldOfColorWrapper {
|
||||
}
|
||||
|
||||
public boolean isInBlock(Projectile e) {
|
||||
if(e instanceof Arrow)
|
||||
if (e instanceof Arrow)
|
||||
return ((Arrow) e).isInBlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user