Final changes

This commit is contained in:
Shaun Bennett 2016-04-04 23:28:38 +10:00
parent 02cb0e1f7e
commit fecd3c1eaa
12 changed files with 109 additions and 85 deletions

View File

@ -357,27 +357,27 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
List<Location> jumpOffHolograms = Arrays.asList( List<Location> jumpOffHolograms = Arrays.asList(
// West Spawn // West Spawn
new Location(Spawn.getSpawnWorld(), 8, 204, 359), new Location(Spawn.getSpawnWorld(), 8, 200, 359),
new Location(Spawn.getSpawnWorld(), 34, 204, 390), new Location(Spawn.getSpawnWorld(), 34, 200, 390),
new Location(Spawn.getSpawnWorld(), 8, 204, 418), new Location(Spawn.getSpawnWorld(), 8, 200, 418),
new Location(Spawn.getSpawnWorld(), -25, 204, 390), new Location(Spawn.getSpawnWorld(), -25, 200, 390),
// East Spawn // East Spawn
new Location(Spawn.getSpawnWorld(), 34, 207, -393), new Location(Spawn.getSpawnWorld(), 34, 200, -393),
new Location(Spawn.getSpawnWorld(), 8, 207, -365), new Location(Spawn.getSpawnWorld(), 8, 200, -365),
new Location(Spawn.getSpawnWorld(), -25, 207, -393), new Location(Spawn.getSpawnWorld(), -25, 200, -393),
new Location(Spawn.getSpawnWorld(), 8, 207, -424) new Location(Spawn.getSpawnWorld(), 8, 200, -424)
); );
List<Location> welcomeHolograms = Arrays.asList( List<Location> welcomeHolograms = Arrays.asList(
new Location(Spawn.getSpawnWorld(), 17, 204, 390), new Location(Spawn.getSpawnWorld(), 17, 200, 390),
new Location(Spawn.getSpawnWorld(), 8, 204, 399), new Location(Spawn.getSpawnWorld(), 8, 200, 399),
new Location(Spawn.getSpawnWorld(), 0, 204, 390), new Location(Spawn.getSpawnWorld(), 0, 200, 390),
new Location(Spawn.getSpawnWorld(), 8, 204, 381), new Location(Spawn.getSpawnWorld(), 8, 200, 381),
new Location(Spawn.getSpawnWorld(), 8, 207, -384), new Location(Spawn.getSpawnWorld(), 8, 200, -384),
new Location(Spawn.getSpawnWorld(), 0, 207, -393), new Location(Spawn.getSpawnWorld(), 0, 200, -393),
new Location(Spawn.getSpawnWorld(), 8, 207, -402), new Location(Spawn.getSpawnWorld(), 8, 200, -402),
new Location(Spawn.getSpawnWorld(), 17, 207, -393) new Location(Spawn.getSpawnWorld(), 17, 200, -393)
); );
for (Location location : jumpOffHolograms) for (Location location : jumpOffHolograms)
@ -824,9 +824,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
} }
List<Player> recipients = new ArrayList<>(); List<Player> recipients = new ArrayList<>();
String message = event.getMessage();//_chat.getFilteredMessage(event.getPlayer(), event.getMessage());
for (Player other : event.getRecipients()) for (Player other : event.getRecipients())
{ {
if (_tutorial.inTutorial(other))
continue;
ClanInfo otherClan = _clanUtility.getClanByPlayer(other); ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
if (otherClan == null) if (otherClan == null)
@ -835,14 +840,12 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
} }
else else
{ {
String message = _chat.getFilteredMessage(event.getPlayer(), event.getMessage());
ClanRelation rel = _clanUtility.rel(clan, otherClan); ClanRelation rel = _clanUtility.rel(clan, otherClan);
other.sendMessage(rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message); other.sendMessage(rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message);
} }
} }
recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), event.getMessage()))); recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), message)));
recipients.clear(); recipients.clear();
} }
@ -1168,12 +1171,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerLoginEvent event) public void onJoin(PlayerLoginEvent event)
{ {
if (true) Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
if (rank.has(Rank.MODERATOR))
{ {
return; event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED);
} }
Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp()) if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
{ {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Beta is full! Try again soon"); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Beta is full! Try again soon");

View File

@ -42,7 +42,7 @@ public class ClansRegions extends MiniPlugin
public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks) public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks)
public final static int SHOP_RADIUS = 5; // Radius of shop claim area (measured in chunks) public final static int SHOP_RADIUS = 5; // Radius of shop claim area (measured in chunks)
public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks) public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks)
public final static int BORDERLANDS_RADIUS = 50; // Radius of borderlands claim area (measured in chunks) public final static int BORDERLANDS_RADIUS = 85; // Radius of borderlands claim area (measured in chunks)
public static final int BORDER_RADIUS = 1319; public static final int BORDER_RADIUS = 1319;
private ClansManager _manager; private ClansManager _manager;

