Merge branch 'clans-beta' of http://184.154.0.242:7990/scm/min/mineplex into clans_custom_gear

This commit is contained in:
Ty Sayers 2015-08-30 12:28:55 -07:00
commit ab73cc2fbe
8 changed files with 35 additions and 15 deletions

View File

@ -354,12 +354,12 @@ public class CoreClientManager extends MiniPlugin
// Reserved Slot Check // Reserved Slot Check
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers()) if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
{ {
if (client.GetRank().Has(event.getPlayer(), Rank.ULTRA, false)) // if (client.GetRank().Has(event.getPlayer(), Rank.ULTRA, false))
{ // {
event.allow(); // event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED); // event.setResult(PlayerLoginEvent.Result.ALLOWED);
return; // return;
} // }
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "This server is full and no longer accepts players."); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "This server is full and no longer accepts players.");
} }

View File

@ -10,4 +10,4 @@ public interface ILoginProcessor
void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException; void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException;
String getQuery(int accountId, String uuid, String name); String getQuery(int accountId, String uuid, String name);
} }

View File

@ -63,7 +63,7 @@ public class ClanRepository extends RepositoryBase
private static String ADD_CLAN_MEMBER = "INSERT INTO accountClan (accountId, clanId, clanRole) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.name = ?;"; private static String ADD_CLAN_MEMBER = "INSERT INTO accountClan (accountId, clanId, clanRole) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.name = ?;";
private static String ADD_CLAN_ALLIANCE = "INSERT INTO clanAlliances (clanId, otherClanId, trusted) VALUES (?, ?, ?);"; private static String ADD_CLAN_ALLIANCE = "INSERT INTO clanAlliances (clanId, otherClanId, trusted) VALUES (?, ?, ?);";
private static String ADD_CLAN_ENEMY = "INSERT INTO clanEnemies (clanId, otherClanId, timeFormed) VALUES (?, ?, now());"; private static String ADD_CLAN_ENEMY = "INSERT INTO clanEnemies (clanId, otherClanId, timeFormed) VALUES (?, ?, now());";
private static String ADD_CLAN_TERRITORY = "INSERT INTO clanTerritory (clanId, chunk, safe) VALUES (?, ?, ?, ?);"; private static String ADD_CLAN_TERRITORY = "INSERT INTO clanTerritory (clanId, chunk, safe) VALUES (?, ?, ?);";
private static String UPDATE_CLAN = "UPDATE clans SET name = ?, description = ?, home = ?, admin = ?, energy = ?, kills = ?, murder = ?, deaths = ?, warWins = ?, warLosses = ?, lastOnline = ? WHERE id = ?;"; private static String UPDATE_CLAN = "UPDATE clans SET name = ?, description = ?, home = ?, admin = ?, energy = ?, kills = ?, murder = ?, deaths = ?, warWins = ?, warLosses = ?, lastOnline = ? WHERE id = ?;";
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 = ?;";

View File

@ -25,7 +25,7 @@ public class ClansAdmin
public void command(Player caller, String[] args) public void command(Player caller, String[] args)
{ {
if (Clans.getClientManager().hasRank(caller, Rank.ADMIN)) if (!Clans.getClientManager().hasRank(caller, Rank.ADMIN))
{ {
return; return;
} }

View File

@ -777,11 +777,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public void onJoin(PlayerLoginEvent event) public void onJoin(PlayerLoginEvent event)
{ {
Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
if (!rank.Has(Rank.DEVELOPER)/* && !event.getPlayer().isWhitelisted()*/) if (!rank.Has(Rank.MAPDEV) && !event.getPlayer().isWhitelisted())
{ {
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
// event.setKickMessage("This server is whitelisted!"); // event.setKickMessage("This server is whitelisted!");
event.setKickMessage("Only Dev+ can join this server"); event.setKickMessage("Only MapDev+ can join this server");
} }
} }
} }

View File

