Disable anticheat banning for movement hacks and revert modification of bonus awarding to fix duplicate bonuses being given

This commit is contained in:
AlexTheCoder 2018-01-01 01:47:06 -05:00 committed by Alexander Meech
parent 9b39636d18
commit 5e152e7f64
3 changed files with 60 additions and 63 deletions

View File

@ -123,11 +123,11 @@ public class AntiHack extends MiniPlugin
.put(KillauraTypeA.class, new ImmediateBanAction(150))
.put(KillauraTypeD.class, new BanwaveAction(1500))
.put(KillauraTypeF.class, new BanwaveAction(600))
.put(Glide.class, new ImmediateBanAction(7500))
.put(Speed.class, new ImmediateBanAction(7500))
// .put(Glide.class, new ImmediateBanAction(7500))
// .put(Speed.class, new ImmediateBanAction(7500))
.put(HeadRoll.class, new ImmediateBanAction(2000))
// .put(Toggle.class, new ImmediateBanAction(500))
.put(Timer.class, new ImmediateBanAction(10000))
// .put(Timer.class, new ImmediateBanAction(10000))
.put(BadPackets.class, new GEPBanAction(300))
.put(KillauraTypeB.class, new GEPBanAction(100))
.put(KillauraTypeC.class, new BanwaveAction(200))
@ -135,8 +135,8 @@ public class AntiHack extends MiniPlugin
.build();
public static final Map<Class<? extends Check>, AntiHackAction> STRICT_ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder()
.put(Glide.class, new ImmediateBanAction(2200))
.put(Speed.class, new ImmediateBanAction(2200))
// .put(Glide.class, new ImmediateBanAction(2200))
// .put(Speed.class, new ImmediateBanAction(2200))
.build();
private static final AntiHackAction NOOP_ACTION = new NoopAction();

View File

@ -64,6 +64,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.ClientItem;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.npc.Npc;
import mineplex.core.npc.NpcManager;
@ -548,16 +549,16 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (timeTillRankBonus(player) > 0)
result.run(false);
getRepository().attemptRankBonus(player, aBoolean ->
getRepository().attemptRankBonus(player, success ->
{
if (aBoolean)
if (success)
{
awardBonus(player, getRankBonusAmount(player));
updateCreeperVisual(player, true, C.cAqua);
UtilPlayer.message(player, F.main(_creeperName, "Come back next month for more!"));
}
result.run(aBoolean);
result.run(success);
});
}
@ -782,16 +783,20 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
data.setIlluminatedChests(2);
data.setMythicalChests(2);
data.setOmegaChests(1);
} else if (_clientManager.Get(player).hasPermission(Perm.TITAN_BONUS))
}
else if (_clientManager.Get(player).hasPermission(Perm.TITAN_BONUS))
{
data.setMythicalChests(5);
} else if (_clientManager.Get(player).hasPermission(Perm.LEGEND_BONUS))
}
else if (_clientManager.Get(player).hasPermission(Perm.LEGEND_BONUS))
{
data.setMythicalChests(3);
} else if (_clientManager.Get(player).hasPermission(Perm.HERO_BONUS))
}
else if (_clientManager.Get(player).hasPermission(Perm.HERO_BONUS))
{
data.setMythicalChests(2);
} else if (_clientManager.Get(player).hasPermission(Perm.ULTRA_BONUS))
}
else if (_clientManager.Get(player).hasPermission(Perm.ULTRA_BONUS))
{
data.setMythicalChests(1);
}
@ -838,31 +843,31 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (oldChests > 0)
{
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(oldChests + " Old Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests);
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OLD.getItemName()), oldChests));
}
if (ancientChests > 0)
{
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(ancientChests + " Ancient Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests);
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ANCIENT.getItemName()), ancientChests));
}
if (mythicalChests > 0)
{
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(mythicalChests + " Mythical Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests);
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.MYTHICAL.getItemName()), mythicalChests));
}
if (illuminatedChests > 0)
{
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(illuminatedChests + " Illuminated Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.ILLUMINATED.getItemName(), illuminatedChests);
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ILLUMINATED.getItemName()), illuminatedChests));
}
if (omegaChests > 0)
{
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(omegaChests + " Omega Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.OMEGA.getItemName(), omegaChests);
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OMEGA.getItemName()), omegaChests));
}
if (gems > 0)

View File

@ -21,6 +21,7 @@ import org.jooq.impl.DSL;
import mineplex.core.common.Pair;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge;
import mineplex.database.Tables;
@ -348,57 +349,48 @@ public class BonusRepository extends RepositoryBase
return;
}
final JavaPlugin plug = _manager.getPlugin();
Bukkit.getScheduler().runTaskAsynchronously(plug, new Runnable()
UtilServer.runAsync(() ->
{
@Override
public void run()
try (Connection connection = getConnection();
CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?, ?, ?)}");
)
{
try (Connection connection = getConnection();
CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?, ?, ?)}"))
callableStatement.setInt(1, accountId);
callableStatement.setInt(2, bonusAmount.getShards());
callableStatement.setInt(3, bonusAmount.getGems());
callableStatement.setInt(4, bonusAmount.getMythicalChests());
callableStatement.setInt(5, bonusAmount.getOmegaChests());
callableStatement.setInt(6, bonusAmount.getIlluminatedChests());
callableStatement.registerOutParameter(7, java.sql.Types.BOOLEAN);
callableStatement.registerOutParameter(8, java.sql.Types.DATE);
callableStatement.executeUpdate();
final boolean pass = callableStatement.getBoolean(7);
final Date date = callableStatement.getDate(8);
UtilServer.runSync(() ->
{
callableStatement.setInt(1, accountId);
callableStatement.setInt(2, bonusAmount.getShards());
callableStatement.setInt(3, bonusAmount.getGems());
callableStatement.setInt(4, bonusAmount.getMythicalChests());
callableStatement.setInt(5, bonusAmount.getOmegaChests());
callableStatement.setInt(6, bonusAmount.getIlluminatedChests());
callableStatement.registerOutParameter(7, java.sql.Types.BOOLEAN);
callableStatement.registerOutParameter(8, java.sql.Types.DATE);
_manager.Get(player).setRankTime(date);
callableStatement.executeUpdate();
final boolean pass = callableStatement.getBoolean(7);
final Date date = callableStatement.getDate(8);
Bukkit.getScheduler().runTask(plug, new Runnable()
if (pass)
{
@Override
public void run()
{
_manager.Get(player).setRankTime(date);
if (pass)
{
result.run(true);
}
else
{
Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 10, false, false);
result.run(false);
}
}
});
}
catch (Exception e)
{
Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 30, false, false);
e.printStackTrace();
System.out.println("Error : " + e.getMessage());
result.run(false);
}
result.run(true);
}
else
{
Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 10, false, false);
result.run(false);
}
});
}
catch (Exception e)
{
Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 30, false, false);
e.printStackTrace();
System.out.println("Error : " + e.getMessage());
result.run(false);
}
});
}