War/War Points Update

This commit is contained in:
Shaun Bennett 2015-11-16 14:37:32 -05:00
parent f90b137ccd
commit 2627aa9933
21 changed files with 287 additions and 444 deletions

View File

@ -4,7 +4,7 @@
<root url="jar://$PROJECT_DIR$/Libraries/craftbukkit.jar!/" /> <root url="jar://$PROJECT_DIR$/Libraries/craftbukkit.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="http://jd.bukkit.org/dev/apidocs/" /> <root url="https://hub.spigotmc.org/javadocs/spigot/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$PROJECT_DIR$/Libraries/craftbukkit.jar!/" /> <root url="jar://$PROJECT_DIR$/Libraries/craftbukkit.jar!/" />

View File

@ -17,7 +17,6 @@
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" group="Core" /> <module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" /> <module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" /> <module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerProcesses/Mineplex.ServerProcesses.iml" filepath="$PROJECT_DIR$/Mineplex.ServerProcesses/Mineplex.ServerProcesses.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" filepath="$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" /> <module fileurl="file://$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" filepath="$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" /> <module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" filepath="$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" group="Legacy" /> <module fileurl="file://$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" filepath="$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" group="Legacy" />

View File

@ -73,7 +73,7 @@ public class ClanRepository extends RepositoryBase
private static String UPDATE_CLAN_MEMBER = "UPDATE accountClan AS AC INNER JOIN accounts ON accounts.id = AC.accountId SET AC.clanRole = ? WHERE AC.clanId = ? AND accounts.name = ?;"; private static String UPDATE_CLAN_MEMBER = "UPDATE accountClan AS AC INNER JOIN accounts ON accounts.id = AC.accountId SET AC.clanRole = ? WHERE AC.clanId = ? AND accounts.name = ?;";
private static String UPDATE_CLAN_ALLIANCE = "UPDATE clanAlliances SET trusted = ? WHERE clanId = ? AND otherClanId = ?;"; private static String UPDATE_CLAN_ALLIANCE = "UPDATE clanAlliances SET trusted = ? WHERE clanId = ? AND otherClanId = ?;";
private static String UPDATE_CLAN_TERRITORY = "UPDATE clanTerritory SET safe = ? WHERE chunk = ?;"; // private static String UPDATE_CLAN_TERRITORY = "UPDATE clanTerritory SET safe = ? WHERE chunk = ?;"; //
private static String UPDATE_CLAN_WAR = "UPDATE clanWar SET score = ?, completed = ?, ended = ?, lastUpdated = ? WHERE initiatorId = ? AND clanId = ?"; private static String UPDATE_CLAN_WAR = "UPDATE clanWar SET score = ?, lastUpdated = ? WHERE initiatorId = ? AND clanId = ?";
private static String UPDATE_CLAN_SERVER_ID = "UPDATE clans SET serverId = ?, home = '', generator = '' WHERE id = ?;"; private static String UPDATE_CLAN_SERVER_ID = "UPDATE clans SET serverId = ?, home = '', generator = '' WHERE id = ?;";
private static String UPDATE_CLAN_GENERATOR = "UPDATE clans SET generator = ?, generatorStock = ? WHERE id = ?;"; private static String UPDATE_CLAN_GENERATOR = "UPDATE clans SET generator = ?, generatorStock = ? WHERE id = ?;";
@ -373,14 +373,14 @@ public class ClanRepository extends RepositoryBase
warToken.ClanB = resultSet.getString(2); warToken.ClanB = resultSet.getString(2);
warToken.Score = resultSet.getInt(3); warToken.Score = resultSet.getInt(3);
warToken.Created = resultSet.getTimestamp(4); warToken.Created = resultSet.getTimestamp(4);
warToken.Ended = resultSet.getTimestamp(5); // warToken.Ended = resultSet.getTimestamp(5);
warToken.Updated = resultSet.getTimestamp(6); warToken.Updated = resultSet.getTimestamp(6);
if (clans.containsKey(warToken.ClanA) && clans.containsKey(warToken.ClanB)) if (clans.containsKey(warToken.ClanA) && clans.containsKey(warToken.ClanB))
{ {
System.out.println("Loaded War Token: " + warToken.ClanA); System.out.println("Loaded War Token: " + warToken.ClanA);
clans.get(warToken.ClanA).WarsInitiated.add(warToken); clans.get(warToken.ClanA).WarsOut.add(warToken);
clans.get(warToken.ClanB).WarsInitiatedOn.add(warToken); clans.get(warToken.ClanB).WarsIn.add(warToken);
} }
} }
} }
@ -517,9 +517,9 @@ public class ClanRepository extends RepositoryBase
executeUpdate(ADD_CLAN_WAR, new ColumnInt("initiatorId", initiatorId), new ColumnInt("clanId", clanId), new ColumnInt("score", score)); executeUpdate(ADD_CLAN_WAR, new ColumnInt("initiatorId", initiatorId), new ColumnInt("clanId", clanId), new ColumnInt("score", score));
} }
public boolean updateWar(int initiatorId, int clanId, int score, boolean completed, Timestamp lastUpdated, Timestamp ended) public boolean updateWar(int initiatorId, int clanId, int score, Timestamp lastUpdated)
{ {
return 1 == executeUpdate(UPDATE_CLAN_WAR, new ColumnInt("score", score), new ColumnBoolean("completed", completed), new ColumnTimestamp("ended", ended), return 1 == executeUpdate(UPDATE_CLAN_WAR, new ColumnInt("score", score),
new ColumnTimestamp("lastUpdated", lastUpdated), new ColumnInt("initiatorId", initiatorId), new ColumnInt("clanId", clanId)); new ColumnTimestamp("lastUpdated", lastUpdated), new ColumnInt("initiatorId", initiatorId), new ColumnInt("clanId", clanId));
} }

