Tweaked menus for quick game, Cosmetic menu.

Removed debug for Hub
Output a little debug info in LobbyBalancer
Added duplicate check to ServerMonitor
updated Customer SUpport server to have changeable password, added logging of command executors, added lifetime perks for hero/ultra
This commit is contained in:
Jonathan Williams 2014-08-28 14:01:37 -07:00
parent 7829188c32
commit 409e2c6141
19 changed files with 477 additions and 265 deletions

View File

@ -80,7 +80,10 @@ public class LobbyBalancer implements Listener, Runnable
}
if (_bestServerIndex < _sortedLobbies.size())
{
event.setTarget(_plugin.getProxy().getServerInfo(_sortedLobbies.get(_bestServerIndex).getName()));
System.out.println("Sending " + event.getPlayer().getName() + " to " + _sortedLobbies.get(_bestServerIndex).getName() + "(" + _sortedLobbies.get(_bestServerIndex).getPublicAddress() + ")");
}
_playersSentToBestServer++;
}

View File

@ -1,12 +1,14 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
import mineplex.core.cosmetic.ui.CosmeticShop;
@ -49,7 +51,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
else
{
*/
AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)", 1, false));
AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)" + ChatColor.RESET, 1, false));
//}
final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));

View File

@ -132,8 +132,6 @@ public class Hub extends JavaPlugin implements IRelation
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
}
@Override

View File

@ -54,7 +54,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
ChatColor.RESET + "death with the other teams.",
}));
this.setItem(3, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[]
this.setItem(3, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + "Search for chests to find loot and ",
@ -150,10 +150,9 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
ChatColor.RESET + "Dragon Escape",
ChatColor.RESET + "Milk the Cow",
ChatColor.RESET + "Super Paintball",
ChatColor.RESET + "Turf Forts",
ChatColor.RESET + "Turf Wars",
ChatColor.RESET + "Death Tag",
ChatColor.RESET + "Bacon Brawl",
ChatColor.RESET + "Squid Sauce"
ChatColor.RESET + "Bacon Brawl"
}));
_minigameCycle.add(ItemStackFactory.Instance.CreateStack(122, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String []

View File

@ -305,7 +305,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
{
int slots = Plugin.GetRequiredSlots(player, serverInfo.ServerType);
if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))))
if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA)))
{
PlayDenySound(player);
return;

View File

@ -84,7 +84,8 @@ public class ServerGroup
public boolean getAddNoCheat() { return _addNoCheat; }
// The set of active MinecraftServers that belong to this server group
private Set<MinecraftServer> servers;
private Set<MinecraftServer> _servers;
public Set<MinecraftServer> getServers() { return _servers; }
/**
* Class constructor
@ -124,7 +125,7 @@ public class ServerGroup
*/
public int getServerCount()
{
return servers.size();
return _servers.size();
}
/**
@ -135,7 +136,7 @@ public class ServerGroup
{
int joinable = 0;
for (MinecraftServer server : servers)
for (MinecraftServer server : _servers)
{
if (server.isJoinable())
{
@ -154,7 +155,7 @@ public class ServerGroup
{
int playerCount = 0;
for (MinecraftServer server : servers)
for (MinecraftServer server : _servers)
{
playerCount += server.getPlayerCount();
}
@ -170,7 +171,7 @@ public class ServerGroup
{
int maxPlayerCount = 0;
for (MinecraftServer server : servers)
for (MinecraftServer server : _servers)
{
maxPlayerCount += server.getMaxPlayerCount();
}
@ -186,7 +187,7 @@ public class ServerGroup
{
Collection<MinecraftServer> emptyServers = new HashSet<MinecraftServer>();
for (MinecraftServer server : servers)
for (MinecraftServer server : _servers)
{
if (server.isEmpty())
{
@ -203,14 +204,14 @@ public class ServerGroup
*/
private void fetchServers(Region region)
{
this.servers = new HashSet<MinecraftServer>();
this._servers = new HashSet<MinecraftServer>();
ServerRepository repository = ServerManager.getServerRepository(region);
for (MinecraftServer server : repository.getServerStatuses())
{
if (_name.equalsIgnoreCase(server.getGroup()))
{
servers.add(server);
_servers.add(server);
}
}
}
@ -226,7 +227,7 @@ public class ServerGroup
{
boolean uniqueId = true;
for (MinecraftServer server : servers)
for (MinecraftServer server : _servers)
{
String serverName = server.getName();
try
@ -255,5 +256,4 @@ public class ServerGroup
}
}
}
}

