Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
CoderTim 2014-08-21 15:01:22 -04:00
commit 94f2aade08
45 changed files with 793 additions and 382 deletions

View File

@ -2,6 +2,6 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="Z:/Mineplex/master/Plugins/Libraries/craftbukkit.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/bin/craftbukkit.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -37,6 +37,8 @@ import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.base.Charsets;
public class CoreClientManager extends MiniPlugin public class CoreClientManager extends MiniPlugin
{ {
private JavaPlugin _plugin; private JavaPlugin _plugin;
@ -149,6 +151,28 @@ public class CoreClientManager extends MiniPlugin
} }
} }
public void loadClientByName(final String playerName, final Runnable runnable)
{
final CoreClient client = Add(playerName);
final UUID uuid = UUID.nameUUIDFromBytes((playerName).getBytes(Charsets.UTF_8));
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
LoadClient(client, uuid, "null");
Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable()
{
public void run()
{
if (runnable != null)
runnable.run();
}
});
}
});
}
private void LoadClient(final CoreClient client, final UUID uuid, String ipAddress) private void LoadClient(final CoreClient client, final UUID uuid, String ipAddress)
{ {
TimingManager.start(client.GetPlayerName() + " LoadClient Total."); TimingManager.start(client.GetPlayerName() + " LoadClient Total.");

View File

@ -31,6 +31,11 @@ public class AccountRepository
return new JsonWebCall(_webAddress + "PlayerAccount/Login").ExecuteReturnStream(token); return new JsonWebCall(_webAddress + "PlayerAccount/Login").ExecuteReturnStream(token);
} }
public String getClientByUUID(UUID uuid)
{
return new JsonWebCall(_webAddress + "PlayerAccount/GetAccountByUUID").ExecuteReturnStream(uuid.toString());
}
public void SaveRank(Callback<Rank> callback, String name, Rank rank, boolean perm) public void SaveRank(Callback<Rank> callback, String name, Rank rank, boolean perm)
{ {
RankUpdateToken token = new RankUpdateToken(); RankUpdateToken token = new RankUpdateToken();

View File

@ -8,5 +8,6 @@ public class DonorToken
public boolean Donated; public boolean Donated;
public List<Integer> SalesPackages; public List<Integer> SalesPackages;
public List<String> UnknownSalesPackages; public List<String> UnknownSalesPackages;
public List<TransactionToken> Transactions;
public int Coins; public int Coins;
} }

View File

@ -0,0 +1,9 @@
package mineplex.core.donation.repository.token;
public class TransactionToken
{
public long Date;
public String SalesPackageName;
public int Gems;
public int Coins;
}

View File