View File

@ -25,6 +25,6 @@ public class ClanToken
public List<ClanMemberToken> Members = new ArrayList<ClanMemberToken>(); public List<ClanMemberToken> Members = new ArrayList<ClanMemberToken>();
public List<ClanTerritoryToken> Territories = new ArrayList<ClanTerritoryToken>(); public List<ClanTerritoryToken> Territories = new ArrayList<ClanTerritoryToken>();
public List<ClanAllianceToken> Alliances = new ArrayList<ClanAllianceToken>(); public List<ClanAllianceToken> Alliances = new ArrayList<ClanAllianceToken>();
public List<ClanWarToken> WarsInitiated = new ArrayList<ClanWarToken>(); public List<ClanWarToken> WarsIn = new ArrayList<ClanWarToken>();
public List<ClanWarToken> WarsInitiatedOn = new ArrayList<ClanWarToken>(); public List<ClanWarToken> WarsOut = new ArrayList<ClanWarToken>();
} }

View File

@ -8,6 +8,5 @@ public class ClanWarToken
public String ClanB; public String ClanB;
public int Score; public int Score;
public Timestamp Created; public Timestamp Created;
public Timestamp Ended;
public Timestamp Updated; public Timestamp Updated;
} }

View File

@ -23,9 +23,8 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.ClansUtility.ClanRelation; import mineplex.game.clans.clans.ClansUtility.ClanRelation;
import mineplex.game.clans.clans.war.ClanWar; import mineplex.game.clans.clans.war.ClanWarData;
import mineplex.game.clans.core.repository.tokens.ClanAllianceToken; import mineplex.game.clans.core.repository.tokens.ClanAllianceToken;
import mineplex.game.clans.core.repository.tokens.ClanEnemyToken;
import mineplex.game.clans.core.repository.tokens.ClanMemberToken; import mineplex.game.clans.core.repository.tokens.ClanMemberToken;
import mineplex.game.clans.core.repository.tokens.ClanTerritoryToken; import mineplex.game.clans.core.repository.tokens.ClanTerritoryToken;
import mineplex.game.clans.core.repository.tokens.ClanToken; import mineplex.game.clans.core.repository.tokens.ClanToken;
@ -60,12 +59,10 @@ public class ClanInfo
private NautHashMap<String, Boolean> _allyMap = new NautHashMap<String, Boolean>(); private NautHashMap<String, Boolean> _allyMap = new NautHashMap<String, Boolean>();
private HashSet<String> _claimSet = new HashSet<String>(); private HashSet<String> _claimSet = new HashSet<String>();
/** // Wars Initiated By Others
* When a war is formed, a clan can either be the initiator, or be initiated on. We seperate these private HashMap<String, ClanWarData> _warIn = new HashMap<String, ClanWarData>();
* two categories into separate maps, as they are treated slightly different. // Wars Initiated By Self
*/ private HashMap<String, ClanWarData> _warOut = new HashMap<String, ClanWarData>();
private HashMap<String, ClanWar> _initiatedWars = new HashMap<String, ClanWar>();
private HashMap<String, ClanWar> _initiatedOnWars = new HashMap<String, ClanWar>();
// Temporary // Temporary
private NautHashMap<String, Long> _inviteeMap = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _inviteeMap = new NautHashMap<String, Long>();
@ -132,16 +129,18 @@ public class ClanInfo
_allyMap.put(allianceToken.ClanName, allianceToken.Trusted); _allyMap.put(allianceToken.ClanName, allianceToken.Trusted);
} }
for (ClanWarToken warToken : token.WarsInitiated) for (ClanWarToken warToken : token.WarsIn)
{ {
ClanWar war = new ClanWar(warToken); ClanWarData war = new ClanWarData(warToken);
_initiatedWars.put(war.getClanB(), war); System.out.println("Adding war in for " + getName() + " against " + war.getClanA());
_warIn.put(war.getClanA(), war);
} }
for (ClanWarToken warToken : token.WarsInitiatedOn) for (ClanWarToken warToken : token.WarsOut)
{ {
ClanWar war = new ClanWar(warToken); ClanWarData war = new ClanWarData(warToken);
_initiatedOnWars.put(war.getClanA(), war); System.out.println("Adding war out for " + getName() + " against " + war.getClanB());
_warOut.put(war.getClanB(), war);
} }
} }
@ -220,7 +219,7 @@ public class ClanInfo
public boolean isNeutral(String other) public boolean isNeutral(String other)
{ {
return (!isAlly(other) && !isSelf(other) && !isAtWar(other)); return (!isAlly(other) && !isSelf(other));
} }
public long getTimer() public long getTimer()
@ -542,79 +541,65 @@ public class ClanInfo
_warLosses += amount; _warLosses += amount;
} }
public ClanWar getInitiatedWar(ClanInfo againstClan) public ClanWarData getWarData(ClanInfo against)
{ {
return getInitiatedWar(againstClan.getName()); ClanWarData data = null;
data = _warIn.get(against.getName());
if (data == null) data = _warOut.get(against.getName());
return data;
} }
public ClanWar getInitiatedOnWar(ClanInfo againstClan) public int getWarPoints(ClanInfo against)
{ {
return getInitiatedOnWar(againstClan.getName()); int warPoints = 0;
}
public ClanWar getWar(ClanInfo againstClan) ClanWarData data = getWarData(against);
{ if (data != null)
return getWar(againstClan.getName());
}
public ClanWar getInitiatedWar(String againstClan)
{
if (_initiatedWars.containsKey(againstClan))
System.out.println("Grabbed from Initiated War");
return _initiatedWars.get(againstClan);
}
public ClanWar getInitiatedOnWar(String againstClan)
{
if (_initiatedWars.containsKey(againstClan))
System.out.println("Grabbed from Initiated On War");
return _initiatedOnWars.get(againstClan);
}
public void addWar(ClanWar clanWar)
{
if (getName().equals(clanWar.getClanA()))
{ {
_initiatedWars.put(clanWar.getClanB(), clanWar); warPoints = data.getPoints(this);
}
else if (getName().equals(clanWar.getClanB()))
{
_initiatedOnWars.put(clanWar.getClanA(), clanWar);
} }
return warPoints;
} }
public List<ClanWar> getInitiatedWars() public String getFormattedWarPoints(ClanInfo clan)
{ {
return new ArrayList<ClanWar>(_initiatedWars.values()); String warString = "";
int warPoints = getWarPoints(clan);
String prefix;
if (warPoints >= 5) prefix = C.cPurple;
else if (warPoints <= -5) prefix = C.cRed;
else prefix = C.cWhite;
warString += prefix;
if (warPoints > 0) warString += "+";
warString += warPoints;
return warString;
} }
public List<ClanWar> getInitiatedOnWars() public void addWar(ClanWarData war)
{ {
return new ArrayList<ClanWar>(_initiatedOnWars.values()); if (war.getClanA().equals(getName()))
} _warOut.put(war.getClanB(), war);
else if (war.getClanB().equals(getName()))
public ClanWar getWar(String againstClan) _warIn.put(war.getClanA(), war);
{ else throw new RuntimeException("Failed to add war to clan `" + getName() + "` ClanA: " + war.getClanA() + ", ClanB: " + war.getClanB());
ClanWar initiated = getInitiatedWar(againstClan);
return initiated == null ? getInitiatedOnWar(againstClan) : initiated;
} }
public void clearWar(String againstClan) public void clearWar(String againstClan)
{ {
_initiatedWars.remove(againstClan); _warIn.remove(againstClan);
_initiatedOnWars.remove(againstClan); _warOut.remove(againstClan);
} }
public boolean isAtWar(ClanInfo clanInfo) public boolean isEnemy(ClanInfo againstClan)
{ {
return isAtWar(clanInfo.getName()); int warPoints = getWarPoints(againstClan);
} return warPoints >= 5 || warPoints <= -5;
public boolean isAtWar(String clanName)
{
return _initiatedWars.containsKey(clanName) || _initiatedOnWars.containsKey(clanName);
} }
public void adjustEnergy(int energy) public void adjustEnergy(int energy)