View File

@ -18,6 +18,7 @@ import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
import mineplex.core.common.util.NautHashMap;
import mineplex.serverdata.DedicatedServer;
import mineplex.serverdata.DedicatedServerSorter;
import mineplex.serverdata.MinecraftServer;
@ -105,21 +106,26 @@ public class ServerMonitor
iterator.remove();
}
// TODO: Check with Jonathan to see if we still need this duplication server code
/*for (GroupStatusData groupStatus : groupStatusList.values())
for (ServerGroup groupStatus : serverGroups)
{
for (ServerStatusData serverToKill : groupStatus.KillServers)
{
System.out.println("----DUPLICATE SERVER----> " + serverToKill.Address + ", " + serverToKill.Name);
killServer(serverToKill);
}
NautHashMap<Integer, MinecraftServer> _serverMap = new NautHashMap<Integer, MinecraftServer>();
for (ServerStatusData serverToKill : groupStatus.Servers.values())
for (Iterator<MinecraftServer> serverIterator = groupStatus.getServers().iterator(); serverIterator.hasNext();)
{
if (serverTracker.containsKey(serverToKill.Name))
serverTracker.remove(serverToKill.Name);
MinecraftServer server = serverIterator.next();
int serverNum = Integer.parseInt(server.getName().split("-")[1]);
if (_serverMap.containsKey(serverNum))
{
killServer(server.getName(), server.getPublicAddress(), "[KILLED] [DUPLICATE] " + server.getName() + ":" + server.getPublicAddress(), true);
serverIterator.remove();
}
else
{
_serverMap.put(serverNum, server);
}
}
}*/
}
HashSet<String> onlineServers = new HashSet<String>();

View File

@ -3,10 +3,11 @@ package mineplex.staffServer.customerSupport;
import java.text.SimpleDateFormat;
import java.util.HashSet;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.AsyncPlayerChatEvent;
@ -17,13 +18,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor;
import mineplex.core.donation.repository.token.CoinTransactionToken;
@ -99,8 +96,10 @@ public class CustomerSupport extends MiniPlugin
for (CoinTransactionToken transaction : donor.getCoinTransactions())
{
if (transaction.Source.equalsIgnoreCase("purchase"))
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.Amount + " Coins");
if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward"))
continue;
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.Amount + " Coins - Applied via " + transaction.Source);
}
for (TransactionToken transaction : donor.getTransactions())
@ -112,6 +111,13 @@ public class CustomerSupport extends MiniPlugin
_salesPackageManager.displaySalesPackages(caller, playerName);
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
}
@EventHandler
public void blockBreak(BlockBreakEvent event)
{
if (event.getPlayer().getGameMode() != GameMode.CREATIVE)
event.setCancelled(true);
}
@EventHandler
public void removeMapping(PlayerQuitEvent event)

View File

@ -0,0 +1,23 @@
package mineplex.staffServer.password;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
public class ChangePasswordCommand extends CommandBase<Password>
{
public ChangePasswordCommand(Password plugin)
{
super(plugin, Rank.ADMIN, "changepassword");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args != null && args.length == 1)
{
Plugin.changePassword(caller, args[0]);
}
}
}

View File

@ -9,10 +9,13 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F;
import mineplex.core.recharge.Recharge;
public class Password extends MiniPlugin
{
private HashSet<Player> _accepted = new HashSet<Player>();
private String _password = "ClothStarRust";
public Password(JavaPlugin plugin)
{
@ -23,6 +26,7 @@ public class Password extends MiniPlugin
public void AddCommands()
{
AddCommand(new PasswordCommand(this));
AddCommand(new ChangePasswordCommand(this));
}
@EventHandler
@ -35,17 +39,23 @@ public class Password extends MiniPlugin
public void run()
{
if (!_accepted.contains(event.getPlayer()))
event.getPlayer().kickPlayer("You don't know the password little twerp.");
event.getPlayer().kickPlayer("You don't know the password!");
}
}, 200L);
}
public void checkPassword(Player caller, String attempt)
{
if (attempt.equals("ClothStarRust"))
if (attempt.equals(_password))
{
_accepted.add(caller);
caller.sendMessage(F.main(GetName(), "I guess you get to stay."));
}
}
public void changePassword(Player caller, String password)
{
_password = password;
caller.sendMessage(F.main(GetName(), "Password changed to " + _password));
}
}