@ -45,8 +45,8 @@ public class DDoSProtectionSwitcher
_repository = new DnsMadeEasyRepository(); _repository = new DnsMadeEasyRepository();
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
while (true) //while (true)
{ //{
if (_repository.switchToDDOSProt()) if (_repository.switchToDDOSProt())
{ {
System.out.println("Starting DDoS Protection Switch at " + dateFormat.format(new Date())); System.out.println("Starting DDoS Protection Switch at " + dateFormat.format(new Date()));
@ -203,7 +203,7 @@ public class DDoSProtectionSwitcher
{ {
e.printStackTrace(); e.printStackTrace();
} }
} //}
/* /*
* // Switch off ddos protection for (DnsRecord record : records.data) { * // Switch off ddos protection for (DnsRecord record : records.data) {
* if (record.type.equalsIgnoreCase("CNAME")) { if * if (record.type.equalsIgnoreCase("CNAME")) { if

View File

@ -9,7 +9,8 @@ import java.text.SimpleDateFormat;
public class DnsMadeEasyRepository public class DnsMadeEasyRepository
{ {
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/BungeeServers?autoReconnect=true&failOverReadOnly=false&maxReconnects=10"; // Yip Yip actual IP because if null route happens we can't resolve the HOSTNAME DERP FACE DEFEK7!!! -defek7
private String _connectionString = "jdbc:mysql://10.35.74.133:3306/BungeeServers?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
private String _userName = "root"; private String _userName = "root";
private String _password = "tAbechAk3wR7tuTh"; private String _password = "tAbechAk3wR7tuTh";
@ -119,6 +120,9 @@ public class DnsMadeEasyRepository
} }
} }
return countOffline >= 20; //if (countOffline > 5)
System.out.println(countOffline + " offline bungees.");
return true;
} }
} }

View File

@ -88,7 +88,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor
String name = args[1]; String name = args[1];
int amount = Integer.parseInt(args[2]); int amount = Integer.parseInt(args[2]);
_donationManager.PurchaseUnknownSalesPackage(null, name, "Gem Booster", false, 0, false); _donationManager.PurchaseUnknownSalesPackage(null, name, "Gem Booster " + amount, false, 0, false);
_repository.addGemBooster(name, amount); _repository.addGemBooster(name, amount);
System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Gem Boosters" + "."); System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Gem Boosters" + ".");
} }

View File

@ -507,7 +507,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy"); Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy");
obj.setDisplaySlot(DisplaySlot.SIDEBAR); obj.setDisplaySlot(DisplaySlot.SIDEBAR);
for (Rank rank : Rank.values()) for (Rank rank : Rank.values())
{ {
if (rank != Rank.ALL) if (rank != Rank.ALL)

View File

@ -61,12 +61,6 @@ public class Party
{ {
_scoreboard.getTeam(Manager.GetClients().Get(player).GetRank().Name).addPlayer(player); _scoreboard.getTeam(Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
} }
//Owners
_scoreboard.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("Chiss"));
_scoreboard.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("defek7"));
_scoreboard.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("Spu_"));
_scoreboard.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("sterling_"));
} }
public void JoinParty(Player player) public void JoinParty(Player player)

View File

@ -62,7 +62,7 @@ import mineplex.serverdata.MinecraftServer;
public class ServerManager extends MiniPlugin public class ServerManager extends MiniPlugin
{ {
private static final Long FREE_PORTAL_TIMER = 30000L; private static final Long FREE_PORTAL_TIMER = 1000L;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;

View File

@ -76,7 +76,7 @@ public class ServerMonitor
for (MinecraftServer deadServer : _repository.getDeadServers()) for (MinecraftServer deadServer : _repository.getDeadServers())
{ {
killServer(deadServer.getName(), deadServer.getPublicAddress(), true); killServer(deadServer.getName(), deadServer.getPublicAddress(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
} }
List<DedicatedServer> dedicatedServers = new ArrayList<DedicatedServer>(_repository.getDedicatedServers()); List<DedicatedServer> dedicatedServers = new ArrayList<DedicatedServer>(_repository.getDedicatedServers());
@ -139,11 +139,9 @@ public class ServerMonitor
iterator.remove(); iterator.remove();
else if (System.currentTimeMillis() - entry.getValue().getValue() > 20000) else if (System.currentTimeMillis() - entry.getValue().getValue() > 20000)
{ {
System.out.println("-=[SERVER STARTUP TOO SLOW]=- " + entry.getKey());
String serverName = entry.getKey(); String serverName = entry.getKey();
String serverAddress = entry.getValue().getKey(); String serverAddress = entry.getValue().getKey();
killServer(serverName, serverAddress, true); killServer(serverName, serverAddress, "[KILLED] [SLOW-STARTUP] " + serverName + ":" + serverAddress, true);
iterator.remove(); iterator.remove();
} }
} }
@ -220,7 +218,6 @@ public class ServerMonitor
private static void handleGroupChanges(List<DedicatedServer> dedicatedServers, HashMap<String, Entry<String, Long>> serverTracker, ServerGroup serverGroup, boolean free) private static void handleGroupChanges(List<DedicatedServer> dedicatedServers, HashMap<String, Entry<String, Long>> serverTracker, ServerGroup serverGroup, boolean free)
{ {
int serverNum = 0; int serverNum = 0;
//GroupStatusData groupStatus = groupStatusList.get(serverGroup.Name);
int requiredTotal = serverGroup.getRequiredTotalServers(); int requiredTotal = serverGroup.getRequiredTotalServers();
int requiredJoinable = serverGroup.getRequiredJoinableServers(); int requiredJoinable = serverGroup.getRequiredJoinableServers();
int joinableServers = serverGroup.getJoinableCount(); int joinableServers = serverGroup.getJoinableCount();
@ -231,8 +228,12 @@ public class ServerMonitor
// Minimum 1500 slot bufferzone // Minimum 1500 slot bufferzone
if (serverGroup.getName().equalsIgnoreCase("Lobby")) if (serverGroup.getName().equalsIgnoreCase("Lobby"))
{ {
if (serverGroup.getMaxPlayerCount() - serverGroup.getPlayerCount() < 1500) int availableSlots = serverGroup.getMaxPlayerCount() - serverGroup.getPlayerCount();
serversToAdd = requiredJoinable;
if (availableSlots < 1500)
serversToAdd = Math.max(1, (1500 / availableSlots) - serverGroup.getMaxPlayers());
else if (serversToKill > 0)
serversToKill = Math.min(serversToKill, (availableSlots - 1500) / 80);
} }
while (serversToAdd > 0) while (serversToAdd > 0)
@ -262,12 +263,12 @@ public class ServerMonitor
{ {
List<MinecraftServer> emptyServers = new ArrayList<MinecraftServer>(serverGroup.getEmptyServers()); List<MinecraftServer> emptyServers = new ArrayList<MinecraftServer>(serverGroup.getEmptyServers());
MinecraftServer emptyServer = emptyServers.get(serversToKill - 1); MinecraftServer emptyServer = emptyServers.get(serversToKill - 1);
killServer(emptyServer); killServer(emptyServer, "[KILLED] [EXCESS] " + emptyServer.getName() + ":" + emptyServer.getPublicAddress());
serversToKill--; serversToKill--;
} }
} }
private static void killServer(final String serverName, final String serverAddress, final boolean announce) private static void killServer(final String serverName, final String serverAddress, final String message, final boolean announce)
{ {
String cmd = "/home/mineplex/easyRemoteKillServer.sh"; String cmd = "/home/mineplex/easyRemoteKillServer.sh";
@ -291,7 +292,7 @@ public class ServerMonitor
if (error) if (error)
System.out.println("[" + serverName + ":" + serverAddress + "] Kill errored."); System.out.println("[" + serverName + ":" + serverAddress + "] Kill errored.");
else else
System.out.println("Sent kill command to " + serverAddress + " for " + serverName + " completed"); System.out.println(message);
} }
} }
}); });
@ -366,9 +367,9 @@ public class ServerMonitor
return bestServer; return bestServer;
} }
private static void killServer(final MinecraftServer serverToKill) private static void killServer(final MinecraftServer serverToKill, String message)
{ {
killServer(serverToKill.getName(), serverToKill.getPublicAddress(), true); killServer(serverToKill.getName(), serverToKill.getPublicAddress(), message, true);
} }
private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free) private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free)

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-pool2-2.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jedis-2.4.2.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mineplex.StaffServer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -0,0 +1,47 @@
package mineplex.staffServer;
import mineplex.core.account.CoreClientManager;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.donation.DonationManager;
import mineplex.core.memory.MemoryFix;
import mineplex.core.monitor.LagMeter;
import mineplex.core.playerTracker.PlayerTracker;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.updater.FileUpdater;
import org.bukkit.plugin.java.JavaPlugin;
public class StaffServer extends JavaPlugin
{
private String WEB_CONFIG = "webServer";
@Override
public void onEnable()
{
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
saveConfig();
String webServerAddress = getConfig().getString(WEB_CONFIG);
//Static Modules
CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
CommandCenter.Instance.setClientManager(clientManager);
DonationManager donationManager = new DonationManager(this, webServerAddress);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
preferenceManager.GiveItem = false;
Portal portal = new Portal(this, serverStatusManager.getCurrentServerName());
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal);
}
}

View File

@ -0,0 +1,61 @@
package mineplex.staffServer.customerSupport;
import java.util.HashSet;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor;
public class CustomerSupport extends MiniPlugin
{
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>();
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super("Customer Support", plugin);
_clientManager = clientManager;
_donationManager = donationManager;
}
@Override
public void AddCommands()
{
AddCommand(new checkCommand(this));
}
public void Help(Player caller)
{
caller.sendMessage(F.main(GetName(), "Usage : /check jRayx"));
}
public void addAgentMapping(Player caller, String playerName)
{
if (!_agentCacheMap.containsKey(caller))
_agentCacheMap.put(caller, new HashSet<String>());
_agentCacheMap.get(caller).add(playerName);
}
public void showPlayerInfo(Player caller, String playerName)
{
CoreClient client = _clientManager.Get(playerName);
Donor donor = _donationManager.Get(playerName);
caller.sendMessage(F.main(GetName(), "Name : " + F.elem(playerName)));
caller.sendMessage(F.main(GetName(), "Rank : " + F.elem(client.GetRank().Name)));
//for (donor.GetUnknownSalesPackagesOwned())
}
}

View File

@ -0,0 +1,46 @@
package mineplex.staffServer.customerSupport;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
public class checkCommand extends CommandBase<CustomerSupport>
{
public checkCommand(CustomerSupport plugin)
{
super(plugin, Rank.MODERATOR, "check");
}
@Override
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length != 1)
{
Plugin.Help(caller);
}
else
{
final String playerName = args[0];
CommandCenter.GetClientManager().checkPlayerName(caller, playerName, new Callback<Boolean>()
{
public void run(Boolean matched)
{
if (matched)
{
CommandCenter.GetClientManager().loadClientByName(playerName, new Runnable()
{
public void run()
{
Plugin.addAgentMapping(caller, playerName);
Plugin.showPlayerInfo(caller, playerName);
}
});
}
}
});
}
}
}

View File

@ -0,0 +1,51 @@
package mineplex.staffServer.password;
import java.util.HashSet;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F;
public class Password extends MiniPlugin
{
private HashSet<Player> _accepted = new HashSet<Player>();
public Password(JavaPlugin plugin)
{
super("Password", plugin);
}
@Override
public void AddCommands()
{
AddCommand(new PasswordCommand(this));
}
@EventHandler
public void promptForPassword(final PlayerJoinEvent event)
{
event.getPlayer().sendMessage(F.main(GetName(), "Please enter the server password within 5 seconds."));
GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
{
public void run()
{
if (!_accepted.contains(event.getPlayer()))
event.getPlayer().kickPlayer("You don't know the password little twerp.");
}
}, 100L);
}
public void checkPassword(Player caller, String attempt)
{
if (attempt.equals("ClothStarRust"))
{
_accepted.add(caller);
caller.sendMessage(F.main(GetName(), "I guess you get to stay."));
}
}
}

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 PasswordCommand extends CommandBase<Password>
{
public PasswordCommand(Password plugin)
{
super(plugin, Rank.MODERATOR, "password");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args.length == 1)
{
Plugin.checkPassword(caller, args[0]);
}
}
}

View File

@ -143,6 +143,10 @@ public abstract class Game implements Listener
public boolean WorldWeatherEnabled = false; public boolean WorldWeatherEnabled = false;
public int WorldWaterDamage = 0; public int WorldWaterDamage = 0;
public boolean WorldBoundaryKill = true; public boolean WorldBoundaryKill = true;
public boolean WorldBlockBurn = false;
public boolean WorldFireSpread = false;
public boolean WorldLeavesDecay = false;
public boolean WorldSoilTrample = false;
public int HungerSet = -1; public int HungerSet = -1;
public int HealthSet = -1; public int HealthSet = -1;

View File

@ -166,10 +166,13 @@ public class DragonEscape extends SoloGame
if (block.isLiquid()) if (block.isLiquid())
blockIterator.remove(); blockIterator.remove();
else if (block.getRelative(BlockFace.UP).isLiquid())
blockIterator.remove();
else if (WorldData.MapName.contains("Hell") && block.getY() < 30) else if (WorldData.MapName.contains("Hell") && block.getY() < 30)
blockIterator.remove(); blockIterator.remove();
else if (WorldData.MapName.contains("Pirate") && block.getY() < 4) else if (WorldData.MapName.contains("Pirate") && (block.getY() < 6))
blockIterator.remove(); blockIterator.remove();
} }

View File

@ -1315,18 +1315,6 @@ public class SurvivalGames extends SoloGame
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
} }
@EventHandler(priority = EventPriority.LOWEST)
public void CropTrample(PlayerInteractEvent event)
{
if (event.getAction() != Action.PHYSICAL)
return;
if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL)
return;
event.setCancelled(true);
}
@EventHandler @EventHandler
public void CompassUpdate(UpdateEvent event) public void CompassUpdate(UpdateEvent event)
{ {

View File

@ -34,6 +34,10 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
@ -870,6 +874,64 @@ public class GameFlagManager implements Listener
} }
} }
@EventHandler(priority = EventPriority.LOWEST)
public void WorldSoilTrample(PlayerInteractEvent event)
{
if (event.getAction() != Action.PHYSICAL)
return;
Game game = Manager.GetGame();
if (game == null) return;
if (game.WorldSoilTrample)
return;
if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL)
return;
event.setCancelled(true);
}
@EventHandler
public void WorldBlockBurn(BlockBurnEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (game.WorldBlockBurn)
return;
event.setCancelled(true);
}
@EventHandler
public void WorldFireSpread(BlockIgniteEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (event.getCause() != IgniteCause.SPREAD)
return;
if (game.WorldFireSpread)
return;
if (event.getBlock().getType() == Material.FIRE)
event.setCancelled(true);
}
@EventHandler
public void WorldLeavesDecay(BlockFromToEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (game.WorldLeavesDecay)
return;
event.setCancelled(true);
}
@EventHandler @EventHandler
public void SpectatorMessage(UpdateEvent event) public void SpectatorMessage(UpdateEvent event)
{ {

View File

@ -1017,7 +1017,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener
if (ent.GetKit().GetAvailability() == KitAvailability.Free || //Free if (ent.GetKit().GetAvailability() == KitAvailability.Free || //Free
donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + ent.GetKit().GetName()) || //Green donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + ent.GetKit().GetName()) || //Green
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Old - Single Game Ultra donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Old - Single Game Ultra
Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER)) //STAFF Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER) || //STAFF
Manager.GetServerConfig().Tournament) //Tournament
{ {
entityName = ent.GetKit().GetAvailability().GetColor() + entityName; entityName = ent.GetKit().GetAvailability().GetColor() + entityName;
} }

View File

@ -317,7 +317,8 @@ public class GamePlayerManager implements Listener
if (kit.GetAvailability() == KitAvailability.Free || //Free if (kit.GetAvailability() == KitAvailability.Free || //Free
donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName()) || //Green donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName()) || //Green
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //OLD - Single Game Ultras donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //OLD - Single Game Ultras
Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER)) //STAFF Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER) || //STAFF
Manager.GetServerConfig().Tournament) //Tournament
{ {
Manager.GetGame().SetKit(player, kit, true); Manager.GetGame().SetKit(player, kit, true);
} }

View File

@ -2,29 +2,24 @@ package nautilus.game.pvp;
import java.util.HashSet; import java.util.HashSet;
import me.chiss.Core.Class.ClassFactory;
import me.chiss.Core.Config.Config; import me.chiss.Core.Config.Config;
import me.chiss.Core.Field.Field; import me.chiss.Core.Field.Field;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Loot.LootFactory; import me.chiss.Core.Loot.LootFactory;
import me.chiss.Core.MemoryFix.MemoryFix;
import me.chiss.Core.Module.ModuleManager; import me.chiss.Core.Module.ModuleManager;
import me.chiss.Core.Modules.*; import me.chiss.Core.Modules.*;
import me.chiss.Core.NAC.NAC;
import me.chiss.Core.Plugin.IPlugin; import me.chiss.Core.Plugin.IPlugin;
import me.chiss.Core.Plugin.IRelation; import me.chiss.Core.Plugin.IRelation;
import me.chiss.Core.Scheduler.Scheduler; import me.chiss.Core.Scheduler.Scheduler;
import mineplex.core.message.Message; import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.TabLobbyList;
import mineplex.core.pet.PetFactory; import mineplex.core.pet.PetFactory;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.pet.PetShop;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.server.ServerListener; import mineplex.core.status.ServerStatusManager;
import mineplex.core.server.event.PlayerVoteEvent;
import mineplex.core.updater.Updater; import mineplex.core.updater.Updater;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
@ -42,7 +37,6 @@ import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;
import mineplex.minecraft.game.core.mechanics.Weapon; import mineplex.minecraft.game.core.mechanics.Weapon;
import mineplex.minecraft.punish.Punish;
import nautilus.game.pvp.modules.Farming; import nautilus.game.pvp.modules.Farming;
import nautilus.game.pvp.modules.Gameplay; import nautilus.game.pvp.modules.Gameplay;
import nautilus.game.pvp.modules.Recipes; import nautilus.game.pvp.modules.Recipes;
@ -78,10 +72,8 @@ public class PvP extends JavaPlugin implements IPlugin, Listener
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private Blood _blood; private Blood _blood;
private Clans _clans; private Clans _clans;
private ClassFactory _classFactory;
private ConditionManager _condition; private ConditionManager _condition;
private Creature _creature; private Creature _creature;
private DamageManager _damage;
private Energy _energy; private Energy _energy;
private Explosion _explosion; private Explosion _explosion;
private Field _field; private Field _field;
@ -103,28 +95,20 @@ public class PvP extends JavaPlugin implements IPlugin, Listener
//Repo //Repo
private PvPRepository _repository; private PvPRepository _repository;
private ServerListener _serverListener;
@Override @Override
public void onEnable() public void onEnable()
{ {
getConfig().addDefault(WEB_CONFIG, "http://www.nautmc.com/"); getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
saveConfig(); saveConfig();
//Repo CommandCenter.Initialize(this);
_repository = new PvPRepository(GetWebServerAddress()); CoreClientManager clientManager = new CoreClientManager(this, GetWebServerAddress());
CommandCenter.Instance.setClientManager(clientManager);
//Init Modules ItemStackFactory.Initialize(this, true);
GetModules();
_clientManager = CoreClientManager.Initialize(this, GetWebServerAddress()); new Punish(this, GetWebServerAddress(), clientManager);
CommandCenter.Initialize(this, _clientManager);
CombatManager.Initialize(this);
ItemStackFactory.Initialize(this);
new Punish(this, GetWebServerAddress());
GetBlood(); GetBlood();
GetClans(); GetClans();
GetClasses(); GetClasses();
@ -148,12 +132,9 @@ public class PvP extends JavaPlugin implements IPlugin, Listener
GetObserver(); GetObserver();
GetServer(); GetServer();
GetWeapon(); GetWeapon();
//GetWiki();
_petManager = new PetManager(this, GetWebServerAddress(), GetCreature(), GetClients());
//Unreferenced Modules //Unreferenced Modules
new AntiStack(); new AntiStack(null);
new Chat(this, _clientManager, GetClans()); new Chat(this, _clientManager, GetClans());
new EventManager(this); new EventManager(this);
new Farming(this); new Farming(this);
@ -165,7 +146,6 @@ public class PvP extends JavaPlugin implements IPlugin, Listener
new Information(this); new Information(this);
new PlayerInfo(this); new PlayerInfo(this);
new PointManager(this, Scheduler.Instance, _repository, 4000, 150, 80, 8, 80, 8, 300); new PointManager(this, Scheduler.Instance, _repository, 4000, 150, 80, 8, 80, 8, 300);
new PetShop(this, _repository, GetClients(), new PetFactory(_repository), GetPetManager());
new Quit(this); new Quit(this);
new Recipes(this); new Recipes(this);
new SoundTest(this); new SoundTest(this);
@ -182,11 +162,12 @@ public class PvP extends JavaPlugin implements IPlugin, Listener
//Activate Class Save //Activate Class Save
//GetClasses().GetRestore().Activate(); //GetClasses().GetRestore().Activate();
new Portal(this); ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
new Portal(this, serverStatusManager.getCurrentServerName());
//Shops //Shops
new ShopManager(this, _repository, new BenefitManager(this, GetWebServerAddress(), GetEnergy())); new ShopManager(this, _repository, new BenefitManager(this, GetWebServerAddress(), GetEnergy()));
new NpcManager(this); new NpcManager(this, _creature);
//Items //Items
HashSet<String> itemIgnore = new HashSet<String>(); HashSet<String> itemIgnore = new HashSet<String>();
@ -541,15 +522,6 @@ public class PvP extends JavaPlugin implements IPlugin, Listener
return _weapon; return _weapon;
} }
@Override
public Wiki GetWiki()
{
if (_wiki == null)
_wiki = new Wiki(this, _repository);
return _wiki;
}
@Override @Override
public Location GetSpawnLocation() public Location GetSpawnLocation()
{ {

View File

@ -7,6 +7,7 @@ import me.chiss.Core.Shop.PvpBuildShop;
import me.chiss.Core.Shop.PvpDonatorShop; import me.chiss.Core.Shop.PvpDonatorShop;
import me.chiss.Core.Shop.PvpItemShop; import me.chiss.Core.Shop.PvpItemShop;
import mineplex.core.CurrencyType; import mineplex.core.CurrencyType;
import mineplex.core.MiniPlugin;
import mineplex.core.server.RemoteRepository; import mineplex.core.server.RemoteRepository;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -20,7 +21,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class ShopManager extends AModule public class ShopManager extends MiniPlugin
{ {
private PvpDonatorShop _donatorShop; private PvpDonatorShop _donatorShop;
private PvpBuildShop _buildShop; private PvpBuildShop _buildShop;

View File

@ -2,11 +2,12 @@ package nautilus.game.pvp.worldevent;
import java.util.HashSet; import java.util.HashSet;
import mineplex.core.Rank; import mineplex.core.MiniPlugin;
import me.chiss.Core.Module.AModule; import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import nautilus.game.pvp.worldevent.command.EventCommand;
import nautilus.game.pvp.worldevent.events.BossSkeleton; import nautilus.game.pvp.worldevent.events.BossSkeleton;
import nautilus.game.pvp.worldevent.events.BossSlime; import nautilus.game.pvp.worldevent.events.BossSlime;
import nautilus.game.pvp.worldevent.events.BaseUndead; import nautilus.game.pvp.worldevent.events.BaseUndead;
@ -20,7 +21,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class EventManager extends AModule public class EventManager extends MiniPlugin
{ {
private HashSet<EventBase> _active = new HashSet<EventBase>(); private HashSet<EventBase> _active = new HashSet<EventBase>();
@ -40,61 +41,9 @@ public class EventManager extends AModule
} }
@Override @Override
public void enable() public void AddCommands()
{ {
AddCommand(new EventCommand(this));
}
@Override
public void disable()
{
for (EventBase cur : _active)
cur.TriggerStop();
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("ev");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
return;
if (args.length == 0)
{
caller.sendMessage("Missing Event Parameter.");
return;
}
EventBase event = null;
if (args[0].equals("dead")) event = new BaseUndead(this);
if (args[0].equals("dead4")) event = new BaseUndead(this, 4);
if (args[0].equals("slime")) event = new BossSlime(this);
if (args[0].equals("skel")) event = new BossSkeleton(this);
if (args[0].equals("swarm")) event = new BossSwarmer(this);
if (args[0].equals("wither")) event = new BossWither(this);
if (args[0].equals("brood")) event = new BossSpider(this);
if (args[0].equals("flood")) event = new EndFlood(this, caller.getLocation());
if (event != null)
{
event.TriggerStart();
_active.add(event);
UtilServer.getServer().getPluginManager().registerEvents(event, Plugin());
}
} }
@EventHandler @EventHandler
@ -138,7 +87,7 @@ public class EventManager extends AModule
_active.add(event); _active.add(event);
//Register Events //Register Events
UtilServer.getServer().getPluginManager().registerEvents(event, Plugin()); UtilServer.getServer().getPluginManager().registerEvents(event, GetPlugin());
_lastStart = System.currentTimeMillis(); _lastStart = System.currentTimeMillis();
} }
@ -152,4 +101,9 @@ public class EventManager extends AModule
_lastStop = System.currentTimeMillis(); _lastStop = System.currentTimeMillis();
} }
public void addEvent(EventBase event)
{
_active.add(event);
}
} }

View File

@ -0,0 +1,54 @@
package nautilus.game.pvp.worldevent.command;
import org.bukkit.entity.Player;
import nautilus.game.pvp.worldevent.EventBase;
import nautilus.game.pvp.worldevent.EventManager;
import nautilus.game.pvp.worldevent.events.BaseUndead;
import nautilus.game.pvp.worldevent.events.BossSkeleton;
import nautilus.game.pvp.worldevent.events.BossSlime;
import nautilus.game.pvp.worldevent.events.BossSpider;
import nautilus.game.pvp.worldevent.events.BossSwarmer;
import nautilus.game.pvp.worldevent.events.BossWither;
import nautilus.game.pvp.worldevent.events.EndFlood;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilServer;
public class EventCommand extends CommandBase<EventManager>
{
public EventCommand(EventManager plugin)
{
super(plugin, Rank.ADMIN, "ev", "event");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args.length == 0)
{
caller.sendMessage("Missing Event Parameter.");
return;
}
EventBase event = null;
if (args[0].equals("dead")) event = new BaseUndead(Plugin);
if (args[0].equals("dead4")) event = new BaseUndead(Plugin, 4);
if (args[0].equals("slime")) event = new BossSlime(Plugin);
if (args[0].equals("skel")) event = new BossSkeleton(Plugin);
if (args[0].equals("swarm")) event = new BossSwarmer(Plugin);
if (args[0].equals("wither")) event = new BossWither(Plugin);
if (args[0].equals("brood")) event = new BossSpider(Plugin);
if (args[0].equals("flood")) event = new EndFlood(Plugin, caller.getLocation());
if (event != null)
{
event.TriggerStart();
Plugin.addEvent(event);
UtilServer.getServer().getPluginManager().registerEvents(event, Plugin.GetPlugin());
}
}
}

View File

@ -3,7 +3,7 @@ package nautilus.game.pvp.worldevent.creature;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSkeleton;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Skeleton.SkeletonType;
@ -20,9 +20,9 @@ import mineplex.core.common.util.UtilTime;
import nautilus.game.pvp.worldevent.EventBase; import nautilus.game.pvp.worldevent.EventBase;
import nautilus.game.pvp.worldevent.EventMobBoss; import nautilus.game.pvp.worldevent.EventMobBoss;
import nautilus.game.pvp.worldevent.EventMobMinion; import nautilus.game.pvp.worldevent.EventMobMinion;
import net.minecraft.server.v1_6_R3.EntitySkeleton; import net.minecraft.server.v1_7_R4.EntitySkeleton;
import net.minecraft.server.v1_6_R3.Item; import net.minecraft.server.v1_7_R4.Item;
import net.minecraft.server.v1_6_R3.ItemStack; import net.minecraft.server.v1_7_R4.ItemStack;
public class SkeletonKing extends EventMobBoss public class SkeletonKing extends EventMobBoss
{ {
@ -50,7 +50,7 @@ public class SkeletonKing extends EventMobBoss
CraftSkeleton skelC = (CraftSkeleton)skel; CraftSkeleton skelC = (CraftSkeleton)skel;
EntitySkeleton skelMC = skelC.getHandle(); EntitySkeleton skelMC = skelC.getHandle();
skelMC.setEquipment(0, new ItemStack(Item.IRON_SWORD)); skelMC.setEquipment(0, new ItemStack(Item.getById(Material.IRON_SWORD.getId())));
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -3,8 +3,8 @@ package nautilus.game.pvp.worldevent.creature;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSkeleton;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -20,11 +20,11 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import nautilus.game.pvp.worldevent.EventBase; import nautilus.game.pvp.worldevent.EventBase;
import nautilus.game.pvp.worldevent.EventMobMinion; import nautilus.game.pvp.worldevent.EventMobMinion;
import net.minecraft.server.v1_6_R3.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_6_R3.EntitySkeleton; import net.minecraft.server.v1_7_R4.EntitySkeleton;
import net.minecraft.server.v1_6_R3.Item; import net.minecraft.server.v1_7_R4.Item;
import net.minecraft.server.v1_6_R3.ItemStack; import net.minecraft.server.v1_7_R4.ItemStack;
import net.minecraft.server.v1_6_R3.Navigation; import net.minecraft.server.v1_7_R4.Navigation;
public class SkeletonMinion extends EventMobMinion public class SkeletonMinion extends EventMobMinion
{ {
@ -33,7 +33,7 @@ public class SkeletonMinion extends EventMobMinion
super(event, location, "Skeleton Minion", true, 32, EntityType.SKELETON, host); super(event, location, "Skeleton Minion", true, 32, EntityType.SKELETON, host);
if (GetState() == 0) if (GetState() == 0)
SetWeapon(Item.IRON_SWORD); SetWeapon(Item.getById(Material.IRON_SWORD.getId()));
} }
@Override @Override
@ -48,7 +48,7 @@ public class SkeletonMinion extends EventMobMinion
CraftSkeleton skelC = (CraftSkeleton)skel; CraftSkeleton skelC = (CraftSkeleton)skel;
EntitySkeleton skelMC = skelC.getHandle(); EntitySkeleton skelMC = skelC.getHandle();
skelMC.setEquipment(0, new ItemStack(Item.BOW)); skelMC.setEquipment(0, new ItemStack(Item.getById(Material.BOW.getId())));
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -14,6 +14,7 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -457,7 +458,7 @@ public class BaseUndead extends EventBase
event.setCancelled(true); event.setCancelled(true);
if (!Manager.Recharge().use(event.getPlayer(), "Loot Chest", 60000, true)) if (!Recharge.Instance.use(event.getPlayer(), "Loot Chest", 60000, true, false))
return; return;
if (event.getClickedBlock().getType() == Material.ENDER_CHEST) LootChest(event.getClickedBlock()); if (event.getClickedBlock().getType() == Material.ENDER_CHEST) LootChest(event.getClickedBlock());

View File

@ -82,6 +82,7 @@
<Compile Include="Model\Server\PvpServer\Weapon.cs" /> <Compile Include="Model\Server\PvpServer\Weapon.cs" />
<Compile Include="Tokens\AccountBatchToken.cs" /> <Compile Include="Tokens\AccountBatchToken.cs" />
<Compile Include="Tokens\AccountNameToken.cs" /> <Compile Include="Tokens\AccountNameToken.cs" />
<Compile Include="Tokens\Client\AccountTransactionToken.cs" />
<Compile Include="Tokens\Client\RankUpdateToken.cs" /> <Compile Include="Tokens\Client\RankUpdateToken.cs" />
<Compile Include="Tokens\Client\DonationBenefitToken.cs" /> <Compile Include="Tokens\Client\DonationBenefitToken.cs" />
<Compile Include="Model\Server\PetExtra.cs" /> <Compile Include="Model\Server\PetExtra.cs" />

View File

@ -6,6 +6,8 @@
public Account.Account Account { get; set; } public Account.Account Account { get; set; }
public long Date { get; set; }
public string SalesPackageName { get; set; } public string SalesPackageName { get; set; }
public int Gems { get; set; } public int Gems { get; set; }

View File

@ -6,6 +6,8 @@
public Account.Account Account { get; set; } public Account.Account Account { get; set; }
public long Date { get; set; }
public string Source { get; set; } public string Source { get; set; }
public int Amount { get; set; } public int Amount { get; set; }

View File

@ -6,6 +6,8 @@
public Account.Account Account { get; set; } public Account.Account Account { get; set; }
public long? Date { get; set; }
public string Source { get; set; } public string Source { get; set; }
public int Amount { get; set; } public int Amount { get; set; }

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LOC.Core.Tokens.Client
{
public class AccountTransactionToken
{
public long Date { get; set; }
public string SalesPackageName { get; set; }
public int Gems { get; set; }
public int Coins { get; set; }
public AccountTransactionToken(Model.Sales.AccountTransaction transaction)
{
SalesPackageName = transaction.SalesPackageName;
Date = transaction.Date;
Gems = transaction.Gems;
Coins = transaction.Coins;
}
}
}

View File

@ -42,6 +42,7 @@
Donated = account.Donated, Donated = account.Donated,
SalesPackages = new List<int>(), SalesPackages = new List<int>(),
UnknownSalesPackages = new List<string>(), UnknownSalesPackages = new List<string>(),
Transactions = new List<AccountTransactionToken>(),
CustomBuilds = new List<CustomBuildToken>(), CustomBuilds = new List<CustomBuildToken>(),
Pets = new List<PetToken>(), Pets = new List<PetToken>(),
PetNameTagCount = account.PetNameTagCount PetNameTagCount = account.PetNameTagCount
@ -86,6 +87,7 @@
foreach (var transaction in account.AccountTransactions) foreach (var transaction in account.AccountTransactions)
{ {
DonorToken.UnknownSalesPackages.Add(transaction.SalesPackageName); DonorToken.UnknownSalesPackages.Add(transaction.SalesPackageName);
DonorToken.Transactions.Add(new AccountTransactionToken(transaction));
} }
if (account.CustomBuilds == null) if (account.CustomBuilds == null)

View File

@ -9,6 +9,7 @@
public bool Donated { get; set; } public bool Donated { get; set; }
public List<int> SalesPackages { get; set; } public List<int> SalesPackages { get; set; }
public List<string> UnknownSalesPackages { get; set; } public List<string> UnknownSalesPackages { get; set; }
public List<AccountTransactionToken> Transactions { get; set; }
public List<CustomBuildToken> CustomBuilds { get; set; } public List<CustomBuildToken> CustomBuilds { get; set; }
public List<PetToken> Pets { get; set; } public List<PetToken> Pets { get; set; }
public int PetNameTagCount { get; set; } public int PetNameTagCount { get; set; }

View File

@ -207,7 +207,8 @@
{ {
Source = token.Source, Source = token.Source,
Account = account, Account = account,
Amount = token.Amount Amount = token.Amount,
Date = (long)TimeUtil.GetCurrentMilliseconds()
}; };
repository.Add<GemTransaction>(gemTransaction); repository.Add<GemTransaction>(gemTransaction);
@ -238,7 +239,8 @@
{ {
Source = token.Source, Source = token.Source,
Account = account, Account = account,
Amount = token.Amount Amount = token.Amount,
Date = (long)TimeUtil.GetCurrentMilliseconds()
}; };
repository.Add<CoinTransaction>(coinTransaction); repository.Add<CoinTransaction>(coinTransaction);
@ -502,6 +504,7 @@
{ {
Account = account, Account = account,
SalesPackageName = token.SalesPackageName, SalesPackageName = token.SalesPackageName,
Date = (long)TimeUtil.GetCurrentMilliseconds(),
Gems = token.CoinPurchase ? 0 : token.Cost, Gems = token.CoinPurchase ? 0 : token.Cost,
Coins = token.CoinPurchase ? token.Cost : 0 Coins = token.CoinPurchase ? token.Cost : 0
}; };
@ -683,5 +686,20 @@
repository.Add(newMacAddress); repository.Add(newMacAddress);
repository.CommitChanges(); repository.CommitChanges();
} }
public Account GetAccountByUUID(string uuid)
{
using (var repository = _repositoryFactory.CreateRepository())
{
var account = repository.Where<Account>(x => x.Uuid == uuid).FirstOrDefault();
if (account == null)
return null;
account.LoadNavigationProperties(repository.Context);
return account;
}
}
} }
} }

View File

@ -38,5 +38,7 @@
void UpdateAccountUUIDs(List<AccountNameToken> tokens); void UpdateAccountUUIDs(List<AccountNameToken> tokens);
bool CoinReward(GemRewardToken token); bool CoinReward(GemRewardToken token);
Account GetAccountByUUID(string uuid);
} }
} }

View File

@ -39,6 +39,15 @@
return Content(json, "application/json"); return Content(json, "application/json");
} }
[HttpPost]
public ActionResult GetAccountByUUID(string uuid)
{
var account = _accountAdministrator.GetAccountByUUID(uuid);
var json = JsonConvert.SerializeObject(new ClientToken(account));
return Content(json, "application/json");
}
[HttpPost] [HttpPost]
public ActionResult GetDonor(string name) public ActionResult GetDonor(string name)
{ {

File diff suppressed because it is too large Load Diff

Binary file not shown.