Addition of RequestExPledgeMissionReward spam protection.

This commit is contained in:
MobiusDevelopment 2020-09-17 22:53:19 +00:00
parent 96c3ededeb
commit f3c0a5905c
20 changed files with 524 additions and 2 deletions

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
@ -55,6 +58,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -62,6 +73,12 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
holder.requestReward(player);
}
}
player.sendPacket(new ExOneDayReceiveRewardList(player));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
@ -55,6 +58,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -62,6 +73,12 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
holder.requestReward(player);
}
}
player.sendPacket(new ExOneDayReceiveRewardList(player));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,14 +18,16 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
/**
* @author Sdw
@ -56,6 +58,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -63,7 +73,12 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
holder.requestReward(player);
}
}
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
@ -55,6 +58,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -62,6 +73,12 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
holder.requestReward(player);
}
}
player.sendPacket(new ExOneDayReceiveRewardList(player));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
@ -56,6 +59,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -66,5 +77,10 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
@ -56,6 +59,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -66,5 +77,10 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
@ -56,6 +59,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -66,5 +77,10 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
@ -56,6 +59,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -66,5 +77,10 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
@ -56,6 +59,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -66,5 +77,10 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
* @author Mobius
*/
public class RewardRequest extends AbstractRequest
{
public RewardRequest(PlayerInstance player)
{
super(player);
}
@Override
public boolean isUsing(int objectId)
{
return false;
}
}

View File

@ -18,10 +18,13 @@ package org.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.request.RewardRequest;
import org.l2jmobius.gameserver.network.Disconnection;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
@ -56,6 +59,14 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
return;
}
if (player.hasRequest(RewardRequest.class))
{
LOGGER.warning("Kicked " + player + " for spamming " + getClass().getSimpleName());
Disconnection.of(player).defaultSequence(true);
return;
}
player.addRequest(new RewardRequest(player));
for (DailyMissionDataHolder holder : rewards)
{
if (holder.isDisplayable(player))
@ -66,5 +77,10 @@ public class RequestOneDayRewardReceive implements IClientIncomingPacket
player.sendPacket(new ExConnectedTimeAndGettableReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player, true));
ThreadPool.schedule(() ->
{
player.removeRequest(RewardRequest.class);
}, 50);
}
}