-
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.
Fixed: pSpigot hook and Carbon potion listeners
Signed-off-by: DevDrizzy <[email protected]>
- Loading branch information
Showing
5 changed files
with
70 additions
and
15 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
19 changes: 19 additions & 0 deletions
19
SpigotAPI-Main/src/main/java/xyz/refinedev/api/spigot/util/VersionUtil.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,19 @@ | ||
package xyz.refinedev.api.spigot.util; | ||
|
||
import org.bukkit.Bukkit; | ||
|
||
public class VersionUtil { | ||
public static final String VERSION = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; | ||
public static final int MINOR_VERSION; | ||
|
||
public VersionUtil() { | ||
} | ||
|
||
public static boolean canHex() { | ||
return MINOR_VERSION >= 16; | ||
} | ||
|
||
static { | ||
MINOR_VERSION = Integer.parseInt(VERSION.split("_")[1]); | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...ot/src/main/java/xyz/refinedev/api/spigot/knockback/impl/pspigot/pSpigotKnockbackFix.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,35 @@ | ||
package xyz.refinedev.api.spigot.knockback.impl.pspigot; | ||
|
||
import me.scalebound.pspigot.KnockbackProfile; | ||
import net.minecraft.server.v1_8_R3.EntityLiving; | ||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; | ||
import org.bukkit.entity.Player; | ||
import org.spigotmc.SpigotConfig; | ||
|
||
/** | ||
* <p> | ||
* This Project is property of Refine Development.<br> | ||
* Copyright © 2024, All Rights Reserved.<br> | ||
* Redistribution of this Project is not allowed.<br> | ||
* </p> | ||
* | ||
* @author Drizzy | ||
* @version SpigotAPI | ||
* @since 3/6/2024 | ||
*/ | ||
public class pSpigotKnockbackFix { | ||
|
||
public void setKnockback(Player player, String knockback) { | ||
KnockbackProfile craftKnockbackProfile = SpigotConfig.getKbProfileByName(knockback); | ||
if (craftKnockbackProfile == null) { | ||
craftKnockbackProfile = SpigotConfig.globalKbProfile; | ||
} | ||
|
||
CraftPlayer craftPlayer = (CraftPlayer) player; | ||
EntityLiving living = craftPlayer.getHandle(); | ||
if (player.isOnline()) { | ||
living.setKbProfile(craftKnockbackProfile); | ||
} | ||
} | ||
|
||
} |