-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: DevDrizzy <[email protected]>
- Loading branch information
Showing
9 changed files
with
165 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
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,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>xyz.refinedev.api</groupId> | ||
<artifactId>SpigotAPI</artifactId> | ||
<version>1.1</version> | ||
</parent> | ||
|
||
<artifactId>Carbon</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>xyz.refinedev.api</groupId> | ||
<artifactId>KnockbackAPI</artifactId> | ||
<version>Latest</version> | ||
<scope>system</scope> | ||
<systemPath>${basedir}/lib/CarbonAPI.jar</systemPath> | ||
</dependency> | ||
<dependency> | ||
<groupId>xyz.refinedev.api</groupId> | ||
<artifactId>SpigotAPI-API</artifactId> | ||
<version>1.1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<defaultGoal>package</defaultGoal> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
32 changes: 32 additions & 0 deletions
32
Carbon/src/main/java/xyz/refinedev/api/spigot/knockback/impl/carbon/CarbonKnockback.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,32 @@ | ||
package xyz.refinedev.api.spigot.knockback.impl.carbon; | ||
|
||
import org.bukkit.entity.Player; | ||
|
||
import xyz.refinedev.spigot.api.combat.ICombatProfile; | ||
import xyz.refinedev.api.spigot.knockback.IKnockbackType; | ||
import xyz.refinedev.spigot.features.combat.CombatAPI; | ||
|
||
/** | ||
* <p> | ||
* This Project is property of Refine Development.<br> | ||
* Copyright © 2023, All Rights Reserved.<br> | ||
* Redistribution of this Project is not allowed.<br> | ||
* </p> | ||
* | ||
* @author Drizzy | ||
* @since 4/30/2022 | ||
* @version SpigotAPI | ||
*/ | ||
|
||
public class CarbonKnockback implements IKnockbackType { | ||
|
||
@Override | ||
public void setKnockback(Player player, String knockback) { | ||
CombatAPI api = CombatAPI.getInstance(); | ||
ICombatProfile<?, ?, ?> profile = api.getProfile(knockback); | ||
if (profile == null) { | ||
profile = api.getDefaultProfile(player.getWorld()); | ||
} | ||
api.setPlayerProfile(player, profile); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
Carbon/src/main/java/xyz/refinedev/api/spigot/knockback/impl/carbon/CarbonListener.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,70 @@ | ||
package xyz.refinedev.api.spigot.knockback.impl.carbon; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.entity.PotionEffectAddEvent; | ||
import org.bukkit.event.entity.PotionEffectExpireEvent; | ||
import org.bukkit.event.entity.PotionEffectExtendEvent; | ||
import org.bukkit.event.entity.PotionEffectRemoveEvent; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
import xyz.refinedev.api.spigot.event.IListener; | ||
import xyz.refinedev.api.spigot.event.impl.RefinePotionAddEvent; | ||
import xyz.refinedev.api.spigot.event.impl.RefinePotionExpireEvent; | ||
import xyz.refinedev.api.spigot.event.impl.RefinePotionExtendEvent; | ||
import xyz.refinedev.api.spigot.event.impl.RefinePotionRemoveEvent; | ||
|
||
/** | ||
* <p> | ||
* This Project is property of Refine Development.<br> | ||
* Copyright © 2023, All Rights Reserved.<br> | ||
* Redistribution of this Project is not allowed.<br> | ||
* </p> | ||
* | ||
* @author Drizzy | ||
* @since 4/30/2022 | ||
* @version SpigotAPI | ||
*/ | ||
|
||
public class CarbonListener implements IListener, Listener { | ||
|
||
@EventHandler | ||
public void onExpire(PotionEffectExpireEvent event) { | ||
RefinePotionExpireEvent custom = new RefinePotionExpireEvent(event.getEntity(), event.getEffect()); | ||
Bukkit.getPluginManager().callEvent(custom); | ||
|
||
if (custom.isCancelled()) { | ||
event.setCancelled(true); | ||
} | ||
} | ||
|
||
@EventHandler | ||
public void onAdd(PotionEffectAddEvent event) { | ||
RefinePotionAddEvent.EffectAddReason reason = RefinePotionAddEvent.EffectAddReason.valueOf(event.getCause().name()); | ||
RefinePotionAddEvent custom = new RefinePotionAddEvent(event.getEntity(), event.getEffect(), reason); | ||
Bukkit.getPluginManager().callEvent(custom); | ||
} | ||
|
||
@EventHandler | ||
public void onExtend(PotionEffectExtendEvent event) { | ||
RefinePotionAddEvent.EffectAddReason reason = RefinePotionAddEvent.EffectAddReason.valueOf(event.getCause().name()); | ||
RefinePotionExtendEvent custom = new RefinePotionExtendEvent(event.getEntity(), event.getEffect(), reason, event.getOldEffect()); | ||
Bukkit.getPluginManager().callEvent(custom); | ||
} | ||
|
||
@EventHandler | ||
public void onRemove(PotionEffectRemoveEvent event) { | ||
RefinePotionRemoveEvent custom = new RefinePotionRemoveEvent(event.getEntity(), event.getEffect()); | ||
Bukkit.getPluginManager().callEvent(custom); | ||
} | ||
|
||
@Override | ||
public void register(JavaPlugin plugin) { | ||
plugin.getServer().getPluginManager().registerEvents(this, plugin); | ||
} | ||
|
||
@Override | ||
public boolean isApplicable() { | ||
return true; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ck/impl/carbon/CarbonSpigotKnockback.java → ...l/carbonspigot/CarbonSpigotKnockback.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
2 changes: 1 addition & 1 deletion
2
...ack/impl/carbon/CarbonSpigotListener.java → ...pl/carbonspigot/CarbonSpigotListener.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
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
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