View File

@ -17,6 +17,7 @@ public class PasswordCommand extends CommandBase<Password>
{
if (args != null && args.length == 1)
{
resetCommandCharge(caller);
Plugin.checkPassword(caller, args[0]);
}
}

View File

@ -23,7 +23,7 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
String playerName = args[0];
int amount = Integer.parseInt(args[1]);
Plugin.getDonationManager().RewardCoins(null, "purchase", playerName, amount);
Plugin.getDonationManager().RewardCoins(null, caller.getName(), playerName, amount);
caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " coins to " + playerName + "'s account!"));
}
}

View File

@ -0,0 +1,33 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class LifetimeHeroCommand extends CommandBase<SalesPackageManager>
{
public LifetimeHeroCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "lifetimehero");
}
@Override
public void Execute(Player caller, String[] args)
{
resetCommandCharge(caller);
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " HERO true");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 40000");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 120");
Bukkit.getServer().getPluginManager().callEvent(event);
}
}

View File

@ -0,0 +1,33 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class LifetimeUltraCommand extends CommandBase<SalesPackageManager>
{
public LifetimeUltraCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "lifetimeultra");
}
@Override
public void Execute(Player caller, String[] args)
{
resetCommandCharge(caller);
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " ULTRA true");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 20000");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 60");
Bukkit.getServer().getPluginManager().callEvent(event);
}
}

View File

@ -17,6 +17,8 @@ public class Sales extends MultiCommandBase<SalesPackageManager>
AddCommand(new BoosterCommand(plugin));
AddCommand(new UltraCommand(plugin));
AddCommand(new HeroCommand(plugin));
AddCommand(new LifetimeUltraCommand(plugin));
AddCommand(new LifetimeHeroCommand(plugin));
}
@Override

View File

