1
1
/**
2
2
* SkillAPI
3
3
* com.sucy.skill.api.event.SkillDamageEvent
4
- *
4
+ * <p>
5
5
* The MIT License (MIT)
6
- *
6
+ * <p>
7
7
* Copyright (c) 2014 Steven Sucy
8
- *
8
+ * <p>
9
9
* Permission is hereby granted, free of charge, to any person obtaining a copy
10
10
* of this software and associated documentation files (the "Software") to deal
11
11
* in the Software without restriction, including without limitation the rights
12
12
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
13
* copies of the Software, and to permit persons to whom the Software is
14
14
* furnished to do so, subject to the following conditions:
15
- *
15
+ * <p>
16
16
* The above copyright notice and this permission notice shall be included in
17
17
* all copies or substantial portions of the Software.
18
- *
18
+ * <p>
19
19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
20
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
21
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
27
package com .sucy .skill .api .event ;
28
28
29
29
import com .sucy .skill .api .skills .Skill ;
30
+ import lombok .Getter ;
31
+ import lombok .Setter ;
30
32
import org .bukkit .entity .LivingEntity ;
31
33
import org .bukkit .event .Cancellable ;
32
34
import org .bukkit .event .Event ;
36
38
* An event for when an entity is damaged by
37
39
* another entity with the use of a skill.
38
40
*/
39
- public class SkillDamageEvent extends Event implements Cancellable
40
- {
41
- private static final HandlerList handlers = new HandlerList ();
42
- private LivingEntity damager ;
43
- private LivingEntity target ;
44
- private String classification ;
45
- private Skill skill ;
46
- private double damage ;
47
- private boolean cancelled ;
48
-
41
+ public class SkillDamageEvent extends Event implements Cancellable {
42
+ private static final HandlerList handlers = new HandlerList ();
49
43
/**
50
- * Initializes a new event
44
+ * Retrieves the entity that dealt the damage
51
45
*
52
- * @param skill skill used to deal damage
53
- * @param damager entity dealing the damage
54
- * @param target entity receiving the damage
55
- * @param damage the amount of damage dealt
56
- * @param classification
46
+ * @return entity that dealt the damage
57
47
*/
58
- public SkillDamageEvent (Skill skill , LivingEntity damager , LivingEntity target , double damage , String classification )
59
- {
60
- this .skill = skill ;
61
- this .damager = damager ;
62
- this .target = target ;
63
- this .damage = damage ;
64
- this .classification = classification ;
65
- this .cancelled = false ;
66
- }
67
-
48
+ @ Getter private final LivingEntity damager ;
68
49
/**
69
- * @return skill used to deal the damage
50
+ * Retrieves the entity that received the damage
51
+ *
52
+ * @return entity that received the damage
70
53
*/
71
- public Skill getSkill () {
72
- return skill ;
73
- }
74
-
54
+ @ Getter private final LivingEntity target ;
55
+ @ Getter private final String classification ;
75
56
/**
76
- * Retrieves the entity that dealt the damage
77
- *
78
- * @return entity that dealt the damage
57
+ * @return skill used to deal the damage
79
58
*/
80
- public LivingEntity getDamager ()
81
- {
82
- return damager ;
83
- }
59
+ @ Getter private final Skill skill ;
60
+ private double damage ;
61
+ @ Getter
62
+ @ Setter
63
+ private boolean knockback ;
64
+ private boolean cancelled = false ;
84
65
85
66
/**
86
- * Retrieves the entity that received the damage
67
+ * Initializes a new event
87
68
*
88
- * @return entity that received the damage
69
+ * @param skill skill used to deal damage
70
+ * @param damager entity dealing the damage
71
+ * @param target entity receiving the damage
72
+ * @param damage the amount of damage dealt
73
+ * @param classification
89
74
*/
90
- public LivingEntity getTarget ()
91
- {
92
- return target ;
75
+ public SkillDamageEvent (Skill skill , LivingEntity damager , LivingEntity target , double damage ,
76
+ String classification , boolean knockback ) {
77
+ this .skill = skill ;
78
+ this .damager = damager ;
79
+ this .target = target ;
80
+ this .damage = damage ;
81
+ this .classification = classification ;
82
+ this .knockback = knockback ;
93
83
}
94
84
95
85
/**
96
86
* Retrieves the amount of damage dealt
97
87
*
98
88
* @return amount of damage dealt
99
89
*/
100
- public double getDamage ()
101
- {
90
+ public double getDamage () {
102
91
return damage ;
103
92
}
104
93
105
- public String getClassification () {
106
- return classification ;
107
- }
108
-
109
94
/**
110
95
* Sets the amount of damage dealt
111
96
*
112
97
* @param amount amount of damage dealt
113
98
*/
114
- public void setDamage (double amount )
115
- {
99
+ public void setDamage (double amount ) {
116
100
damage = amount ;
117
101
}
118
102
@@ -122,8 +106,7 @@ public void setDamage(double amount)
122
106
* @return true if cancelled, false otherwise
123
107
*/
124
108
@ Override
125
- public boolean isCancelled ()
126
- {
109
+ public boolean isCancelled () {
127
110
return cancelled ;
128
111
}
129
112
@@ -133,8 +116,7 @@ public boolean isCancelled()
133
116
* @param cancelled the cancelled state of the event
134
117
*/
135
118
@ Override
136
- public void setCancelled (boolean cancelled )
137
- {
119
+ public void setCancelled (boolean cancelled ) {
138
120
this .cancelled = cancelled ;
139
121
}
140
122
@@ -144,8 +126,7 @@ public void setCancelled(boolean cancelled)
144
126
* @return list of event handlers
145
127
*/
146
128
@ Override
147
- public HandlerList getHandlers ()
148
- {
129
+ public HandlerList getHandlers () {
149
130
return handlers ;
150
131
}
151
132
@@ -154,8 +135,7 @@ public HandlerList getHandlers()
154
135
*
155
136
* @return list of event handlers
156
137
*/
157
- public static HandlerList getHandlerList ()
158
- {
138
+ public static HandlerList getHandlerList () {
159
139
return handlers ;
160
140
}
161
141
}
0 commit comments