Added Legend package for support.
Refactored Key/Chest commands and added FrostLord package. Removed password, added whitelist.
This commit is contained in:
parent
6e93d85da8
commit
eb5a7b4276
@ -101,6 +101,22 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
}, player.getUniqueId().toString(), category, item, count);
|
||||
}
|
||||
|
||||
public boolean validCategory(String category)
|
||||
{
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
return _categories.containsKey(category);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean validItem(String item)
|
||||
{
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
return _items.containsKey(item);
|
||||
}
|
||||
}
|
||||
|
||||
public Item getItem(String itemName)
|
||||
{
|
||||
Item item = null;
|
||||
@ -111,8 +127,6 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
|
||||
if (name.equalsIgnoreCase(itemName))
|
||||
item = entry.getValue();
|
||||
|
||||
System.out.println(name + " " + entry.getValue().Category);
|
||||
}
|
||||
|
||||
return item;
|
||||
|
@ -3,6 +3,8 @@ package mineplex.staffServer;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.util.ProfileLoader;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -21,8 +23,10 @@ import mineplex.staffServer.customerSupport.CustomerSupport;
|
||||
import mineplex.staffServer.password.Password;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class StaffServer extends JavaPlugin
|
||||
@ -58,7 +62,7 @@ public class StaffServer extends JavaPlugin
|
||||
new FileUpdater(this, portal);
|
||||
|
||||
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this, clientManager), new StatsManager(this, clientManager)));
|
||||
new Password(this, serverStatusManager.getCurrentServerName());
|
||||
//new Password(this, serverStatusManager.getCurrentServerName());
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
@ -66,5 +70,10 @@ public class StaffServer extends JavaPlugin
|
||||
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
||||
|
||||
Bukkit.getWorlds().get(0).setSpawnLocation(0, 102, 0);
|
||||
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("dooskee").toString(), "dooskee").loadProfile());
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Morenaa").toString(), "Morenaa").loadProfile());
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("Revolark").toString(), "Revolark").loadProfile());
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new ProfileLoader(UUIDFetcher.getUUIDOf("EvilEsther").toString(), "EvilEsther").loadProfile());
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,10 @@ import mineplex.staffServer.salespackage.command.DisplayPackageCommand;
|
||||
import mineplex.staffServer.salespackage.command.Sales;
|
||||
import mineplex.staffServer.salespackage.salespackages.ApplyKits;
|
||||
import mineplex.staffServer.salespackage.salespackages.Coins;
|
||||
import mineplex.staffServer.salespackage.salespackages.FrostLord;
|
||||
import mineplex.staffServer.salespackage.salespackages.GemHunter;
|
||||
import mineplex.staffServer.salespackage.salespackages.LifetimeHero;
|
||||
import mineplex.staffServer.salespackage.salespackages.LifetimeLegend;
|
||||
import mineplex.staffServer.salespackage.salespackages.LifetimeUltra;
|
||||
import mineplex.staffServer.salespackage.salespackages.MonthlyHero;
|
||||
import mineplex.staffServer.salespackage.salespackages.MonthlyUltra;
|
||||
@ -48,11 +50,13 @@ public class SalesPackageManager extends MiniPlugin
|
||||
AddSalesPackage(new MonthlyHero(this));
|
||||
AddSalesPackage(new LifetimeUltra(this));
|
||||
AddSalesPackage(new LifetimeHero(this));
|
||||
AddSalesPackage(new LifetimeLegend(this));
|
||||
AddSalesPackage(new GemHunter(this, 4));
|
||||
AddSalesPackage(new GemHunter(this, 8));
|
||||
AddSalesPackage(new ApplyKits(this));
|
||||
AddSalesPackage(new TreasureChests(this));
|
||||
AddSalesPackage(new TreasureKeys(this));
|
||||
AddSalesPackage(new FrostLord(this));
|
||||
}
|
||||
|
||||
private void AddSalesPackage(SalesPackageBase salesPackage)
|
||||
|
@ -13,34 +13,48 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
public class TreasureChestCommand extends CommandBase<SalesPackageManager>
|
||||
public class ItemCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public TreasureChestCommand(SalesPackageManager plugin)
|
||||
public ItemCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "chest");
|
||||
super(plugin, Rank.MODERATOR, "item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 2)
|
||||
if (args == null)
|
||||
return;
|
||||
|
||||
final String playerName = args[0];
|
||||
int amountSpecified = Integer.parseInt(args[1]);
|
||||
final String category = args[2];
|
||||
String tempName = args[3];
|
||||
|
||||
for (int i = 4; i < args.length; i++)
|
||||
{
|
||||
tempName += " " + args[i];
|
||||
}
|
||||
|
||||
final String itemName = tempName;
|
||||
final UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName);
|
||||
|
||||
if (uuid == null)
|
||||
UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
if (Math.abs(amountSpecified) != 10)
|
||||
final int amount = amountSpecified;
|
||||
|
||||
if (!Plugin.getInventoryManager().validCategory(category))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You have specified an invalid amount of chests."));
|
||||
amountSpecified = 0;
|
||||
caller.sendMessage(F.main(Plugin.getName(), "You have entered an invalid Category."));
|
||||
return;
|
||||
}
|
||||
|
||||
final int amount = amountSpecified;
|
||||
if (!Plugin.getInventoryManager().validItem(itemName))
|
||||
{
|
||||
caller.sendMessage(F.main(Plugin.getName(), "You have entered an invalid Item."));
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
|
||||
{
|
||||
@ -51,15 +65,14 @@ public class TreasureChestCommand extends CommandBase<SalesPackageManager>
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " Treasure Chests" + "."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + "."));
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " Treasure Chests."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + "."));
|
||||
}
|
||||
}
|
||||
}, uuid.toString(), "Utility", "Treasure Chest", amount);
|
||||
}, uuid.toString(), category, itemName, amount);
|
||||
}
|
||||
}, playerName, uuid, "Treasure Chest " + amount, false, 0, false);
|
||||
|
||||
}, playerName, uuid, (amount == 1 ? itemName : itemName + " " + amount), false, 0, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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 LifetimeLegendCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public LifetimeLegendCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "lifetimelegend");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
resetCommandCharge(caller);
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " LEGEND true"));
|
||||
|
||||
resetCommandCharge(caller);
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 60000"));
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ public class RankCommand extends CommandBase<SalesPackageManager>
|
||||
|
||||
final Rank rankEnum = Rank.valueOf(rank);
|
||||
|
||||
if (rankEnum == Rank.HERO || rankEnum == Rank.ULTRA)
|
||||
if (rankEnum == Rank.HERO || rankEnum == Rank.ULTRA || rankEnum == Rank.LEGEND)
|
||||
{
|
||||
Plugin.getClientManager().SaveRank(playerName, mineplex.core.common.Rank.valueOf(rank), perm);
|
||||
caller.sendMessage(F.main(Plugin.getName(), playerName + "'s rank has been updated to " + rank + "!"));
|
||||
|
@ -14,13 +14,13 @@ public class Sales extends MultiCommandBase<SalesPackageManager>
|
||||
|
||||
AddCommand(new RankCommand(plugin));
|
||||
AddCommand(new CoinCommand(plugin));
|
||||
AddCommand(new TreasureChestCommand(plugin));
|
||||
AddCommand(new TreasureKeyCommand(plugin));
|
||||
AddCommand(new ItemCommand(plugin));
|
||||
AddCommand(new GemHunterCommand(plugin));
|
||||
AddCommand(new UltraCommand(plugin));
|
||||
AddCommand(new HeroCommand(plugin));
|
||||
AddCommand(new LifetimeUltraCommand(plugin));
|
||||
AddCommand(new LifetimeHeroCommand(plugin));
|
||||
AddCommand(new LifetimeLegendCommand(plugin));
|
||||
AddCommand(new KitsCommand(plugin));
|
||||
}
|
||||
|
||||
|
@ -1,64 +0,0 @@
|
||||
package mineplex.staffServer.salespackage.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
public class TreasureKeyCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public TreasureKeyCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 2)
|
||||
return;
|
||||
|
||||
final String playerName = args[0];
|
||||
int amountSpecified = Integer.parseInt(args[1]);
|
||||
|
||||
final UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName);
|
||||
|
||||
if (uuid == null)
|
||||
UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
if (Math.abs(amountSpecified) != 5)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You have specified an invalid amount of keys."));
|
||||
amountSpecified = 0;
|
||||
}
|
||||
|
||||
final int amount = amountSpecified;
|
||||
|
||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
|
||||
{
|
||||
public void run(TransactionResponse data)
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " Treasure Keys" + "."));
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " Treasure Keys."));
|
||||
}
|
||||
}
|
||||
}, uuid.toString(), "Treasure", "Treasure Key", amount);
|
||||
}
|
||||
}, playerName, uuid, "Treasure Key " + amount, false, 0, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FrostLord extends SalesPackageBase
|
||||
{
|
||||
public FrostLord(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Frost Lord");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales item " + playerName + " 1 Particle Frost Lord", "Give Frost Lord Particle.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class LifetimeLegend extends SalesPackageBase
|
||||
{
|
||||
public LifetimeLegend(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Lifetime Legend");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales coin " + playerName + " 60000", " 60,000 Coins");
|
||||
addButton(agent, "/sales rank " + playerName + " LEGEND true", " Lifetime Legend.");
|
||||
addButton(agent, "Apply All", "/sales lifetimelegend " + playerName, " Apply all above.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ public class TreasureChests extends SalesPackageBase
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales chest " + playerName + " 10", "Give 10 Treasure Chests.");
|
||||
addButton(agent, "/sales item " + playerName + " 10 Utility Treasure Chest", "Give 10 Treasure Chests.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class TreasureKeys extends SalesPackageBase
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales key " + playerName + " 5", "Give 5 Treasure Keys.");
|
||||
addButton(agent, "/sales item " + playerName + " 5 Treasure Treasure Key", "Give 5 Treasure Keys.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user