View File

@ -19,8 +19,7 @@ import mineplex.game.clans.clans.event.ClanCreatedEvent;
import mineplex.game.clans.clans.event.ClanDeleteEvent; import mineplex.game.clans.clans.event.ClanDeleteEvent;
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager; import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
import mineplex.game.clans.clans.tntGenerator.TntGenerator; import mineplex.game.clans.clans.tntGenerator.TntGenerator;
import mineplex.game.clans.clans.war.ClanWar; import mineplex.game.clans.clans.war.ClanWarData;
import mineplex.game.clans.clans.war.WarManager;
import mineplex.game.clans.core.repository.ClanRepository; import mineplex.game.clans.core.repository.ClanRepository;
import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.game.clans.core.repository.tokens.ClanToken; import mineplex.game.clans.core.repository.tokens.ClanToken;
@ -619,16 +618,16 @@ public class ClansDataAccessLayer
}); });
} }
public void war(final ClanInfo clanA, final ClanInfo clanB, final Callback<ClanWar> warCallback) public void war(final ClanInfo clanA, final ClanInfo clanB, final int score, final Callback<ClanWarData> warCallback)
{ {
final ClanWar war = new ClanWar(clanA.getName(), clanB.getName(), WarManager.WAR_START_SCORE, false, new Timestamp(System.currentTimeMillis()), null, new Timestamp(System.currentTimeMillis())); final ClanWarData war = new ClanWarData(clanA.getName(), clanB.getName(), score, new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis()), 0);
runAsync(new Runnable() runAsync(new Runnable()
{ {
@Override @Override
public void run() public void run()
{ {
_repository.addWar(clanA.getId(), clanB.getId(), WarManager.WAR_START_SCORE); _repository.addWar(clanA.getId(), clanB.getId(), score);
runSync(new Runnable() runSync(new Runnable()
{ {
@ -649,14 +648,14 @@ public class ClansDataAccessLayer
} }
public void updateWar(final ClanInfo clanA, final ClanInfo clanB, final ClanWar war, final Callback<Boolean> callback) public void updateWar(final ClanInfo clanA, final ClanInfo clanB, final ClanWarData war, final Callback<Boolean> callback)
{ {
runAsync(new Runnable() runAsync(new Runnable()
{ {
@Override @Override
public void run() public void run()
{ {
final boolean ran = _repository.updateWar(clanA.getId(), clanB.getId(), war.getClanAScore(), war.isCompleted(), war.getLastUpdated(), war.getEnded()); final boolean ran = _repository.updateWar(clanA.getId(), clanB.getId(), war.getPoints(), war.getLastUpdated());
runSync(new Runnable() runSync(new Runnable()
{ {
@Override @Override

View File

@ -37,6 +37,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.creature.event.CreatureSpawnCustomEvent; import mineplex.core.creature.event.CreatureSpawnCustomEvent;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
@ -587,6 +588,12 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
UtilPlayer.message(player, message); UtilPlayer.message(player, message);
} }
public void middleTextClan(ClanInfo clan, String header, String footer)
{
for (Player player : clan.getOnlinePlayers())
UtilTextMiddle.display(header, footer, player);
}
public void chatClan(ClanInfo clan, Player caller, String message) public void chatClan(ClanInfo clan, Player caller, String message)
{ {
messageClan(clan, C.cAqua + caller.getName() + " " + C.cDAqua + message); messageClan(clan, C.cAqua + caller.getName() + " " + C.cDAqua + message);

View File

@ -522,7 +522,7 @@ public class ClansUtility
if (cA.isAlly(cB.getName())) if (cA.isAlly(cB.getName()))
return ClanRelation.ALLY; return ClanRelation.ALLY;
if (cA.isAtWar(cB)) if (cA.isEnemy(cB))
return ClanRelation.WAR; return ClanRelation.WAR;
//Enemy //Enemy

View File

@ -704,12 +704,6 @@ public class ClansCommand extends CommandBase<ClansManager>
return; return;
} }
if (cA.isAtWar(cB.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot form an alliance with a clan you are at war with."));
return;
}
if (cB.isRequested(cA.getName())) if (cB.isRequested(cA.getName()))
{ {
// Task // Task
@ -811,10 +805,6 @@ public class ClansCommand extends CommandBase<ClansManager>
{ {
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively...")); UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
} }
else if (cB.isAtWar(cA.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You are currently at war with " + F.elem("Clan " + cB.getName()) + "."));
}
else if (cB.isNeutral(cA.getName())) else if (cB.isNeutral(cA.getName()))
{ {
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + ".")); UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));

View File

@ -37,16 +37,16 @@ public class ClanWhoPage extends ClanPageBase
@Override @Override
public void buildNoClan() public void buildNoClan()
{ {
build(); build(null);
} }
@Override @Override
public void buildClan(ClanInfo clanInfo, ClanRole clanRole) public void buildClan(ClanInfo clanInfo, ClanRole clanRole)
{ {
build(); build(clanInfo);
} }
private void build() private void build(ClanInfo clanInfo)
{ {
// Main Clan Info // Main Clan Info
{ {
@ -56,6 +56,11 @@ public class ClanWhoPage extends ClanPageBase
lore.add(C.Reset + " " + _lookupClan.getDesc()); lore.add(C.Reset + " " + _lookupClan.getDesc());
lore.add(C.Reset + C.cYellow + "Formed"); lore.add(C.Reset + C.cYellow + "Formed");
lore.add(C.Reset + " " + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT)); lore.add(C.Reset + " " + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT));
if (clanInfo != null)
{
lore.add(C.Reset + C.cYellow + "Your War Points");
lore.add(C.Reset + " " + clanInfo.getFormattedWarPoints(_lookupClan));
}
ShopItem shopItem = new ShopItem(ClanIcon.ALLIANCE.getMaterial(), ClanIcon.ALLIANCE.getData(), _lookupClan.getName(), lore.toArray(new String[0]), 1, false, false); ShopItem shopItem = new ShopItem(ClanIcon.ALLIANCE.getMaterial(), ClanIcon.ALLIANCE.getData(), _lookupClan.getName(), lore.toArray(new String[0]), 1, false, false);
setItem(slot, shopItem); setItem(slot, shopItem);

View File

@ -109,7 +109,7 @@ public class ItemMapRenderer extends MapRenderer
{ {
clanColor = Color.YELLOW; clanColor = Color.YELLOW;
} }
else if (clan.isAtWar(owningClan)) else if (clan.isEnemy(owningClan))
{ {
clanColor = Color.RED; clanColor = Color.RED;
} }

View File

@ -2,11 +2,14 @@ package mineplex.game.clans.clans.scoreboard;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.Team;
import net.minecraft.server.v1_8_R3.ScoreboardTeam; import net.minecraft.server.v1_8_R3.ScoreboardTeam;
import mineplex.core.common.util.C;
import mineplex.core.scoreboard.PlayerScoreboard; import mineplex.core.scoreboard.PlayerScoreboard;
import mineplex.core.scoreboard.ScoreboardManager; import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
@ -38,39 +41,58 @@ public class ClansPlayerScoreboard extends PlayerScoreboard
ClanInfo clan = _clansManager.getClan(player); ClanInfo clan = _clansManager.getClan(player);
ClanRelation rel = _clansManager.getClanUtility().rel(clan, clan); ClanRelation rel = _clansManager.getClanUtility().rel(clan, clan);
// Add Self to Self // Add Self to Self
add(getScoreboard(), otherPlayer, clan, rel); add(getScoreboard(), otherPlayer, clan, rel, 0);
} }
else else
{ {
ClanInfo clan = _clansManager.getClan(player); ClanInfo clan = _clansManager.getClan(player);
ClanInfo otherClan = _clansManager.getClan(otherPlayer); ClanInfo otherClan = _clansManager.getClan(otherPlayer);
ClanRelation rel = _clansManager.getClanUtility().rel(clan, otherClan); ClanRelation rel = _clansManager.getClanUtility().rel(clan, otherClan);
int clanScore = (clan != null && otherClan != null) ? clan.getWarPoints(otherClan) : 0;
int otherClanScore = (clan != null && otherClan != null) ? otherClan.getWarPoints(clan) : 0;
// Add Other to Self // Add Other to Self
add(getScoreboard(), otherPlayer, otherClan, rel); add(getScoreboard(), otherPlayer, otherClan, rel, clanScore);
// Add Self to Other // Add Self to Other
add(otherPlayer.getScoreboard(), player, clan, rel); add(otherPlayer.getScoreboard(), player, clan, rel, otherClanScore);
} }
} }
} }
public void add(Scoreboard scoreboard, Player otherPlayer, ClanInfo clanInfo, ClanRelation relation) public void add(Scoreboard scoreboard, Player otherPlayer, ClanInfo clanInfo, ClanRelation relation, int ownScore)
{ {
String teamName = getTeamName(clanInfo, relation); String teamName = getTeamName(clanInfo, relation, ownScore);
Team team = scoreboard.getTeam(teamName); Team team = scoreboard.getTeam(teamName);
if (team == null) if (team == null)
{ {
team = scoreboard.registerNewTeam(teamName); team = scoreboard.registerNewTeam(teamName);
if (clanInfo != null) if (clanInfo != null)
{
// String scoreString = (ownScore != 0 && otherScore != 0) ? " " + C.cYellow + ownScore + C.cWhite + "|" + C.cYellow + otherScore : "";
System.out.println(relation.getColor(true) + clanInfo.getName() + relation.getColor(false) + " ");
team.setPrefix(relation.getColor(true) + clanInfo.getName() + relation.getColor(false) + " "); team.setPrefix(relation.getColor(true) + clanInfo.getName() + relation.getColor(false) + " ");
// team.setSuffix(C.cWhite + " -10");
}
else else
team.setPrefix(relation.getColor(false).toString()); team.setPrefix(relation.getColor(false).toString());
} }
Objective domObjective;
if ((domObjective = scoreboard.getObjective(DisplaySlot.BELOW_NAME)) == null)
{
domObjective = scoreboard.registerNewObjective("war", "dummy");
domObjective.setDisplayName("War");
domObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
}
if (clanInfo != null)
domObjective.getScore(otherPlayer.getName()).setScore(ownScore);
team.addPlayer(otherPlayer); team.addPlayer(otherPlayer);
} }
public String getTeamName(ClanInfo clanInfo, ClanRelation relation) public String getTeamName(ClanInfo clanInfo, ClanRelation relation, int ownScore)
{ {
return (clanInfo == null ? "" : clanInfo.getName()) + relation.ordinal(); return (clanInfo == null ? "" : clanInfo.getId() + "") + relation.ordinal();
} }
} }

View File

@ -1,146 +0,0 @@
package mineplex.game.clans.clans.war;
import java.sql.Timestamp;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.core.repository.tokens.ClanWarToken;
public class ClanWar
{
private String _clanA;
private String _clanB;
private int _score;
private boolean _completed;
private Timestamp _created;
private Timestamp _ended;
private Timestamp _lastUpdated;
public ClanWar(ClanWarToken warToken)
{
_clanA = warToken.ClanA;
_clanB = warToken.ClanB;
_score = warToken.Score;
_completed = false;
_created = warToken.Created;
_ended = warToken.Ended;
_lastUpdated = warToken.Updated;
System.out.println("Loading Clan War");
System.out.println("Initiator: " + _clanA);
System.out.println("Other Clan: " + _clanB);
System.out.println("Score: " + _score);
}
public ClanWar(String clanA, String clanB, int score, boolean completed, Timestamp created, Timestamp ended, Timestamp lastUpdated)
{
_clanA = clanA;
_clanB = clanB;
_score = score;
_completed = completed;
_created = created;
_ended = ended;
_lastUpdated = lastUpdated;
}
/**
* Get the clan that was the initiator for this war
*/
public String getClanA()
{
return _clanA;
}
/**
* Get the clan that was initiated on for this war
*/
public String getClanB()
{
return _clanB;
}
/**
* Get the score of the war. Score is represented as an int value with the initiator clan's score. The score
* works as a tug of war, score starts at 20 and either the initiator will get to 40 or 0 to trigger the end of war
*/
public int getClanAScore()
{
return _score;
}
public int getClanBScore()
{
return WarManager.WAR_MAX_SCORE - getClanAScore();
}
/**
* Is the war finished (has a clan won already)
*/
public boolean isCompleted()
{
return _completed;
}
public void setCompleted(boolean completed)
{
_completed = completed;
}
public void setEnded(Timestamp ended)
{
_ended = ended;
}
/**
* Timestamp the war was initiated at
*/
public Timestamp getCreated()
{
return _created;
}
/**
* Timestamp that the war ended. Could be null if the war is still in progress (isCompleted() false)
*/
public Timestamp getEnded()
{
return _ended;
}
/**
* Timestamp that the war was last updated at. Currently not used, could be used to prune old wars
* @return
*/
public Timestamp getLastUpdated()
{
return _lastUpdated;
}
/**
* Utility method, adds a point for clanInfo
*/
public void increaseScoreFor(ClanInfo clanInfo)
{
if (_clanA.equals(clanInfo.getName()))
{
_score++;
}
else if (_clanB.equals(clanInfo.getName()))
{
_score--;
}
_lastUpdated.setTime(System.currentTimeMillis());
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof ClanWar)
{
ClanWar war = ((ClanWar) obj);
return _clanA.equals(war.getClanA()) && _clanB.equals(war.getClanB()) && _completed == war.isCompleted() && _score == war.getClanAScore()
&& _created.equals(war.getCreated());
}
return false;
}
}

View File

@ -0,0 +1,123 @@
package mineplex.game.clans.clans.war;
import java.sql.Timestamp;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.core.repository.tokens.ClanWarToken;
public class ClanWarData
{
private String _clanA;
private String _clanB;
private volatile int _clanAPoints;
private Timestamp _timeFormed;
private Timestamp _lastUpdated;
private long _cooldown;
public ClanWarData(String clanA, String clanB, int clanAPoints, Timestamp timeFormed, Timestamp lastUpdated, long cooldown)
{
_clanA = clanA;
_clanB = clanB;
_clanAPoints = clanAPoints;
_timeFormed = timeFormed;
_lastUpdated = lastUpdated;
_cooldown = cooldown;
}
public ClanWarData(ClanWarToken token)
{
this(token.ClanA, token.ClanB, token.Score, token.Created, token.Updated, 0L);
}
public String getClanA()
{
return _clanA;
}
public String getClanB()
{
return _clanB;
}
public int getPoints(ClanInfo clan)
{
if (_clanA.equals(clan.getName()))
return _clanAPoints;
else if (_clanB.equals(clan.getName()))
return -_clanAPoints;
throw new RuntimeException("ClanWarData::getPoints Invalid Clan for War. ClanA: " + _clanA + ", ClanB: " + _clanB + ", Lookup Clan: " + clan.getName());
}
public int getPoints()
{
return _clanAPoints;
}
public Timestamp getTimeFormed()
{
return _timeFormed;
}
public Timestamp getLastUpdated()
{
return _lastUpdated;
}
public void setLastUpdated(Timestamp lastUpdated)
{
_lastUpdated = lastUpdated;
}
public long getCooldown()
{
return _cooldown;
}
public void setCooldown(long cooldown)
{
_cooldown = cooldown;
}
public boolean isOnCooldown()
{
return _cooldown >= System.currentTimeMillis();
}
public void increment(ClanInfo clan)
{
if (_clanA.equals(clan.getName()))
_clanAPoints++;
else if (_clanB.equals(clan.getName()))
_clanAPoints--;
else throw new RuntimeException("ClanWarData::increment Invalid Clan for War. ClanA: " + _clanA + ", ClanB: " + _clanB + ", Lookup Clan: " + clan.getName());
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClanWarData that = (ClanWarData) o;
if (_clanAPoints != that._clanAPoints) return false;
if (_cooldown != that._cooldown) return false;
if (!_clanA.equals(that._clanA)) return false;
if (!_clanB.equals(that._clanB)) return false;
if (!_timeFormed.equals(that._timeFormed)) return false;
return _lastUpdated.equals(that._lastUpdated);
}
@Override
public int hashCode()
{
int result = _clanA.hashCode();
result = 31 * result + _clanB.hashCode();
result = 31 * result + _clanAPoints;
result = 31 * result + _timeFormed.hashCode();
result = 31 * result + _lastUpdated.hashCode();
result = 31 * result + (int) (_cooldown ^ (_cooldown >>> 32));
return result;
}
}

View File

@ -9,9 +9,9 @@ public class WarInvasion
private long _startTime; private long _startTime;
private long _endTime; private long _endTime;
public WarInvasion(ClanWar clanWar) public WarInvasion(ClanWarData clanWar)
{ {
if (clanWar.getClanAScore() > WarManager.WAR_START_SCORE) if (clanWar.getPoints() > WarManager.WAR_FINISH_POINTS)
{ {
// Initiator Won // Initiator Won
_invaderClan = clanWar.getClanA(); _invaderClan = clanWar.getClanA();

View File

@ -1,6 +1,5 @@
package mineplex.game.clans.clans.war; package mineplex.game.clans.clans.war;
import java.sql.Timestamp;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
@ -17,22 +16,22 @@ import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansUtility;
import mineplex.game.clans.clans.event.ClansPlayerDeathEvent; import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
import mineplex.game.clans.clans.war.command.DominanceCommand; import mineplex.game.clans.clans.war.command.WarPointsCommand;
import mineplex.game.clans.clans.war.command.WarCommand;
import mineplex.game.clans.clans.war.event.WarEndEvent; import mineplex.game.clans.clans.war.event.WarEndEvent;
import mineplex.game.clans.clans.war.event.WarInvasionEndEvent; import mineplex.game.clans.clans.war.event.WarInvasionEndEvent;
import mineplex.game.clans.clans.war.event.WarInvasionStartEvent; import mineplex.game.clans.clans.war.event.WarInvasionStartEvent;
public class WarManager extends MiniPlugin public class WarManager extends MiniPlugin
{ {
public static final int WAR_START_SCORE = 20; public static final int WAR_START_POINTS = 0;
public static final int WAR_MAX_SCORE = 40; public static final int WAR_FINISH_POINTS = 20;
public static final long WAR_COOLDOWN = 60000L * 60; // 60 Minutes
private final ClansManager _clansManager; private final ClansManager _clansManager;
@ -49,42 +48,6 @@ public class WarManager extends MiniPlugin
_activeInvasions = new HashMap<String, List<WarInvasion>>(); _activeInvasions = new HashMap<String, List<WarInvasion>>();
} }
public void attemptWar(Player caller, ClanInfo clanA, ClanInfo clanB, boolean inform, final Callback<ClanWar> callback)
{
// Check Self
if (clanA.equals(clanB))
{
if (inform) UtilPlayer.message(caller, F.main("War", "You cannot go to war against yourself!"));
if (callback != null) callback.run(null);
return;
}
// Check Ally
if (clanA.isAlly(clanB))
{
if (inform) UtilPlayer.message(caller, F.main("War", "You cannot go to war against an ally"));
if (callback != null) callback.run(null);
return;
}
// Check Already at War
if (clanA.isAtWar(clanB))
{
if (inform) UtilPlayer.message(caller, F.main("War", "You are already at war with " + _clansManager.getClanUtility().name(clanB, clanA)));
if (callback != null) callback.run(null);
return;
}
_clansManager.getClanDataAccess().war(clanA, clanB, new Callback<ClanWar>()
{
@Override
public void run(ClanWar data)
{
if (callback != null) callback.run(data);
}
});
}
public ClansManager getClansManager() public ClansManager getClansManager()
{ {
return _clansManager; return _clansManager;
@ -110,58 +73,6 @@ public class WarManager extends MiniPlugin
} }
} }
private void checkWarComplete(final ClanWar clanWar)
{
boolean completed = false;
if (clanWar.getClanAScore() >= WAR_START_SCORE * 2)
{
// Initiator Won
completed = true;
}
else if (clanWar.getClanAScore() <= 0)
{
// Initiated On Won
completed = true;
}
if (completed)
{
ClanInfo clanA = _clansManager.getClan(clanWar.getClanA());
ClanInfo clanB = _clansManager.getClan(clanWar.getClanB());
if (clanA == null || clanB == null)
{
System.out.println("CLAN WAR COMPLETE ERROR");
System.out.println("CLAN A OR B IS NULL! THIS SHOULDNT HAPPEN");
System.out.println("ClanA: " + clanWar.getClanA() + " clanB: " + clanWar.getClanB());
return;
}
clanWar.setCompleted(true);
clanWar.setEnded(new Timestamp(System.currentTimeMillis()));
_clansManager.getClanDataAccess().updateWar(clanA, clanB, clanWar, new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
if (data)
{
WarInvasion invasion = new WarInvasion(clanWar);
addInvasion(invasion);
// Remove from memory
WarEndEvent warEndEvent = new WarEndEvent(clanWar);
WarInvasionStartEvent invasionStartEvent = new WarInvasionStartEvent(invasion);
Bukkit.getServer().getPluginManager().callEvent(warEndEvent);
Bukkit.getServer().getPluginManager().callEvent(invasionStartEvent);
}
}
});
}
}
public boolean isBeingInvaded(ClanInfo clanInfo) public boolean isBeingInvaded(ClanInfo clanInfo)
{ {
List<WarInvasion> invasions = _activeInvasions.get(clanInfo.getName()); List<WarInvasion> invasions = _activeInvasions.get(clanInfo.getName());
@ -203,15 +114,32 @@ public class WarManager extends MiniPlugin
{ {
if (event.getKiller() != null && event.getKiller().getClan() != null) if (event.getKiller() != null && event.getKiller().getClan() != null)
{ {
ClanInfo clan = event.getPlayer().getClan(); final ClanInfo clan = event.getPlayer().getClan();
ClanInfo killerClan = event.getKiller().getClan(); final ClanInfo killerClan = event.getKiller().getClan();
ClanWar war = clan.getWar(killerClan); ClanWarData war = clan.getWarData(killerClan);
if (war != null && !war.isCompleted()) if (war != null)
{ {
_clansManager.messageClan(killerClan, C.cAqua + "Gained +1 Dominance against " + C.cRed + clan.getName()); // War already exists
war.increaseScoreFor(killerClan); ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan);
checkWarComplete(war); _clansManager.middleTextClan(killerClan, "", C.cGreen + "+1 WP against " + rel.getColor(false) + clan.getName());
_clansManager.middleTextClan(clan, "", C.cGreen + "-1 WP against " + rel.getColor(false) + killerClan.getName());
war.increment(killerClan);
// todo: check war complete
}
else
{
// Need to create war
_clansManager.getClanDataAccess().war(killerClan, clan, WAR_START_POINTS + 1, new Callback<ClanWarData>()
{
@Override
public void run(ClanWarData data)
{
ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan);
_clansManager.middleTextClan(killerClan, "", C.cGreen + "+1 WP against " + rel.getColor(false) + clan.getName());
_clansManager.middleTextClan(clan, "", C.cGreen + "-1 WP against " + rel.getColor(false) + killerClan.getName());
}
});
} }
} }
} }
@ -263,7 +191,6 @@ public class WarManager extends MiniPlugin
@Override @Override
public void addCommands() public void addCommands()
{ {
addCommand(new DominanceCommand(this)); addCommand(new WarPointsCommand(this));
addCommand(new WarCommand(this));
} }
} }

View File

@ -1,68 +0,0 @@
package mineplex.game.clans.clans.war.command;
import java.util.Arrays;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.war.ClanWar;
import mineplex.game.clans.clans.war.WarManager;
public class WarCommand extends CommandBase<WarManager>
{
public WarCommand(WarManager plugin)
{
super(plugin, Rank.ALL, "war");
}
@Override
public void Execute(Player caller, String[] args)
{
final ClanInfo clan = Plugin.getClansManager().getClan(caller);
if (clan == null)
{
UtilPlayer.message(caller, F.main("War", "You are not in a clan"));
return;
}
if (args == null || args.length != 1)
{
UtilPlayer.message(caller, F.main("War", "Usage: /war <clan>"));
return;
}
final ClanInfo search = Plugin.getClansManager().getClanUtility().searchClanPlayer(caller, args[0], true);
if (search == null) return;
Plugin.attemptWar(caller, clan, search, true, new Callback<ClanWar>()
{
@Override
public void run(ClanWar data)
{
if (data != null)
{
Plugin.getClansManager().messageClan(clan, C.cRed + "You are now at war with " + C.cDRed + search.getName());
Plugin.getClansManager().messageClan(search, C.cRed + "You are now at war with " + C.cDRed + clan.getName());
}
}
});
}
@Override
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
{
System.out.println("Tab Complete!");
System.out.println("Label: " + commandLabel);
System.out.println("args: " + Arrays.toString(args));
return args.length == 1 ? getMatches(args[0], Plugin.getClansManager().getClanNameSet()) : null;
}
}

View File

@ -9,14 +9,14 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.war.ClanWar; import mineplex.game.clans.clans.war.ClanWarData;
import mineplex.game.clans.clans.war.WarManager; import mineplex.game.clans.clans.war.WarManager;
public class DominanceCommand extends CommandBase<WarManager> public class WarPointsCommand extends CommandBase<WarManager>
{ {
public DominanceCommand(WarManager plugin) public WarPointsCommand(WarManager plugin)
{ {
super(plugin, Rank.ALL, "dominance", "dom"); super(plugin, Rank.ALL, "warpoints", "wp", "dom");
} }
@Override @Override
@ -39,20 +39,21 @@ public class DominanceCommand extends CommandBase<WarManager>
String searchName = clansManager.getClanUtility().name(search, clan); String searchName = clansManager.getClanUtility().name(search, clan);
String selfName = clansManager.getClanUtility().name(clan, clan); String selfName = clansManager.getClanUtility().name(clan, clan);
ClanWar war = clan.getWar(search); ClanWarData war = clan.getWarData(search);
if (war == null) if (war == null)
{ {
UtilPlayer.message(caller, F.main("War", "You are not at war with " + searchName)); UtilPlayer.message(caller, F.main("War", "War Status with " + searchName));
UtilPlayer.message(caller, F.main("War", "War Points: " + F.elem("" + WarManager.WAR_START_POINTS)));
} }
else else
{ {
System.out.println("Initiator: " + war.getClanA()); System.out.println("Initiator: " + war.getClanA());
System.out.println("Other Clan: " + war.getClanB()); System.out.println("Other Clan: " + war.getClanB());
System.out.println("Score: " + war.getClanAScore()); System.out.println("Score: " + war.getPoints(clan));
UtilPlayer.message(caller, F.main("War", "War Status with " + searchName)); UtilPlayer.message(caller, F.main("War", "War Status with " + searchName));
UtilPlayer.message(caller, F.main("War", "Initiated by: " + (war.getClanA().equals(clan.getName()) ? selfName : searchName))); UtilPlayer.message(caller, F.main("War", "Initiated by: " + (war.getClanA().equals(clan.getName()) ? selfName : searchName)));
UtilPlayer.message(caller, F.main("War", "Initiator Dominance: " + F.elem("" + war.getClanAScore()))); UtilPlayer.message(caller, F.main("War", "War Points: " + clan.getFormattedWarPoints(search)));
UtilPlayer.message(caller, F.main("War", "Age: " + F.elem(UtilTime.convertString(System.currentTimeMillis() - war.getCreated().getTime(), 1, UtilTime.TimeUnit.FIT)))); UtilPlayer.message(caller, F.main("War", "Age: " + F.elem(UtilTime.convertString(System.currentTimeMillis() - war.getTimeFormed().getTime(), 1, UtilTime.TimeUnit.FIT))));
} }
} }

View File

@ -3,18 +3,18 @@ package mineplex.game.clans.clans.war.event;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import mineplex.game.clans.clans.war.ClanWar; import mineplex.game.clans.clans.war.ClanWarData;
public class WarEndEvent extends Event public class WarEndEvent extends Event
{ {
private ClanWar _war; private ClanWarData _war;
public WarEndEvent(ClanWar war) public WarEndEvent(ClanWarData war)
{ {
_war = war; _war = war;
} }
public ClanWar getWar() public ClanWarData getWar()
{ {
return _war; return _war;
} }

View File

@ -3,18 +3,18 @@ package mineplex.game.clans.clans.war.event;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import mineplex.game.clans.clans.war.ClanWar; import mineplex.game.clans.clans.war.ClanWarData;
public class WarStartEvent extends Event public class WarStartEvent extends Event
{ {
private ClanWar _war; private ClanWarData _war;
public WarStartEvent(ClanWar war) public WarStartEvent(ClanWarData war)
{ {
_war = war; _war = war;
} }
public ClanWar getWar() public ClanWarData getWar()
{ {
return _war; return _war;
} }