View File

@ -54,6 +54,7 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -582,46 +583,50 @@ public class Gameplay extends MiniPlugin
} }
} }
// @EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
// public void replantTree(BlockBreakEvent event) public void replantTree(BlockBreakEvent event)
// { {
// final Block block = event.getBlock(); final Block block = event.getBlock();
//
// if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null) if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null)
// { {
// return; return;
// } }
//
// if (!UtilItem.isLog(block.getType())) if (!UtilItem.isLog(block.getType()))
// { {
// return; return;
// } }
//
// if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType())) if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType()))
// { {
// return; return;
// } }
//
// if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType())) if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType()))
// { {
// return; return;
// } }
//
// if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS) if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS)
// { {
// return; return;
// } }
//
// final byte data = block.getData(); final byte data = block.getData();
//
// UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
// public void run() public void run()
// { {
// block.setType(Material.SAPLING); Material mat = block.getRelative(BlockFace.DOWN).getType();
// block.setData(data); if (mat == Material.DIRT || mat == Material.GRASS)
// } {
// }, 20 * 5); block.setType(Material.SAPLING);
// } block.setData(data);
}
}
}, 20 * 10);
}
@EventHandler @EventHandler
public void killRain(WeatherChangeEvent event) public void killRain(WeatherChangeEvent event)

View File

@ -38,7 +38,7 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
@Override @Override
protected void buildPage() protected void buildPage()
{ {
addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "East Spawn", new String[] { addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "North Spawn", new String[] {
C.cWhite + "Spawns are locations where", C.cWhite + "Spawns are locations where",
C.cWhite + "you respawn after dying.", C.cWhite + "you respawn after dying.",
" ", " ",
@ -46,9 +46,9 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "",
getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRed + "You are already here." : "", getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRed + "You are already here." : "",
}, 14 + 10, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0); }, 4, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0);
addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "West Spawn", new String[] { addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "South Spawn", new String[] {
C.cWhite + "Spawns are locations where", C.cWhite + "Spawns are locations where",
C.cWhite + "you respawn after dying.", C.cWhite + "you respawn after dying.",
" ", " ",
@ -56,23 +56,23 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "",
getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRed + "You are already here." : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRed + "You are already here." : "",
}, 12 + 8, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0); }, 22 + 9 + 9, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0);
addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "North Shop", new String[] { addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "West Shop", new String[] {
C.cWhite + "Shops are locations where you", C.cWhite + "Shops are locations where you",
C.cWhite + "can buy and sell all sorts of goods.", C.cWhite + "can buy and sell all sorts of goods.",
" ", " ",
C.cWhite + "You cannot be attacked here,", C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
}, 4, ClanIcon.CASTLE.getData()); }, 12 + 8, ClanIcon.CASTLE.getData());
addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "South Shop", new String[] { addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "East Shop", new String[] {
C.cWhite + "Shops are locations where you", C.cWhite + "Shops are locations where you",
C.cWhite + "can buy and sell all sorts of goods.", C.cWhite + "can buy and sell all sorts of goods.",
" ", " ",
C.cWhite + "You cannot be attacked here,", C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
}, 22 + 9 + 9, ClanIcon.CASTLE.getData()); }, 14 + 10, ClanIcon.CASTLE.getData());
final ClanInfo clan = _plugin.getClan(getPlayer()); final ClanInfo clan = _plugin.getClan(getPlayer());
Outpost outpost = _plugin.getSiegeManager().getOutpostManager().Get(clan); Outpost outpost = _plugin.getSiegeManager().getOutpostManager().Get(clan);

View File

