Skip to content

Commit

Permalink
Added Wars API
Browse files Browse the repository at this point in the history
  • Loading branch information
Angeschossen authored and Angeschossen committed Aug 19, 2020
1 parent c62a2de commit 9057b80
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 231 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.angeschossen</groupId>
<artifactId>LandsAPI</artifactId>
<version>4.9.2</version>
<version>4.9.3</version>
<name>LandsAPI</name>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.angeschossen.lands.api.events.war;

import me.angeschossen.lands.api.war.WarEntity;
import me.angeschossen.lands.api.war.entity.WarEntity;
import org.bukkit.Bukkit;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/angeschossen/lands/api/land/Land.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import me.angeschossen.lands.api.player.TrustedPlayer;
import me.angeschossen.lands.api.role.enums.ManagementSetting;
import me.angeschossen.lands.api.war.War;
import me.angeschossen.lands.api.war.WarEntity;
import me.angeschossen.lands.api.war.entity.WarEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -172,7 +172,7 @@ public interface Land extends BalanceHolder, WarEntity {

boolean canManagement(UUID playerUUID, ManagementSetting managementSetting);

boolean canManagement(Player player, ManagementSetting managementSetting, boolean sendMessage);
boolean canManagement(Player player, @NotNull ManagementSetting managementSetting, boolean sendMessage);

/**
* Get trusted player.
Expand Down
65 changes: 0 additions & 65 deletions src/main/java/me/angeschossen/lands/api/nation/Nation.java

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions src/main/java/me/angeschossen/lands/api/war/LandWarStats.java

This file was deleted.

40 changes: 0 additions & 40 deletions src/main/java/me/angeschossen/lands/api/war/NationInvite.java

This file was deleted.

21 changes: 12 additions & 9 deletions src/main/java/me/angeschossen/lands/api/war/War.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
package me.angeschossen.lands.api.war;

import me.angeschossen.lands.api.role.enums.RoleSetting;
import me.angeschossen.lands.api.war.entity.WarEntity;
import me.angeschossen.lands.api.war.entity.WarStats;
import me.angeschossen.lands.api.war.enums.WarSetting;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Set;

public interface War {

boolean canAction(Player player, RoleSetting landsAction, @Nullable Material material, boolean sendMessage);
boolean canAction(@NotNull Player player, @NotNull RoleSetting landsAction, @Nullable Material material, boolean sendMessage);

boolean toggleRoleAction(RoleSetting landsAction);
boolean toggleRoleAction(@NotNull RoleSetting landsAction);

boolean toggleSetting(WarSetting warSetting);
boolean toggleSetting(@NotNull WarSetting warSetting);

int getId();
@NotNull
Set<RoleSetting> getRoleSettings();

Set<RoleSetting> getRoleActions();

boolean isParticipating(WarEntity entity);
boolean isParticipating(@NotNull WarEntity entity);

boolean isEndingSoon();

boolean attackersWin();

@Nullable
WarEntity getWinner();

@NotNull
WarStats getAttackerStats();

@NotNull
WarStats getDefenderStats();
}
36 changes: 0 additions & 36 deletions src/main/java/me/angeschossen/lands/api/war/WarEntity.java

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/me/angeschossen/lands/api/war/WarWorld.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package me.angeschossen.lands.api.war;
package me.angeschossen.lands.api.war.declaration;

import me.angeschossen.lands.api.war.War;
import me.angeschossen.lands.api.war.enums.WarTeam;


public interface WarDeclaration {

void stop();

void setTribute(double tribute);

double getTribute();

double getMaxTribute(WarTeam warTeam);

boolean isValid();

boolean startsSoon();

War start();
}
48 changes: 48 additions & 0 deletions src/main/java/me/angeschossen/lands/api/war/entity/WarEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package me.angeschossen.lands.api.war.entity;

import me.angeschossen.lands.api.holders.BalanceHolder;
import me.angeschossen.lands.api.player.LandPlayer;
import me.angeschossen.lands.api.war.enums.WarEntityType;
import me.angeschossen.lands.api.war.enums.WarTeam;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.UUID;

public interface WarEntity extends BalanceHolder {

@Nullable
WarTeam getWarTeam();

@NotNull
UUID getOwnerUID();

@NotNull
Collection<Player> getOnlinePlayers();

@NotNull
Collection<? extends LandPlayer> getOnlineLandPlayers();

boolean leaveWar();

void addWarShieldTime(long seconds);

boolean hasWarShield();

long getWarShield();

boolean hasWarEntity(@NotNull WarEntity entity);

boolean isInWar();

WarEntityType getType();

boolean isWarField();

@NotNull
WarStats getStats();

boolean isTrusted(@NotNull UUID uuid);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.angeschossen.lands.api.war;
package me.angeschossen.lands.api.war.entity;

public interface WarStats {


int getWon();

int getLost();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
package me.angeschossen.lands.api.war.enums;

public enum WarSetting {

FRIENDLY_FIRE(1);

private final int id;

WarSetting(int id) {
this.id = id;
}

public int getId() {
return id;
}

public static WarSetting getById(int id) throws IllegalArgumentException{
for (WarSetting warSetting : values()) {
if (warSetting.getId() == id) {
return warSetting;
}
}

throw new IllegalArgumentException("No warsetting with id " + id + " found.");
}
FRIENDLY_FIRE
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.angeschossen.lands.api.war.enums;

public enum WarTeam {

ATTACKER, DEFENDER, NEUTRAL
}

This file was deleted.

0 comments on commit 9057b80

Please sign in to comment.