Skip to content

Commit

Permalink
Added: Carbon 5.0 support
Browse files Browse the repository at this point in the history
Signed-off-by: DevDrizzy <[email protected]>
  • Loading branch information
DevDrizzy committed Sep 13, 2024
1 parent 6d8c88a commit 9ad1437
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 4 deletions.
Binary file added Carbon/lib/CarbonAPI.jar
Binary file not shown.
50 changes: 50 additions & 0 deletions Carbon/pom.xml
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>
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);
}
}
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;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.refinedev.api.spigot.knockback.impl.carbon;
package xyz.refinedev.api.spigot.knockback.impl.carbonspigot;

import org.bukkit.entity.Player;
import xyz.refinedev.spigot.api.knockback.KnockbackAPI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.refinedev.api.spigot.knockback.impl.carbon;
package xyz.refinedev.api.spigot.knockback.impl.carbonspigot;

import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
Expand Down
5 changes: 5 additions & 0 deletions SpigotAPI-Main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
<artifactId>CarbonSpigot</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>xyz.refinedev.api</groupId>
<artifactId>Carbon</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>xyz.refinedev.api</groupId>
<artifactId>FoxSpigot</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import xyz.refinedev.api.spigot.knockback.IKnockbackType;
import xyz.refinedev.api.spigot.knockback.impl.atom.AtomSpigotKnockback;
import xyz.refinedev.api.spigot.knockback.impl.atom.AtomSpigotListener;
import xyz.refinedev.api.spigot.knockback.impl.carbon.CarbonSpigotKnockback;
import xyz.refinedev.api.spigot.knockback.impl.carbon.CarbonSpigotListener;
import xyz.refinedev.api.spigot.knockback.impl.carbon.CarbonKnockback;
import xyz.refinedev.api.spigot.knockback.impl.carbon.CarbonListener;
import xyz.refinedev.api.spigot.knockback.impl.carbonspigot.CarbonSpigotKnockback;
import xyz.refinedev.api.spigot.knockback.impl.carbonspigot.CarbonSpigotListener;
import xyz.refinedev.api.spigot.knockback.impl.fox.FoxSpigotKnockback;
import xyz.refinedev.api.spigot.knockback.impl.fox.FoxSpigotListener;
import xyz.refinedev.api.spigot.knockback.impl.ispigot.iSpigotKnockback;
Expand Down Expand Up @@ -39,6 +41,7 @@
public enum SpigotType {

CarbonSpigot("CarbonSpigot", "xyz.refinedev.spigot.api.knockback.KnockbackAPI", new CarbonSpigotKnockback(), new CarbonSpigotListener()),
Carbon("Carbon", "xyz.refinedev.spigot.features.combat.CombatAPI", new CarbonKnockback(), new CarbonListener()),
FoxSpigot("FoxSpigot", "pt.foxspigot.jar.knockback.KnockbackModule", new FoxSpigotKnockback(), new FoxSpigotListener()),
AtomSpigot("AtomSpigot", "xyz.yooniks.atomspigot.AtomSpigot", new AtomSpigotKnockback(), new AtomSpigotListener()),
iSpigot("ImanitySpigot", "org.imanity.imanityspigot.ImanitySpigot", new iSpigotKnockback(), new iSpigotListener()),
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<modules>
<module>SpigotAPI-API</module>
<module>CarbonSpigot</module>
<module>Carbon</module>
<module>ZortexSpigot</module>
<module>pSpigot</module>
<module>vSpigot</module>
Expand Down

0 comments on commit 9ad1437

Please sign in to comment.