@ -65,7 +65,9 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement
Player recipient = recipients.next(); Player recipient = recipients.next();
if (inTutorial(recipient)) if (inTutorial(recipient))
{
recipients.remove(); recipients.remove();
}
} }
return Boolean.FALSE; return Boolean.FALSE;

View File

@ -10,7 +10,7 @@ public class FinishCommand extends CommandBase<TutorialManager>
{ {
public FinishCommand(TutorialManager plugin) public FinishCommand(TutorialManager plugin)
{ {
super(plugin, Rank.MODERATOR, "finish", "end"); super(plugin, Rank.DEVELOPER, "finish", "end");
} }
@Override @Override

View File

@ -13,7 +13,7 @@ public class StartCommand extends CommandBase<TutorialManager>
{ {
public StartCommand(TutorialManager plugin) public StartCommand(TutorialManager plugin)
{ {
super(plugin, Rank.MODERATOR, "start"); super(plugin, Rank.DEVELOPER, "start");
} }
@Override @Override

View File

@ -13,7 +13,7 @@ public class TutorialCommand extends MultiCommandBase<TutorialManager>
{ {
public TutorialCommand(TutorialManager plugin) public TutorialCommand(TutorialManager plugin)
{ {
super(plugin, Rank.MODERATOR, "tutorial", "tut"); super(plugin, Rank.DEVELOPER, "tutorial", "tut");
AddCommand(new StartCommand(plugin)); AddCommand(new StartCommand(plugin));
AddCommand(new FinishCommand(plugin)); AddCommand(new FinishCommand(plugin));

View File

@ -129,16 +129,19 @@ public class ClansMainTutorial extends Tutorial
//ClansManager.getInstance().getPvpTimer().unpause(player); //ClansManager.getInstance().getPvpTimer().unpause(player);
_taskManager.completedTask(new Callback<Boolean>() if (!_taskManager.hasCompletedTask(player, getTaskIdentifier()))
{ {
@Override _taskManager.completedTask(new Callback<Boolean>()
public void run(Boolean data)
{ {
@Override
public void run(Boolean data)
{
GoldManager.getInstance().addGold(player, 32000); GoldManager.getInstance().addGold(player, 32000);
UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!")); UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!"));
} }
}, player, getTaskIdentifier()); }, player, getTaskIdentifier());
}
/* /*
ClansManager.getInstance().runAsync(() -> { ClansManager.getInstance().runAsync(() -> {

View File

@ -1,6 +1,8 @@
package mineplex.hub.server.ui.clans; package mineplex.hub.server.ui.clans;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator;
import java.util.TreeSet;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -10,6 +12,7 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
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.UtilAlg;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.DisplayButton; import mineplex.core.shop.item.DisplayButton;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
@ -32,7 +35,7 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
public ClansServerPage(ServerManager plugin, ClansServerShop shop, CoreClientManager clientManager, public ClansServerPage(ServerManager plugin, ClansServerShop shop, CoreClientManager clientManager,
DonationManager donationManager, Player player, ClanRepository repository) DonationManager donationManager, Player player, ClanRepository repository)
{ {
super(plugin, shop, clientManager, donationManager, "Clans Alpha", player, 27); super(plugin, shop, clientManager, donationManager, "Clans Beta", player, 54);
_repository = repository; _repository = repository;
_accountId = clientManager.getAccountId(player); _accountId = clientManager.getAccountId(player);
@ -72,7 +75,14 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
private void buildNoClanPage() private void buildNoClanPage()
{ {
Collection<ServerInfo> servers = getPlugin().getServerList("Clans"); Collection<ServerInfo> servers = UtilAlg.sortSet(getPlugin().getServerList("Clans"), new Comparator<ServerInfo>()
{
@Override
public int compare(ServerInfo o1, ServerInfo o2)
{
return o1.Name.compareTo(o2.Name);
}
});
int currentSlot = 9; int currentSlot = 9;
for (ServerInfo server : servers) for (ServerInfo server : servers)

View File

@ -24,7 +24,7 @@ public class ClansServerShop extends ShopBase<ServerManager>
public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager) public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{ {
super(plugin, clientManager, donationManager, "Clans Alpha"); super(plugin, clientManager, donationManager, "Clans Beta");
_repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName()); _repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName());
} }

View File

@ -243,5 +243,4 @@ public enum GameType
{ {
return _display.getKitGameName(); return _display.getKitGameName();
} }
} }