Show region on scoreboard, moving on to event finishes

This commit is contained in:
Shaun Bennett 2015-06-17 20:37:45 -05:00
parent dbdb2b3fc5
commit b5f4574b1b
5 changed files with 59 additions and 29 deletions

View File

@ -5,15 +5,14 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.scoreboard.ScoreboardData; import mineplex.core.scoreboard.ScoreboardData;
import mineplex.core.scoreboard.ScoreboardManager; import mineplex.core.scoreboard.ScoreboardManager;
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.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementClanInfo; import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementClan;
import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementGold; import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementPlayer;
import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementWar; import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementWar;
public class ClansScoreboardManager extends MiniPlugin public class ClansScoreboardManager extends MiniPlugin
@ -39,13 +38,13 @@ public class ClansScoreboardManager extends MiniPlugin
data.writeEmpty(); data.writeEmpty();
data.writeElement(new ScoreboardElementClanInfo(_clansManager)); data.writeElement(new ScoreboardElementClan(_clansManager));
data.writeEmpty(); data.writeEmpty();
data.writeElement(new ScoreboardElementWar(_clansManager, _clansManager.getWarManager())); data.writeElement(new ScoreboardElementWar(_clansManager, _clansManager.getWarManager()));
data.writeEmpty(); data.writeEmpty();
data.writeElement(new ScoreboardElementGold()); data.writeElement(new ScoreboardElementPlayer(_clansManager));
data.writeEmpty(); data.writeEmpty();
data.writeElement(_clansManager.getWorldEvent()); data.writeElement(_clansManager.getWorldEvent());

View File

@ -11,11 +11,11 @@ import mineplex.core.scoreboard.elements.ScoreboardElement;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
public class ScoreboardElementClanInfo implements ScoreboardElement public class ScoreboardElementClan implements ScoreboardElement
{ {
private ClansManager _clansManager; private ClansManager _clansManager;
public ScoreboardElementClanInfo(ClansManager clansManager) public ScoreboardElementClan(ClansManager clansManager)
{ {
_clansManager = clansManager; _clansManager = clansManager;
} }

View File

@ -1,21 +0,0 @@
package mineplex.game.clans.clans.scoreboard.elements;
import java.util.ArrayList;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.core.scoreboard.elements.ScoreboardElement;
import org.bukkit.entity.Player;
public class ScoreboardElementGold implements ScoreboardElement
{
@Override
public ArrayList<String> getLines(ScoreboardManager manager, Player player)
{
ArrayList<String> output = new ArrayList<String>();
output.add(C.cGreen + "Gold: " + C.cWhite + manager.getDonation().Get(player).GetBalance(CurrencyType.Gold) + "");
return output;
}
}

View File

@ -0,0 +1,51 @@
package mineplex.game.clans.clans.scoreboard.elements;
import java.util.ArrayList;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.core.scoreboard.elements.ScoreboardElement;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansUtility;
import mineplex.game.clans.clans.repository.ClanTerritory;
import org.bukkit.entity.Player;
public class ScoreboardElementPlayer implements ScoreboardElement
{
private ClansManager _clansManager;
public ScoreboardElementPlayer(ClansManager clansManager)
{
_clansManager = clansManager;
}
@Override
public ArrayList<String> getLines(ScoreboardManager manager, Player player)
{
ArrayList<String> output = new ArrayList<String>();
output.add(C.cGreen + "Gold: " + C.cWhite + manager.getDonation().Get(player).GetBalance(CurrencyType.Gold) + "");
output.add("");
String regionString = C.xWilderness + "Wilderness";
ClanTerritory claim = _clansManager.getClanUtility().getClaim(player.getLocation());
if (claim != null)
{
//Relation
ClansUtility.ClanRelation relation = _clansManager.getClanUtility().relPT(player.getName(), claim.Chunk);
//Name
regionString = _clansManager.getClanUtility().mRel(relation, claim.Owner, false);
//Trust
if (relation == ClansUtility.ClanRelation.ALLY_TRUST)
regionString += C.mBody + "(" + C.mElem + "Trusted" + C.mBody + ")";
}
output.add(regionString);
return output;
}
}

View File

@ -124,7 +124,8 @@ public class SlimeBoss extends WorldEvent
{ {
for (int i = 0; i < splitCount; i++) for (int i = 0; i < splitCount; i++)
{ {
spawnSlime(slime.getEntity().getLocation(), splitSize); Location location = slime.getEntity().getLocation().add(Math.random(), 0, Math.random());
spawnSlime(location, splitSize);
} }
} }
} }