Added sneaking to player disguise.
Did work on DDoSProtectionSwitcher Work on AccountAdministrator to fix rank issues.
This commit is contained in:
parent
c8bc697888
commit
8198bb31c8
@ -2,6 +2,7 @@ package mineplex.core.disguise;
|
|||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
private NautHashMap<String, DisguiseBase> _entityDisguiseMap = new NautHashMap<String, DisguiseBase>();
|
private NautHashMap<String, DisguiseBase> _entityDisguiseMap = new NautHashMap<String, DisguiseBase>();
|
||||||
private NautHashMap<String, EntityType> _addTempList = new NautHashMap<String, EntityType>();
|
private NautHashMap<String, EntityType> _addTempList = new NautHashMap<String, EntityType>();
|
||||||
private HashSet<String> _delTempList = new HashSet<String>();
|
private HashSet<String> _delTempList = new HashSet<String>();
|
||||||
|
private NautHashMap<DisguiseBase, HashSet<Player>> _disguisePlayerMap = new NautHashMap<DisguiseBase, HashSet<Player>>();
|
||||||
|
|
||||||
private Field _attributesA;
|
private Field _attributesA;
|
||||||
private Field _soundB;
|
private Field _soundB;
|
||||||
@ -105,12 +107,44 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
return _spawnPacketMap.get(entity.getEntityId());
|
return _spawnPacketMap.get(entity.getEntityId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disguise(DisguiseBase disguise)
|
public void addViewerToDisguise(DisguiseBase disguise, Player player)
|
||||||
|
{
|
||||||
|
_disguisePlayerMap.get(disguise).add(player);
|
||||||
|
|
||||||
|
reApplyDisguise(disguise, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeViewerToDisguise(DisguiseBase disguise, Player player)
|
||||||
|
{
|
||||||
|
_disguisePlayerMap.get(disguise).remove(player);
|
||||||
|
|
||||||
|
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||||
|
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(disguise.GetEntity().getId()));
|
||||||
|
|
||||||
|
if (disguise.GetEntity() instanceof EntityPlayer)
|
||||||
|
{
|
||||||
|
player.hidePlayer(Bukkit.getPlayer(disguise.GetEntity().getName()));
|
||||||
|
player.showPlayer(Bukkit.getPlayer(disguise.GetEntity().getName()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving((net.minecraft.server.v1_7_R4.EntityLiving)disguise.GetEntity()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disguise(DisguiseBase disguise, Player...players)
|
||||||
{
|
{
|
||||||
if (!disguise.GetEntity().isAlive())
|
if (!disguise.GetEntity().isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (players == null || players.length == 0)
|
||||||
|
{
|
||||||
|
players = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]);
|
||||||
|
}
|
||||||
|
|
||||||
_spawnPacketMap.put(disguise.GetEntityId(), disguise);
|
_spawnPacketMap.put(disguise.GetEntityId(), disguise);
|
||||||
|
_disguisePlayerMap.put(disguise, new HashSet<Player>());
|
||||||
|
_disguisePlayerMap.get(disguise).addAll(Arrays.asList(players));
|
||||||
|
|
||||||
reApplyDisguise(disguise);
|
reApplyDisguise(disguise);
|
||||||
}
|
}
|
||||||
@ -120,11 +154,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
if (!_spawnPacketMap.containsKey(entity.getEntityId()))
|
if (!_spawnPacketMap.containsKey(entity.getEntityId()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_spawnPacketMap.remove(entity.getEntityId());
|
DisguiseBase disguise = _spawnPacketMap.remove(entity.getEntityId());
|
||||||
_movePacketMap.remove(entity.getEntityId());
|
_movePacketMap.remove(entity.getEntityId());
|
||||||
_moveTempMap.remove(entity.getEntityId());
|
_moveTempMap.remove(entity.getEntityId());
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : _disguisePlayerMap.get(disguise))
|
||||||
{
|
{
|
||||||
if (entity == player)
|
if (entity == player)
|
||||||
continue;
|
continue;
|
||||||
@ -146,14 +180,16 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
|
|
||||||
public void reApplyDisguise(final DisguiseBase disguise)
|
public void reApplyDisguise(final DisguiseBase disguise)
|
||||||
{
|
{
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(disguise.GetEntityId());
|
||||||
|
|
||||||
|
for (Player player : _disguisePlayerMap.get(disguise))
|
||||||
{
|
{
|
||||||
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
|
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||||
|
|
||||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(disguise.GetEntityId()));
|
entityPlayer.playerConnection.sendPacket(destroyPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Packet> tempArmor = new ArrayList<Packet>();
|
List<Packet> tempArmor = new ArrayList<Packet>();
|
||||||
@ -173,7 +209,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : _disguisePlayerMap.get(disguise))
|
||||||
{
|
{
|
||||||
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
|
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
|
||||||
continue;
|
continue;
|
||||||
@ -189,10 +225,49 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reApplyDisguise(final DisguiseBase disguise, final Player player)
|
||||||
|
{
|
||||||
|
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(disguise.GetEntityId());
|
||||||
|
|
||||||
|
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
|
||||||
|
return;
|
||||||
|
|
||||||
|
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||||
|
|
||||||
|
entityPlayer.playerConnection.sendPacket(destroyPacket);
|
||||||
|
|
||||||
|
List<Packet> tempArmor = new ArrayList<Packet>();
|
||||||
|
|
||||||
|
if (disguise instanceof DisguiseInsentient && disguise.GetEntity() instanceof LivingEntity)
|
||||||
|
{
|
||||||
|
if (((DisguiseInsentient)disguise).armorVisible())
|
||||||
|
{
|
||||||
|
for (Packet armorPacket : ((DisguiseInsentient)disguise).getArmorPackets())
|
||||||
|
tempArmor.add(armorPacket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Packet> armorPackets = tempArmor;
|
||||||
|
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||||
|
entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket());
|
||||||
|
|
||||||
|
for (Packet packet : armorPackets)
|
||||||
|
{
|
||||||
|
entityPlayer.playerConnection.sendPacket(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void updateDisguise(DisguiseBase disguise)
|
public void updateDisguise(DisguiseBase disguise)
|
||||||
{
|
{
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : _disguisePlayerMap.get(disguise))
|
||||||
{
|
{
|
||||||
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
|
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
|
||||||
continue;
|
continue;
|
||||||
@ -265,6 +340,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
public void PlayerQuit(PlayerQuitEvent event)
|
public void PlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
undisguise(event.getPlayer());
|
undisguise(event.getPlayer());
|
||||||
|
|
||||||
|
for (DisguiseBase disguise : _disguisePlayerMap.keySet())
|
||||||
|
{
|
||||||
|
_disguisePlayerMap.get(disguise).remove(event.getPlayer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -274,7 +354,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
{
|
{
|
||||||
int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a;
|
int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a;
|
||||||
|
|
||||||
if (_spawnPacketMap.containsKey(entityId))
|
if (_spawnPacketMap.containsKey(entityId) && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))
|
||||||
{
|
{
|
||||||
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
||||||
return false;
|
return false;
|
||||||
@ -284,7 +364,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
{
|
{
|
||||||
int entityId = ((PacketPlayOutSpawnEntity)packet).a;
|
int entityId = ((PacketPlayOutSpawnEntity)packet).a;
|
||||||
|
|
||||||
if (_spawnPacketMap.containsKey(entityId))
|
if (_spawnPacketMap.containsKey(entityId) && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))
|
||||||
{
|
{
|
||||||
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
||||||
return false;
|
return false;
|
||||||
@ -307,7 +387,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
|
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))
|
||||||
{
|
{
|
||||||
// Crash clients with meta to a block id.
|
// Crash clients with meta to a block id.
|
||||||
if (_spawnPacketMap.get(entityId) instanceof DisguiseBlock)
|
if (_spawnPacketMap.get(entityId) instanceof DisguiseBlock)
|
||||||
@ -318,7 +398,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
{
|
{
|
||||||
int entityId = ((PacketPlayOutAnimation)packet).a;
|
int entityId = ((PacketPlayOutAnimation)packet).a;
|
||||||
|
|
||||||
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
|
if (containsSpawnDisguise(owner, entityId) && owner.getEntityId() != entityId)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -327,7 +407,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
{
|
{
|
||||||
int entityId = ((PacketPlayOutEntityMetadata)packet).a;
|
int entityId = ((PacketPlayOutEntityMetadata)packet).a;
|
||||||
|
|
||||||
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
|
if (containsSpawnDisguise(owner, entityId) && owner.getEntityId() != entityId)
|
||||||
{
|
{
|
||||||
packetList.forceProcess(_spawnPacketMap.get(entityId).GetMetaDataPacket());
|
packetList.forceProcess(_spawnPacketMap.get(entityId).GetMetaDataPacket());
|
||||||
return false;
|
return false;
|
||||||
@ -337,7 +417,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
{
|
{
|
||||||
int entityId = ((PacketPlayOutEntityEquipment)packet).a;
|
int entityId = ((PacketPlayOutEntityEquipment)packet).a;
|
||||||
|
|
||||||
if (_spawnPacketMap.containsKey(entityId) && _spawnPacketMap.get(entityId) instanceof DisguiseInsentient)
|
if (containsSpawnDisguise(owner, entityId) && _spawnPacketMap.get(entityId) instanceof DisguiseInsentient)
|
||||||
{
|
{
|
||||||
if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((PacketPlayOutEntityEquipment)packet).b != 0)
|
if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((PacketPlayOutEntityEquipment)packet).b != 0)
|
||||||
{
|
{
|
||||||
@ -378,7 +458,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
_movePacketMap.remove(movePacket.a);
|
_movePacketMap.remove(movePacket.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_spawnPacketMap.containsKey(movePacket.a))
|
if (!containsSpawnDisguise(owner, movePacket.a))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
|
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
|
||||||
@ -430,7 +510,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
_movePacketMap.remove(movePacket.a);
|
_movePacketMap.remove(movePacket.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_spawnPacketMap.containsKey(movePacket.a))
|
if (!containsSpawnDisguise(owner, movePacket.a))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
|
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
|
||||||
@ -491,6 +571,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean containsSpawnDisguise(Player owner, int entityId)
|
||||||
|
{
|
||||||
|
return _spawnPacketMap.containsKey(entityId) && (_disguisePlayerMap.containsKey(_spawnPacketMap.get(entityId)) && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner));
|
||||||
|
}
|
||||||
|
|
||||||
public void PrepAddDisguise(Player caller, EntityType entityType)
|
public void PrepAddDisguise(Player caller, EntityType entityType)
|
||||||
{
|
{
|
||||||
_addTempList.put(caller.getName(), entityType);
|
_addTempList.put(caller.getName(), entityType);
|
||||||
|
@ -8,6 +8,7 @@ import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|||||||
public class DisguisePlayer extends DisguiseHuman
|
public class DisguisePlayer extends DisguiseHuman
|
||||||
{
|
{
|
||||||
private GameProfile _profile;
|
private GameProfile _profile;
|
||||||
|
private boolean _sneaking;
|
||||||
|
|
||||||
public DisguisePlayer(org.bukkit.entity.Entity entity)
|
public DisguisePlayer(org.bukkit.entity.Entity entity)
|
||||||
{
|
{
|
||||||
@ -26,6 +27,24 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
_profile = profile;
|
_profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSneaking(boolean sneaking)
|
||||||
|
{
|
||||||
|
_sneaking = sneaking;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void UpdateDataWatcher()
|
||||||
|
{
|
||||||
|
super.UpdateDataWatcher();
|
||||||
|
|
||||||
|
byte b0 = DataWatcher.getByte(0);
|
||||||
|
|
||||||
|
if (_sneaking)
|
||||||
|
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 1)));
|
||||||
|
else
|
||||||
|
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 1))));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet GetSpawnPacket()
|
public Packet GetSpawnPacket()
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,6 @@ public class Donor
|
|||||||
_transactions = token.Transactions;
|
_transactions = token.Transactions;
|
||||||
_coinTransactions = token.CoinRewards;
|
_coinTransactions = token.CoinRewards;
|
||||||
|
|
||||||
|
|
||||||
if (_salesPackagesOwned == null)
|
if (_salesPackagesOwned == null)
|
||||||
{
|
{
|
||||||
_salesPackagesOwned = new ArrayList<Integer>();
|
_salesPackagesOwned = new ArrayList<Integer>();
|
||||||
@ -42,10 +41,15 @@ public class Donor
|
|||||||
_unknownSalesPackagesOwned = new ArrayList<String>();
|
_unknownSalesPackagesOwned = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_unknownSalesPackagesOwned == null)
|
if (_transactions == null)
|
||||||
{
|
{
|
||||||
_transactions = new ArrayList<TransactionToken>();
|
_transactions = new ArrayList<TransactionToken>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_coinTransactions == null)
|
||||||
|
{
|
||||||
|
_coinTransactions = new ArrayList<CoinTransactionToken>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetGems()
|
public int GetGems()
|
||||||
|
@ -47,8 +47,9 @@ public class DDoSProtectionSwitcher
|
|||||||
|
|
||||||
//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()));
|
||||||
|
|
||||||
DomainRecords records = new ApiGetCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728,
|
DomainRecords records = new ApiGetCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728,
|
||||||
@ -110,7 +111,7 @@ public class DDoSProtectionSwitcher
|
|||||||
+ idBuilder.toString()).Execute();
|
+ idBuilder.toString()).Execute();
|
||||||
System.out.println("Deleted " + recordsToDelete.size() + " records.");
|
System.out.println("Deleted " + recordsToDelete.size() + " records.");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// Switching US Bungees
|
// Switching US Bungees
|
||||||
switchServer("10.35.74.130", "108.178.20.166", "108.163.222.202", "108.178.20.165", "108.163.222.201");
|
switchServer("10.35.74.130", "108.178.20.166", "108.163.222.202", "108.178.20.165", "108.163.222.201");
|
||||||
switchServer("10.35.74.132", "108.163.217.110", "108.178.44.50", "108.163.217.109", "108.178.44.49");
|
switchServer("10.35.74.132", "108.163.217.110", "108.178.44.50", "108.163.217.109", "108.178.44.49");
|
||||||
@ -133,6 +134,7 @@ public class DDoSProtectionSwitcher
|
|||||||
switchServer("10.32.214.249", "107.6.158.78", "184.154.13.38", "107.6.158.77", "184.154.13.37");
|
switchServer("10.32.214.249", "107.6.158.78", "184.154.13.38", "107.6.158.77", "184.154.13.37");
|
||||||
switchServer("10.32.214.247", "184.154.13.118", "108.163.242.98", "184.154.13.117", "108.163.242.97");
|
switchServer("10.32.214.247", "184.154.13.118", "108.163.242.98", "184.154.13.117", "108.163.242.97");
|
||||||
|
|
||||||
|
/*
|
||||||
// Switching EU Bungees
|
// Switching EU Bungees
|
||||||
switchServer("10.82.2.202", "107.6.176.194", "107.6.176.34", "107.6.176.193", "107.6.176.33");
|
switchServer("10.82.2.202", "107.6.176.194", "107.6.176.34", "107.6.176.193", "107.6.176.33");
|
||||||
switchServer("10.82.2.204", "107.6.176.122", "107.6.176.50", "107.6.176.121", "107.6.176.49");
|
switchServer("10.82.2.204", "107.6.176.122", "107.6.176.50", "107.6.176.121", "107.6.176.49");
|
||||||
@ -142,9 +144,9 @@ public class DDoSProtectionSwitcher
|
|||||||
switchServer("10.82.2.227", "107.6.176.26", "107.6.176.46", "107.6.176.25", "107.6.176.45");
|
switchServer("10.82.2.227", "107.6.176.26", "107.6.176.46", "107.6.176.25", "107.6.176.45");
|
||||||
switchServer("10.82.2.228", "107.6.176.110", "107.6.176.70", "107.6.176.109", "107.6.176.69");
|
switchServer("10.82.2.228", "107.6.176.110", "107.6.176.70", "107.6.176.109", "107.6.176.69");
|
||||||
switchServer("10.82.2.226", "107.6.176.138", "107.6.176.234", "107.6.176.137", "107.6.176.233");
|
switchServer("10.82.2.226", "107.6.176.138", "107.6.176.234", "107.6.176.137", "107.6.176.233");
|
||||||
|
*/
|
||||||
sendMail();
|
//sendMail();
|
||||||
}
|
//}
|
||||||
|
|
||||||
int processWaits = 0;
|
int processWaits = 0;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${build_files}${BUILD_FILES}/common.xml"/>
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Nautilus.Core.CraftBukkit}"/>
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Nautilus.Core.CraftBukkit}"/>
|
||||||
|
@ -30,6 +30,7 @@ import mineplex.core.mount.MountManager;
|
|||||||
import mineplex.core.npc.NpcManager;
|
import mineplex.core.npc.NpcManager;
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
|
import mineplex.core.playerTracker.PlayerTracker;
|
||||||
import mineplex.core.portal.Portal;
|
import mineplex.core.portal.Portal;
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
@ -117,7 +118,8 @@ public class Arcade extends JavaPlugin
|
|||||||
|
|
||||||
//Arcade Manager
|
//Arcade Manager
|
||||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, projectileManager, webServerAddress);
|
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, projectileManager, webServerAddress);
|
||||||
|
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
|
||||||
|
|
||||||
new MemoryFix(this);
|
new MemoryFix(this);
|
||||||
|
|
||||||
//Updates
|
//Updates
|
||||||
|
@ -59,10 +59,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Data\ContextExtensions.cs" />
|
<Compile Include="Data\ContextExtensions.cs" />
|
||||||
<Compile Include="Data\IRepository.cs" />
|
|
||||||
<Compile Include="Data\IRepositoryFactory.cs" />
|
|
||||||
<Compile Include="Data\Repository.cs" />
|
|
||||||
<Compile Include="Data\RepositoryFactory.cs" />
|
|
||||||
<Compile Include="Model\Account\Account.cs" />
|
<Compile Include="Model\Account\Account.cs" />
|
||||||
<Compile Include="Model\Account\OwnedPet.cs" />
|
<Compile Include="Model\Account\OwnedPet.cs" />
|
||||||
<Compile Include="Model\Account\Punishment.cs" />
|
<Compile Include="Model\Account\Punishment.cs" />
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
using System.Data.Entity.Validation;
|
using System.Data.Entity.Validation;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
using LOC.Website.Common;
|
||||||
|
|
||||||
public class Repository<TContext> : IRepository
|
public class Repository<TContext> : IRepository
|
||||||
where TContext : DbContext
|
where TContext : DbContext
|
||||||
@ -56,12 +57,14 @@
|
|||||||
catch (DbEntityValidationException ex)
|
catch (DbEntityValidationException ex)
|
||||||
{
|
{
|
||||||
var l = (from err in ex.EntityValidationErrors from ve in err.ValidationErrors select ve.ErrorMessage).ToList();
|
var l = (from err in ex.EntityValidationErrors from ve in err.ValidationErrors select ve.ErrorMessage).ToList();
|
||||||
|
Log("ERROR", PREFIX + String.Join("; ", l));
|
||||||
throw new ApplicationException(PREFIX + String.Join("; ", l), ex); // contains the human-readable validation exception
|
throw new ApplicationException(PREFIX + String.Join("; ", l), ex); // contains the human-readable validation exception
|
||||||
}
|
}
|
||||||
catch (DbUpdateException e)
|
catch (DbUpdateException e)
|
||||||
{
|
{
|
||||||
if (e.InnerException != null && e.InnerException.InnerException != null && !String.IsNullOrEmpty(e.InnerException.InnerException.Message))
|
if (e.InnerException != null && e.InnerException.InnerException != null && !String.IsNullOrEmpty(e.InnerException.InnerException.Message))
|
||||||
{
|
{
|
||||||
|
Log("ERROR", PREFIX + String.Join("; ", e.InnerException.InnerException.Message));
|
||||||
throw new ApplicationException(PREFIX + String.Join("; ", e.InnerException.InnerException.Message), e); // contains the reason
|
throw new ApplicationException(PREFIX + String.Join("; ", e.InnerException.InnerException.Message), e); // contains the reason
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
@ -121,6 +124,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Log(string category, string message)
|
||||||
|
{
|
||||||
|
Add(new LogEntry
|
||||||
|
{
|
||||||
|
Date = DateTime.Now,
|
||||||
|
Category = category,
|
||||||
|
Message = message
|
||||||
|
});
|
||||||
|
CommitChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -68,6 +68,12 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Contexts\IRepository.cs" />
|
||||||
|
<Compile Include="Contexts\IRepositoryFactory.cs" />
|
||||||
|
<Compile Include="Contexts\Repository.cs" />
|
||||||
|
<Compile Include="Contexts\RepositoryFactory.cs" />
|
||||||
|
<Compile Include="ILogger.cs" />
|
||||||
|
<Compile Include="Logger.cs" />
|
||||||
<Compile Include="PingResult.cs" />
|
<Compile Include="PingResult.cs" />
|
||||||
<Compile Include="PunishmentResponse.cs" />
|
<Compile Include="PunishmentResponse.cs" />
|
||||||
<Compile Include="CaptureThePigStatsDisplay.cs" />
|
<Compile Include="CaptureThePigStatsDisplay.cs" />
|
||||||
@ -95,8 +101,6 @@
|
|||||||
<Compile Include="Models\ISalesPackageAdministrator.cs" />
|
<Compile Include="Models\ISalesPackageAdministrator.cs" />
|
||||||
<Compile Include="Models\IServerAdministrator.cs" />
|
<Compile Include="Models\IServerAdministrator.cs" />
|
||||||
<Compile Include="Models\IAccountAdministrator.cs" />
|
<Compile Include="Models\IAccountAdministrator.cs" />
|
||||||
<Compile Include="ILogger.cs" />
|
|
||||||
<Compile Include="Logger.cs" />
|
|
||||||
<Compile Include="Models\PetAdministrator.cs" />
|
<Compile Include="Models\PetAdministrator.cs" />
|
||||||
<Compile Include="Models\PvpAdministrator.cs" />
|
<Compile Include="Models\PvpAdministrator.cs" />
|
||||||
<Compile Include="Models\SalesPackageAdministrator.cs" />
|
<Compile Include="Models\SalesPackageAdministrator.cs" />
|
||||||
|
@ -92,12 +92,14 @@
|
|||||||
account.Name = loginToken.Name;
|
account.Name = loginToken.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Expire ranks
|
// Expire ranks
|
||||||
if ((account.Rank.Name == "ULTRA" || account.Rank.Name == "HERO") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0)
|
if ((account.Rank.Name == "ULTRA" || account.Rank.Name == "HERO") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0)
|
||||||
{
|
{
|
||||||
account.Rank = repository.Where<Rank>(x => x.Name == "ALL").First();
|
account.Rank = repository.Where<Rank>(x => x.Name == "ALL").First();
|
||||||
repository.Attach(account.Rank);
|
repository.Attach(account.Rank);
|
||||||
}
|
}
|
||||||
|
* */
|
||||||
|
|
||||||
repository.CommitChanges();
|
repository.CommitChanges();
|
||||||
|
|
||||||
@ -538,10 +540,12 @@
|
|||||||
|
|
||||||
public string UpdateRank(RankUpdateToken token)
|
public string UpdateRank(RankUpdateToken token)
|
||||||
{
|
{
|
||||||
|
Rank rank = null;
|
||||||
|
|
||||||
using (var repository = _repositoryFactory.CreateRepository())
|
using (var repository = _repositoryFactory.CreateRepository())
|
||||||
{
|
{
|
||||||
var account = repository.Where<Account>(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault();
|
var account = repository.Where<Account>(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault();
|
||||||
var rank = repository.Where<Rank>(x => String.Equals(x.Name, token.Rank)).FirstOrDefault();
|
rank = repository.Where<Rank>(x => String.Equals(x.Name, token.Rank)).FirstOrDefault();
|
||||||
|
|
||||||
if (account == null)
|
if (account == null)
|
||||||
return "ALL";
|
return "ALL";
|
||||||
@ -556,11 +560,10 @@
|
|||||||
account.RankExpire = DateTime.Now.AddMonths(1);
|
account.RankExpire = DateTime.Now.AddMonths(1);
|
||||||
account.RankPerm = token.Perm;
|
account.RankPerm = token.Perm;
|
||||||
|
|
||||||
if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm == true)
|
repository.Edit(account);
|
||||||
{
|
|
||||||
repository.Attach(account);
|
|
||||||
repository.Edit(account);
|
|
||||||
|
|
||||||
|
if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm)
|
||||||
|
{
|
||||||
addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0);
|
addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0);
|
||||||
addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0);
|
addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0);
|
||||||
addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0);
|
addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0);
|
||||||
@ -628,9 +631,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
repository.CommitChanges();
|
repository.CommitChanges();
|
||||||
|
|
||||||
return rank.Name.ToString();
|
_logger.Log("INFO", "TOKEN " + token.Name + "'s rank has been updated to " + token.Rank + " " + (token.Perm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using (var repository = _repositoryFactory.CreateRepository())
|
||||||
|
{
|
||||||
|
var account = repository.Where<Account>(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault();
|
||||||
|
_logger.Log("INFO", "ACCOUNT " + account.Name + "'s rank is " + account.Rank.Name + " " + (account.RankPerm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return rank.Name.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveBan(RemovePunishmentToken token)
|
public void RemoveBan(RemovePunishmentToken token)
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user