Fixed building issues with EnjinTranslator

MAde mysql repo always record rank change even if windows return rank is different.
Added rough single player replay functionality.
This commit is contained in:
Jonathan Williams 2014-10-17 00:41:23 -05:00
parent a6a4808222
commit 8466b8e2dd
8 changed files with 99 additions and 11 deletions

View File

@ -16,9 +16,17 @@
<include name="*.yml"/>
</fileset>
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
<zipfileset src="../Libraries/httpmime-4.2.jar" />
<zipfileset src="../Libraries/gson-2.2.1.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
<zipfileset src="../Libraries/commons-dbcp2-2.0.1.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" />
<zipfileset src="../Libraries/commons-pool2-2.2.jar" />
</jar>
<copy file="../bin/EnjinTranslator.jar" todir="../../Testing/EnjinTranslator/plugins"/>
</target>

View File

@ -35,6 +35,7 @@
<zipfileset src="../Libraries/gson-2.2.1.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
<zipfileset src="../Libraries/commons-dbcp2-2.0.1.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" />
<zipfileset src="../Libraries/commons-pool2-2.2.jar" />
</jar>
@ -74,6 +75,7 @@
<zipfileset src="../Libraries/gson-2.2.1.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/commons-io-2.4.jar" />
<zipfileset src="../Libraries/commons-dbcp2-2.0.1.jar" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" />

View File

@ -3,7 +3,6 @@ package mineplex.core;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import mineplex.core.common.DummyEntity;
import mineplex.core.common.util.NautHashMap;
@ -27,7 +26,6 @@ import net.minecraft.server.v1_7_R4.WatchableObject;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;

View File

@ -0,0 +1,79 @@
package mineplex.core;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Replay extends MiniPlugin implements IPacketHandler
{
private NautHashMap<PacketInfo, Long> _packetList = new NautHashMap<PacketInfo, Long>();
private long _startTime = 0;
private long _replayTime = 0;
private boolean _replay = false;
private long _speed = 20;
public Replay(JavaPlugin plugin, PacketHandler packetHandler)
{
super("Replay", plugin);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (event.getItem().getType() == Material.WEB)
{
event.getPlayer().setItemInHand(new ItemStack(Material.STICK, 1));
_replay = true;
_replayTime = System.currentTimeMillis();
}
}
@EventHandler
public void replay(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || !_replay)
return;
for (Iterator<Entry<PacketInfo, Long>> entryIterator = _packetList.entrySet().iterator(); entryIterator.hasNext();)
{
Entry<PacketInfo, Long> entry = entryIterator.next();
if ((System.currentTimeMillis() + _speed) - _replayTime > entry.getValue())
{
entry.getKey().getVerifier().bypassProcess(entry.getKey().getPacket());
entryIterator.remove();
}
}
}
@SuppressWarnings("unchecked")
public void handle(PacketInfo packetInfo)
{
if (_replay)
{
packetInfo.setCancelled(true);
return;
}
if (_startTime == 0)
_startTime = System.currentTimeMillis();
_packetList.put(packetInfo, System.currentTimeMillis() - _startTime);
// write out packets?
if (packetInfo.isCancelled())
return;
}
}

View File

@ -68,7 +68,7 @@ public class AccountRepository extends RepositoryBase
return new JsonWebCall(_webAddress + "PlayerAccount/GetAccountByUUID").ExecuteReturnStream(uuid.toString());
}
public void saveRank(final Callback<Rank> callback, final String name, Rank rank, final boolean perm)
public void saveRank(final Callback<Rank> callback, final String name, final Rank rank, final boolean perm)
{
final RankUpdateToken token = new RankUpdateToken();
token.Name = name;
@ -79,19 +79,19 @@ public class AccountRepository extends RepositoryBase
{
public void run(Rank response)
{
if (response == Rank.ULTRA || response == Rank.HERO)
if (rank == Rank.ULTRA || rank == Rank.HERO)
{
if (perm)
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, response.toString()), new ColumnVarChar("donorRank", 100, response.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
else
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR, new ColumnVarChar("rank", 100, response.toString()), new ColumnVarChar("donorRank", 100, response.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
}
else
{
if (perm)
executeUpdate(UPDATE_ACCOUNT_RANK_PERM, new ColumnVarChar("rank", 100, response.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
executeUpdate(UPDATE_ACCOUNT_RANK_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
else
executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, response.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString()));
}
callback.run(response);

View File

@ -10,5 +10,5 @@
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/EnjinTranslator.xml"/>
<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"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${${build_files}:/EnjinTranslator}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/EnjinTranslator}"/>
</launchConfiguration>

View File

@ -73,7 +73,6 @@ public class Enjin extends MiniPlugin implements CommandExecutor
String name = args[1];
int amount = Integer.parseInt(args[2]);
;
_donationManager.RewardGems(null, "purchase", name, UUIDFetcher.getUUIDOf(name), amount);
System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " gems.");
}

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.CustomTagFix;
import mineplex.core.Replay;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.antistack.AntiStack;
@ -108,6 +109,7 @@ public class Hub extends JavaPlugin implements IRelation
new MemoryFix(this);
new FileUpdater(this, portal);
new CustomTagFix(this, packetHandler);
//new Replay(this, packetHandler);
CombatManager combatManager = new CombatManager(this);
BlockRestore blockRestore = new BlockRestore(this);