Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/CustomMods/ProtectionMods.ini b/config/CustomMods/ProtectionMods.ini
- index 3aa6aed..e3de7d8 100644
- --- a/config/CustomMods/ProtectionMods.ini
- +++ b/config/CustomMods/ProtectionMods.ini
- @@ -18,3 +18,15 @@
- # How long character were suppose to stay in jail? (in minutes)
- PunishmentTime = 1
- +#=============================================================
- +# Anti Enchant Warerouse
- +#=============================================================
- +#Enable Protection Anti Enchant Warehouse?
- +EnableProtectionEnchantWarehouse = True
- +
- +#Screen Message Enchant Forbidden use.
- +ScreenEnchantMessageText = Forbidden to Use Enchant near the bank!
- +
- +# Show screen Enchant message for x seconds when character.
- +ScreenEnchantMessageTime = 4
- +
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index 2fe4ba4..a88012b 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -139,6 +139,9 @@
- public static int VALIDATION_TIME;
- public static int PUNISHMENT;
- public static int PUNISHMENT_TIME;
- + public static boolean PHX_ENCHANT_WAREHOUSE;
- + public static String WELCOME_MESSAGE_ENCHANT;
- + public static int WELCOME_MESSAGE_TIME_ENCHANT;
- // --------------------------------------------------
- // Events settings
- // --------------------------------------------------
- @@ -1106,6 +1109,9 @@
- VALIDATION_TIME = Integer.parseInt(Protection.getProperty("ValidationTime", "60"));
- PUNISHMENT = Integer.parseInt(Protection.getProperty("Punishment", "0"));
- PUNISHMENT_TIME = Integer.parseInt(Protection.getProperty("PunishmentTime", "60"));
- + PHX_ENCHANT_WAREHOUSE = Boolean.parseBoolean(Protection.getProperty("EnableProtectionEnchantWarehouse", "false"));
- + WELCOME_MESSAGE_ENCHANT = Protection.getProperty("ScreenEnchantMessageText", "Forbidden to Use Enchant near the bank!");
- + WELCOME_MESSAGE_TIME_ENCHANT = Integer.parseInt(Protection.getProperty("ScreenEnchantMessageTime", "6")) * 1000;
- }
- private static final void loadOff()
- diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java b/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java
- index 50bda20..e114856 100644
- --- a/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java
- +++ b/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java
- @@ -1,13 +1,19 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import java.util.List;
- +
- import net.sf.l2j.commons.random.Rnd;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.SkillTable;
- import net.sf.l2j.gameserver.data.xml.ArmorSetData;
- import net.sf.l2j.gameserver.enums.Paperdoll;
- import net.sf.l2j.gameserver.enums.StatusType;
- import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.WorldObject;
- +import net.sf.l2j.gameserver.model.actor.Creature;
- import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.instance.WarehouseKeeper;
- import net.sf.l2j.gameserver.model.item.ArmorSet;
- import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- import net.sf.l2j.gameserver.model.item.kind.Armor;
- @@ -15,6 +21,7 @@
- import net.sf.l2j.gameserver.model.item.kind.Weapon;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.EnchantResult;
- +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
- import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
- import net.sf.l2j.gameserver.network.serverpackets.ItemList;
- import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
- @@ -31,13 +38,23 @@
- _objectId = readD();
- }
- + @SuppressWarnings("null")
- @Override
- protected void runImpl()
- {
- final Player player = getClient().getPlayer();
- + List<Creature> knowns = player.getKnownTypeInRadius(Creature.class, 400);
- if (player == null || _objectId == 0)
- return;
- -
- + if (Config.PHX_ENCHANT_WAREHOUSE)
- + for (WorldObject wh : knowns)
- + {
- + if (wh instanceof WarehouseKeeper)
- + {
- + player.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_ENCHANT, Config.WELCOME_MESSAGE_TIME_ENCHANT));
- + return;
- + }
- + }
- if (!player.isOnline() || getClient().isDetached())
- {
- player.setActiveEnchantItem(null);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement