Remove even more things

This commit is contained in:
Spencer 2018-01-06 16:57:01 -05:00 committed by Alexander Meech
parent 0a1e1e6119
commit 8afb120173
6 changed files with 1 additions and 285 deletions

View File

@ -1,46 +0,0 @@
package mineplex.staffServer.customerSupport;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class CheckCommandOld extends CommandBase<CustomerSupport>
{
public CheckCommandOld(CustomerSupport plugin)
{
super(plugin, CustomerSupport.Perm.CHECK_COMMAND, "check", "c");
}
@Override
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length != 1)
{
Plugin.Help(caller);
}
else
{
String playerName = args[0];
_commandCenter.GetClientManager().checkPlayerName(caller, playerName, name ->
{
if (name != null)
{
_commandCenter.GetClientManager().loadClientByName(name, client ->
{
if (client != null)
{
Plugin.showPlayerInfo(caller, client, false);
}
else
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not load data for " + name));
}
});
}
});
}
}
}

View File

@ -87,9 +87,6 @@ public class CustomerSupport extends MiniPlugin
_allowWeatherChange = false;
addCommand(new CheckCommand(this));
addCommand(new checkBonusCommand(this));
addCommand(new checkOwnsPackageCommand(this));
addCommand(new ListPPCCommand(this, _powerPlayRepo));
generatePermissions();
}

View File

@ -1,19 +0,0 @@
package mineplex.staffServer.customerSupport;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
public class CustomerSupportRepository extends RepositoryBase
{
public CustomerSupportRepository(JavaPlugin plugin)
{
super(DBPool.getAccount());
}
public void loadBonusLogForAccountId(int accountId, CustomerSupport customerSupport)
{
executeQuery("SELECT accountId, items.name, itemChange, time FROM bonusLog INNER JOIN items ON itemId = items.id WHERE accountId = " + accountId + " ORDER BY bonusLog.id DESC;", customerSupport);
}
}

View File