@ -2,9 +2,13 @@ package mineplex.game.clans.clans.commands;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -20,6 +24,7 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor
{ {
private boolean _enabled; private boolean _enabled;
private String _serverName; private String _serverName;
private ConcurrentLinkedQueue<String> _queue;
public ClansLoginManager(JavaPlugin plugin, CoreClientManager clientManager, String serverName) public ClansLoginManager(JavaPlugin plugin, CoreClientManager clientManager, String serverName)
{ {
@ -27,9 +32,21 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor
_serverName = serverName; _serverName = serverName;
_enabled = true; _enabled = true;
_queue = new ConcurrentLinkedQueue<String>();
clientManager.addStoredProcedureLoginProcessor(this); clientManager.addStoredProcedureLoginProcessor(this);
} }
@EventHandler
public void onPlayerJoin(PlayerLoginEvent event)
{
if (_queue.contains(event.getPlayer().getName()))
{
event.setKickMessage("This is not your Clans home server");
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
_queue.remove(event.getPlayer().getName());
}
}
private void kickPlayer(final String playerName, final String homeServer) private void kickPlayer(final String playerName, final String homeServer)
{ {
runSyncLater(new Runnable() runSyncLater(new Runnable()
@ -43,7 +60,7 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor
player.kickPlayer("This is not your home server. To play clans, connect to " + homeServer); player.kickPlayer("This is not your home server. To play clans, connect to " + homeServer);
} }
} }
}, 30); }, 20);
} }
@Override @Override
@ -60,6 +77,7 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor
System.out.println("Player " + playerName + " is from server: " + serverName); System.out.println("Player " + playerName + " is from server: " + serverName);
if (!serverName.equals(_serverName)) if (!serverName.equals(_serverName))
{ {
_queue.add(playerName);
kickPlayer(playerName, serverName); kickPlayer(playerName, serverName);
} }
} }

View File

@ -46,6 +46,7 @@ public class UndeadCamp extends WorldEvent
{ {
super(eventManager.getDamage(), eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "Undead Camp", centerLocation); super(eventManager.getDamage(), eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "Undead Camp", centerLocation);
_eventManager = eventManager;
_campSize = CampSize.getCampSize(UtilServer.getPlayers().length); _campSize = CampSize.getCampSize(UtilServer.getPlayers().length);
_campType = CampType.values()[getRandom().nextInt(CampType.values().length)]; _campType = CampType.values()[getRandom().nextInt(CampType.values().length)];
_chests = new HashSet<Block>(); _chests = new HashSet<Block>();

View File

@ -6,6 +6,7 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.shop.ClansShopPage; import mineplex.game.clans.shop.ClansShopPage;
import mineplex.game.clans.shop.PvpItem;
public class PvpPage extends ClansShopPage<PvpShop> public class PvpPage extends ClansShopPage<PvpShop>
{ {
@ -55,9 +56,9 @@ public class PvpPage extends ClansShopPage<PvpShop>
addShopItem(33, Material.BOW, 175, 35, "Standard Bow"); addShopItem(33, Material.BOW, 175, 35, "Standard Bow");
addShopItem(34, Material.ARROW, 10, 2, (byte)0, "Arrows", 16); addShopItem(34, Material.ARROW, 10, 2, (byte)0, "Arrows", 16);
//addPvpItem(51, new PvpItem(Material.ENCHANTMENT_TABLE, (byte)0, 1, "Class Shop", 30000)); addShopItem(51, Material.ENCHANTMENT_TABLE, 30000, 0, (byte) 0, "Class Shop", 1);
//addPvpItem(52, new PvpItem(Material.TNT, (byte)0, 1, "TNT", 30000, 1)); addShopItem(52, Material.TNT, 30000, 0, (byte) 0, "TNT", 1);
//addPvpItem(53, new PvpItem(Material.BREWING_STAND_ITEM, (byte)0, 1, "TNT Generator", 300000)); addShopItem(53, Material.BREWING_STAND_ITEM, 300000, 0, (byte) 0, "TNT Generator", 1);
} }
} }