@ -13,7 +13,10 @@ public class LifetimeHero extends SalesPackageBase
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales rank " + playerName + " HERO true", " Lifetime Hero Rank.");
addButton(agent, "/sales coin " + playerName + " 40000", " 40,000 Coins");
addButton(agent, "/sales booster " + playerName + " 120", " 120 Gem Boosters");
addButton(agent, "/sales rank " + playerName + " HERO true", " Lifetime Hero (Also, unlocks kits).");
addButton(agent, "Apply All", "/sales lifetimehero " + playerName, " Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

@ -13,7 +13,10 @@ public class LifetimeUltra extends SalesPackageBase
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales rank " + playerName + " ULTRA true", " Lifetime Ultra Rank.");
addButton(agent, "/sales coin " + playerName + " 20000", " 20,000 Coins");
addButton(agent, "/sales booster " + playerName + " 60", " 60 Gem Boosters");
addButton(agent, "/sales rank " + playerName + " ULTRA true", " Lifetime Ultra (Also, unlocks kits).");
addButton(agent, "Apply All", "/sales lifetimeultra " + playerName, " Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

@ -556,6 +556,77 @@
account.RankExpire = DateTime.Now.AddMonths(1);
account.RankPerm = token.Perm;
if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm == true)
{
repository.Attach(account);
repository.Edit(account);
addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0);
addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0);
addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0);
addAccountTransaction(repository, account, "A Barbarians Life Bomber", 0, 0);
addAccountTransaction(repository, account, "The Bridges Archer", 0, 0);
addAccountTransaction(repository, account, "The Bridges Bomber", 0, 0);
addAccountTransaction(repository, account, "The Bridges Brawler", 0, 0);
addAccountTransaction(repository, account, "The Bridges Miner", 0, 0);
addAccountTransaction(repository, account, "Castle Siege Castle Assassin", 0, 0);
addAccountTransaction(repository, account, "Castle Siege Castle Brawler", 0, 0);
addAccountTransaction(repository, account, "Castle Siege Castle Knight", 0, 0);
addAccountTransaction(repository, account, "Castle Siege Undead Archer", 0, 0);
addAccountTransaction(repository, account, "Castle Siege Undead Zombie", 0, 0);
addAccountTransaction(repository, account, "Death Tag Runner Archer", 0, 0);
addAccountTransaction(repository, account, "Death Tag Runner Traitor", 0, 0);
addAccountTransaction(repository, account, "Dragon Escape Disruptor", 0, 0);
addAccountTransaction(repository, account, "Dragon Escape Warper", 0, 0);
addAccountTransaction(repository, account, "Dragons Marksman", 0, 0);
addAccountTransaction(repository, account, "Dragons Pyrotechnic", 0, 0);
addAccountTransaction(repository, account, "Block Hunt Instant Hider", 0, 0);
addAccountTransaction(repository, account, "Block Hunt Shocking Hider", 0, 0);
addAccountTransaction(repository, account, "Block Hunt Radar Hunter", 0, 0);
addAccountTransaction(repository, account, "Block Hunt TNT Hunter", 0, 0);
addAccountTransaction(repository, account, "Super Paintball Machine Gun", 0, 0);
addAccountTransaction(repository, account, "Super Paintball Shotgun", 0, 0);
addAccountTransaction(repository, account, "One in the Quiver Brawler", 0, 0);
addAccountTransaction(repository, account, "One in the Quiver Enchanter", 0, 0);
addAccountTransaction(repository, account, "Runner Archer", 0, 0);
addAccountTransaction(repository, account, "Runner Frosty", 0, 0);
addAccountTransaction(repository, account, "Sheep Quest Archer", 0, 0);
addAccountTransaction(repository, account, "Sheep Quest Brute", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Blaze", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Chicken", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Mad Cow", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Creeper", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Enderman", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Undead Knight", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Magma Cube", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Pig", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Skeletal Horse", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Sky Squid", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Snowman", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Witch", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Wither", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Wither Skeleton", 0, 0);
addAccountTransaction(repository, account, "Super Smash Mobs Wolf", 0, 0);
addAccountTransaction(repository, account, "Snake Super Snake", 0, 0);
addAccountTransaction(repository, account, "Snake Other Snake", 0, 0);
addAccountTransaction(repository, account, "Sneaky Assassins Ranged Assassin", 0, 0);
addAccountTransaction(repository, account, "Sneaky Assassins Revealer", 0, 0);
addAccountTransaction(repository, account, "Super Spleef Archer", 0, 0);
addAccountTransaction(repository, account, "Super Spleef Brawler", 0, 0);
addAccountTransaction(repository, account, "Squid Shooter Squid Blaster", 0, 0);
addAccountTransaction(repository, account, "Squid Shooter Squid Sniper", 0, 0);
addAccountTransaction(repository, account, "Survival Games Archer", 0, 0);
addAccountTransaction(repository, account, "Survival Games Assassin", 0, 0);
addAccountTransaction(repository, account, "Survival Games Beastmaster", 0, 0);
addAccountTransaction(repository, account, "Survival Games Bomber", 0, 0);
addAccountTransaction(repository, account, "Survival Games Brawler", 0, 0);
addAccountTransaction(repository, account, "Survival Games Necromancer", 0, 0);
addAccountTransaction(repository, account, "Turf Wars Infiltrator", 0, 0);
addAccountTransaction(repository, account, "Turf Wars Shredder", 0, 0);
addAccountTransaction(repository, account, "Zombie Survival Survivor Archer", 0, 0);
addAccountTransaction(repository, account, "Zombie Survival Survivor Rogue", 0, 0);
}
repository.CommitChanges();
return rank.Name.ToString();
@ -710,5 +781,24 @@
return clientToken;
}
}
private void addAccountTransaction(IRepository repository, Account account, string salesPackageName, int gems, int coins)
{
var accountTransaction = new AccountTransaction
{
Account = account,
SalesPackageName = salesPackageName,
Date = (long)TimeUtil.GetCurrentMilliseconds(),
Gems = gems,
Coins = coins
};
if (account.AccountTransactions == null)
account.AccountTransactions = new List<AccountTransaction> { accountTransaction };
else
{
account.AccountTransactions.Add(accountTransaction);
}
}
}
}

File diff suppressed because it is too large Load Diff