View difference between Paste ID: ufQNSa2g and CeDVGmVp
SHOW: | | - or go back to the newest paste.
1
diff --git a/config/CustomMods/ProtectionMods.ini b/config/CustomMods/ProtectionMods.ini
2
index e0a8097..24f5fbd 100644
3
--- a/config/CustomMods/ProtectionMods.ini
4
+++ b/config/CustomMods/ProtectionMods.ini
5
@@ -75,3 +75,44 @@
6
 RemoveChest = True
7
 RemoveLeg = True
8
 
9
+#=============================================================
10
+#                   Disable Bow For Class
11
+#=============================================================
12
+# Enable or Disable Bow For Class
13
+# classId       className
14
+# 88            Duelist
15
+# 89            DreadNought
16
+# 90            Phoenix Knight
17
+# 91            Hell Knight
18
+# 92            Sagittarius
19
+# 93            Adventurer
20
+# 94            Archmage
21
+# 95            Soultaker
22
+# 96            Arcana Lord
23
+# 97            Cardinal
24
+# 98            Hierophant
25
+# 99            Eva Templar
26
+# 100           Sword Muse
27
+# 101           Wind Rider
28
+# 102           Moonlight Sentinel
29
+# 103           Mystic Muse
30
+# 104           Elemental Master
31
+# 105           Eva Saint
32
+# 106           Shillien Templar
33
+# 107           Spectral Dancer
34
+# 108           Ghost Hunter
35
+# 109           Ghost Sentinel
36
+# 110           Storm Screamer
37
+# 111           Spectral Master
38
+# 112           Shillen Saint
39
+# 113           Titan
40
+# 114           Grand Khauatari
41
+# 115           Dominator
42
+# 116           Doomcryer
43
+# 117           Fortune Seeker
44
+# 118           Maestro
45
+
46
+# e.g. DisableBowForClasses = 89, 90, 91, 92, 102, 109
47
+AltDisableBow = False
48
+DisableBowForClasses = 89
49
+
50
diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
51
index 99cc0ee..a47fa13 100644
52
--- a/java/net/sf/l2j/Config.java
53
+++ b/java/net/sf/l2j/Config.java
54
@@ -150,6 +150,9 @@
55
 	public static boolean PHX_ENCHANT_WAREHOUSE;
56
 	public static String WELCOME_MESSAGE_ENCHANT;
57
 	public static int WELCOME_MESSAGE_TIME_ENCHANT;
58
+	public static boolean ALT_DISABLE_BOW_CLASSES;
59
+	public static String DISABLE_BOW_CLASSES_STRING;
60
+	public static ArrayList<Integer> DISABLE_BOW_CLASSES = new ArrayList<>();
61
 	// --------------------------------------------------
62
 	// Events settings
63
 	// --------------------------------------------------
64
@@ -1135,6 +1138,14 @@
65
          REMOVE_WEAPON = Boolean.parseBoolean(Protection.getProperty("RemoveWeapon", "False"));
66
          REMOVE_CHEST = Boolean.parseBoolean(Protection.getProperty("RemoveChest", "False"));
67
          REMOVE_LEG = Boolean.parseBoolean(Protection.getProperty("RemoveLeg", "False"));
68
+         ALT_DISABLE_BOW_CLASSES = Boolean.parseBoolean(Protection.getProperty("AltDisableBow", "False"));
69
+         DISABLE_BOW_CLASSES_STRING = Protection.getProperty("DisableBowForClasses", "");
70
+         DISABLE_BOW_CLASSES = new ArrayList<>();
71
+         for (String class_id : DISABLE_BOW_CLASSES_STRING.split(","))
72
+         {
73
+         if(!class_id.equals(""))
74
+         DISABLE_BOW_CLASSES.add(Integer.parseInt(class_id));
75
+         }
76
 	}
77
 	
78
 	private static final void loadOff()
79
diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java b/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java
80
index df7dd43..4f68f25 100644
81
--- a/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java
82
+++ b/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java
83
@@ -14,7 +14,9 @@
84
 import net.sf.l2j.gameserver.model.holder.IntIntHolder;
85
 import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
86
 import net.sf.l2j.gameserver.model.item.kind.Item;
87
+import net.sf.l2j.gameserver.model.item.kind.Weapon;
88
 import net.sf.l2j.gameserver.network.SystemMessageId;
89
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
90
 import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
91
 import net.sf.l2j.gameserver.network.serverpackets.ItemList;
92
 import net.sf.l2j.gameserver.network.serverpackets.PetItemList;
93
@@ -69,6 +71,17 @@
94
 		
95
 		if (player.isAlikeDead() || player.isStunned() || player.isSleeping() || player.isParalyzed() || player.isAfraid())
96
 			return;
97
+		if (Config.ALT_DISABLE_BOW_CLASSES)
98
+		{
99
+			if(item.getItem() instanceof Weapon && ((Weapon)item.getItem()).getItemType() == WeaponType.BOW)
100
+			{
101
+				if(Config.DISABLE_BOW_CLASSES.contains(player.getClassId().getId())){
102
+					player.sendMessage("This item can not be equipped by your class");
103
+					player.sendPacket(ActionFailed.STATIC_PACKET);
104
+					return;
105
+				}
106
+			}
107
+		}
108
 		if (Config.ENABLE_ANTI_HEAVY && item.getItemType() == ArmorType.HEAVY) {
109
 			if (player.getClassId().getId() == 48 || player.getClassId().getId() == 114 || player.getClassId().getId() == 109
110
 				|| player.getClassId().getId() == 37 || player.getClassId().getId() == 108 || player.getClassId().getId() == 36
111