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(KillauraTypeA.class, new ImmediateBanAction(150))
.put(KillauraTypeD.class, new BanwaveAction(1500)) .put(KillauraTypeD.class, new BanwaveAction(1500))
.put(KillauraTypeF.class, new BanwaveAction(600)) .put(KillauraTypeF.class, new BanwaveAction(600))
.put(Glide.class, new ImmediateBanAction(7500)) // .put(Glide.class, new ImmediateBanAction(7500))
.put(Speed.class, new ImmediateBanAction(7500)) // .put(Speed.class, new ImmediateBanAction(7500))
.put(HeadRoll.class, new ImmediateBanAction(2000)) .put(HeadRoll.class, new ImmediateBanAction(2000))
// .put(Toggle.class, new ImmediateBanAction(500)) // .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(BadPackets.class, new GEPBanAction(300))
.put(KillauraTypeB.class, new GEPBanAction(100)) .put(KillauraTypeB.class, new GEPBanAction(100))
.put(KillauraTypeC.class, new BanwaveAction(200)) .put(KillauraTypeC.class, new BanwaveAction(200))
@ -135,8 +135,8 @@ public class AntiHack extends MiniPlugin
.build(); .build();
public static final Map<Class<? extends Check>, AntiHackAction> STRICT_ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder() public static final Map<Class<? extends Check>, AntiHackAction> STRICT_ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder()
.put(Glide.class, new ImmediateBanAction(2200)) // .put(Glide.class, new ImmediateBanAction(2200))
.put(Speed.class, new ImmediateBanAction(2200)) // .put(Speed.class, new ImmediateBanAction(2200))
.build(); .build();
private static final AntiHackAction NOOP_ACTION = new NoopAction(); 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.gadget.GadgetManager;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.ClientItem;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.npc.Npc; import mineplex.core.npc.Npc;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
@ -548,16 +549,16 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (timeTillRankBonus(player) > 0) if (timeTillRankBonus(player) > 0)
result.run(false); result.run(false);
getRepository().attemptRankBonus(player, aBoolean -> getRepository().attemptRankBonus(player, success ->
{ {
if (aBoolean) if (success)
{ {
awardBonus(player, getRankBonusAmount(player)); awardBonus(player, getRankBonusAmount(player));
updateCreeperVisual(player, true, C.cAqua); updateCreeperVisual(player, true, C.cAqua);
UtilPlayer.message(player, F.main(_creeperName, "Come back next month for more!")); 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.setIlluminatedChests(2);
data.setMythicalChests(2); data.setMythicalChests(2);
data.setOmegaChests(1); data.setOmegaChests(1);
} else if (_clientManager.Get(player).hasPermission(Perm.TITAN_BONUS)) }
else if (_clientManager.Get(player).hasPermission(Perm.TITAN_BONUS))
{ {
data.setMythicalChests(5); data.setMythicalChests(5);
} else if (_clientManager.Get(player).hasPermission(Perm.LEGEND_BONUS)) }
else if (_clientManager.Get(player).hasPermission(Perm.LEGEND_BONUS))
{ {
data.setMythicalChests(3); data.setMythicalChests(3);
} else if (_clientManager.Get(player).hasPermission(Perm.HERO_BONUS)) }
else if (_clientManager.Get(player).hasPermission(Perm.HERO_BONUS))
{ {
data.setMythicalChests(2); data.setMythicalChests(2);
} else if (_clientManager.Get(player).hasPermission(Perm.ULTRA_BONUS)) }
else if (_clientManager.Get(player).hasPermission(Perm.ULTRA_BONUS))
{ {
data.setMythicalChests(1); data.setMythicalChests(1);
} }
@ -838,31 +843,31 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (oldChests > 0) if (oldChests > 0)
{ {
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(oldChests + " Old Chests"))); 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) if (ancientChests > 0)
{ {
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(ancientChests + " Ancient Chests"))); 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) if (mythicalChests > 0)
{ {
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(mythicalChests + " Mythical Chests"))); 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) if (illuminatedChests > 0)
{ {
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(illuminatedChests + " Illuminated Chests"))); 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) if (omegaChests > 0)
{ {
UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(omegaChests + " Omega Chests"))); 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) if (gems > 0)

View File

@ -21,6 +21,7 @@ import org.jooq.impl.DSL;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.database.Tables; import mineplex.database.Tables;
@ -348,15 +349,11 @@ public class BonusRepository extends RepositoryBase
return; return;
} }
final JavaPlugin plug = _manager.getPlugin(); UtilServer.runAsync(() ->
Bukkit.getScheduler().runTaskAsynchronously(plug, new Runnable()
{
@Override
public void run()
{ {
try (Connection connection = getConnection(); try (Connection connection = getConnection();
CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?, ?, ?)}")) CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?, ?, ?)}");
)
{ {
callableStatement.setInt(1, accountId); callableStatement.setInt(1, accountId);
callableStatement.setInt(2, bonusAmount.getShards()); callableStatement.setInt(2, bonusAmount.getShards());
@ -373,10 +370,7 @@ public class BonusRepository extends RepositoryBase
final Date date = callableStatement.getDate(8); final Date date = callableStatement.getDate(8);
Bukkit.getScheduler().runTask(plug, new Runnable() UtilServer.runSync(() ->
{
@Override
public void run()
{ {
_manager.Get(player).setRankTime(date); _manager.Get(player).setRankTime(date);
@ -389,7 +383,6 @@ public class BonusRepository extends RepositoryBase
Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 10, false, false); Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 10, false, false);
result.run(false); result.run(false);
} }
}
}); });
} }
catch (Exception e) catch (Exception e)
@ -399,7 +392,6 @@ public class BonusRepository extends RepositoryBase
System.out.println("Error : " + e.getMessage()); System.out.println("Error : " + e.getMessage());
result.run(false); result.run(false);
} }
}
}); });
} }