@ -1,117 +0,0 @@
package mineplex.staffServer.customerSupport;
import java.time.YearMonth;
import java.time.format.TextStyle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.command.CommandBase;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.powerplayclub.PowerPlayClubRepository;
import mineplex.core.powerplayclub.PowerPlayClubRewards;
import mineplex.core.powerplayclub.PowerPlayData;
public class ListPPCCommand extends CommandBase<CustomerSupport>
{
private final PowerPlayClubRepository _powerPlayRepo;
public ListPPCCommand(CustomerSupport customerSupport, PowerPlayClubRepository powerPlayRepo)
{
super(customerSupport, CustomerSupport.Perm.LIST_PPC_COMMAND, "listppc", "checkppc");
_powerPlayRepo = powerPlayRepo;
}
@Override
public void Execute(Player caller, String[] args)
{
if (args.length < 1)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: /" + _aliasUsed + " <Player>"));
return;
}
_commandCenter.GetClientManager().checkPlayerName(caller, args[0], name ->
{
if (name != null)
{
_commandCenter.GetClientManager().loadClientByName(name, client ->
{
if (client == null)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not load data for " + name));
return;
}
PowerPlayData powerPlayData = _powerPlayRepo.loadData(client.getAccountId()).join();
Inventory inventory = buildPPCDisplay(client.getName(), powerPlayData);
caller.openInventory(inventory);
});
}
});
}
private static Inventory buildPPCDisplay(String playerName, PowerPlayData data)
{
Inventory result = Bukkit.createInventory(null, Math.max(1, (int)Math.ceil(data.getSubscriptions().size() / 9D)) * 9, playerName + "'s Subscriptions");
data.getSubscriptions().stream().map(sub -> buildSubDisplay(data, sub)).forEach(result::addItem);
return result;
}
private static ItemStack buildSubDisplay(PowerPlayData data, PowerPlayData.Subscription sub)
{
PowerPlayData dataForSubscription = PowerPlayData.fromSubsAndClaims(Collections.singletonList(sub), Collections.emptyList());
dataForSubscription.getUnclaimedMonths().removeIf(yearMonth -> !data.getUnclaimedMonths().contains(yearMonth));
boolean claimed = dataForSubscription.getUnclaimedMonths().isEmpty();
List<String> lore = new ArrayList<>();
lore.add(C.cYellow + "Start date: " + C.cWhite + sub._startDate.getMonth().getDisplayName(TextStyle.SHORT, Locale.US) + " " + sub._startDate.getDayOfMonth() + " " + sub._startDate.getYear());
lore.add(C.cYellow + "Duration: " + C.cWhite + sub._duration.name());
lore.add(" ");
lore.add(C.cGreen + "Subscription Cosmetics");
PowerPlayClubRewards.rewards().entrySet().stream()
.filter(entry -> dataForSubscription.getUsableCosmeticMonths().contains(entry.getKey()))
.sorted(Comparator.comparing(Map.Entry::getKey))
.forEach(entry ->
{
YearMonth yearMonth = entry.getKey();
lore.add(C.cWhite + " " + entry.getValue().getPrizeName() + " " + C.cGold + yearMonth.getMonth().getDisplayName(TextStyle.SHORT, Locale.US) + " " + yearMonth.getYear());
});
lore.add(" ");
if (claimed)
{
lore.add(C.cYellow + "All current rewards claimed");
}
else
{
lore.add(C.cRed + "Unclaimed rewards");
lore.add(" " + C.cWhite + (PowerPlayClubRewards.AMPLIFIERS_PER_MONTH * dataForSubscription.getUnclaimedMonths().size()) + " Game Amplifier");
lore.add(" " + C.cWhite + (PowerPlayClubRewards.CHESTS_PER_MONTH * dataForSubscription.getUnclaimedMonths().size()) + " Omega Chest");
}
ItemStack stack = new ItemStack(claimed ? Material.IRON_BLOCK : Material.GOLD_BLOCK);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(C.cWhite + "Subscription");
meta.setLore(lore);
stack.setItemMeta(meta);
return stack;
}
}

View File

@ -1,46 +0,0 @@
package mineplex.staffServer.customerSupport;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class checkBonusCommand extends CommandBase<CustomerSupport>
{
public checkBonusCommand(CustomerSupport plugin)
{
super(plugin, CustomerSupport.Perm.CHECK_BONUS_COMMAND, "checkbonus");
}
@Override
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length != 1)
{
caller.sendMessage(F.main(Plugin.getName(), "Usage : /checkbonus defek7"));
}
else
{
String playerName = args[0];
_commandCenter.GetClientManager().checkPlayerName(caller, playerName, name ->
{
if (name != null)
{
_commandCenter.GetClientManager().loadClientByName(name, client ->
{
if (client != null)
{
Plugin.showPlayerInfo(caller, client, true);
}
else
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not load data for " + name));
}
});
}
});
}
}
}

View File

@ -1,53 +0,0 @@
package mineplex.staffServer.customerSupport;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class checkOwnsPackageCommand extends CommandBase<CustomerSupport>
{
public checkOwnsPackageCommand(CustomerSupport plugin)
{
super(plugin, CustomerSupport.Perm.CHECK_OWNS_PACKAGE_COMMAND, "checkownspackage");
}
@Override
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length < 2)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: /" + _aliasUsed + " <Player> <Package>"));
}
else
{
String playerName = args[0];
String packageName = args[1];
for (int i = 2; i < args.length; i++)
{
packageName += (" " + args[i]);
}
final String salesPackage = packageName;
_commandCenter.GetClientManager().checkPlayerName(caller, playerName, name ->
{
if (name != null)
{
_commandCenter.GetClientManager().loadClientByName(name, client ->
{
if (client != null)
{
Plugin.showPlayerPackageInfo(caller, client, salesPackage);
}
else
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not load data for " + name));
}
});
}
});
}
}
}