Did some cleanup in Pvp project.

Did work in Coreclient manager and added StaffServer (still in progress)
This commit is contained in:
Jonathan Williams 2014-08-19 21:36:23 -04:00
parent 33a1699fce
commit 9ee25c6292
21 changed files with 410 additions and 116 deletions

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

@ -30,6 +30,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)
{ {

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

@ -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,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

@ -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;
@ -102,29 +94,21 @@ 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());
CommandCenter.Initialize(this, _clientManager);
CombatManager.Initialize(this); new Punish(this, GetWebServerAddress(), clientManager);
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>();
@ -38,65 +39,13 @@ public class EventManager extends AModule
_lastStart = System.currentTimeMillis(); _lastStart = System.currentTimeMillis();
_lastStop = System.currentTimeMillis(); _lastStop = System.currentTimeMillis();
} }
@Override
public void enable()
{
}
@Override @Override
public void disable() public void AddCommands()
{ {
for (EventBase cur : _active) AddCommand(new EventCommand(this));
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
public void StartEvent(UpdateEvent event) public void StartEvent(UpdateEvent event)
{ {
@ -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

@ -686,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)
{ {

Binary file not shown.