-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from TheBusyBiscuit/feature/effects
Added default Potion Effect Types
- Loading branch information
Showing
6 changed files
with
151 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
src/main/java/be/seeseemelk/mockbukkit/entity/ZombieMock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/be/seeseemelk/mockbukkit/potion/MockPotionEffectType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package be.seeseemelk.mockbukkit.potion; | ||
|
||
import org.bukkit.Color; | ||
import org.bukkit.potion.PotionEffectType; | ||
|
||
/** | ||
* This {@link MockPotionEffectType} mocks an actual {@link PotionEffectType} by taking an id, a name, whether it is | ||
* instant and a RGB {@link Color} variable. | ||
* | ||
* @author TheBusyBiscuit | ||
* | ||
*/ | ||
public class MockPotionEffectType extends PotionEffectType | ||
{ | ||
|
||
private final String name; | ||
private final boolean instant; | ||
private final Color color; | ||
|
||
public MockPotionEffectType(int id, String name, boolean instant, Color color) | ||
{ | ||
super(id); | ||
|
||
this.name = name; | ||
this.instant = instant; | ||
this.color = color; | ||
} | ||
|
||
@Deprecated | ||
@Override | ||
public double getDurationModifier() | ||
{ | ||
// This is deprecated and always returns 1.0 | ||
return 1.0; | ||
} | ||
|
||
@Override | ||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
@Override | ||
public boolean isInstant() | ||
{ | ||
return instant; | ||
} | ||
|
||
@Override | ||
public Color getColor() | ||
{ | ||
return color; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) | ||
{ | ||
if (obj instanceof PotionEffectType) | ||
{ | ||
return getId() == ((PotionEffectType) obj).getId(); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return getId(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters