Skip to content

Commit

Permalink
feat: Initial AbeoVanish support
Browse files Browse the repository at this point in the history
  • Loading branch information
ArikSquad committed Jan 31, 2025
1 parent c4a70ce commit a04ae27
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 31 deletions.
15 changes: 14 additions & 1 deletion paper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>

<!-- MikArt Repo-->
<repository>
<id>mikart-repository</id>
<url>https://maven.mikart.eu/snapshots</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -112,11 +118,18 @@
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>eu.mikart.abeovanish</groupId>
<artifactId>abeovanish-paper</artifactId>
<version>0.0.1</version>
<scope>provided</scope> <!-- i forgot this initially -->
</dependency>

<!-- CommandAPI - Mojang Mapped -->
<dependency>
<groupId>dev.jorel</groupId>
<artifactId>commandapi-bukkit-shade-mojang-mapped</artifactId>
<version>9.5.3</version>
<version>9.7.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
48 changes: 25 additions & 23 deletions paper/src/main/java/eu/mikart/animvanish/AnimVanishPaper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.jorel.commandapi.CommandAPI;
import dev.jorel.commandapi.CommandAPIBukkitConfig;
import eu.mikart.animvanish.effects.impl.TntEffect;
import eu.mikart.animvanish.hooks.impl.AbeoVanishHook;
import lombok.NoArgsConstructor;
import net.kyori.adventure.audience.Audience;
import org.bukkit.entity.Player;
Expand All @@ -13,28 +14,29 @@
@NoArgsConstructor
public class AnimVanishPaper extends AnimVanishBukkit {

@Override
public void onLoad() {
CommandAPI.onLoad(new CommandAPIBukkitConfig(this).shouldHookPaperReload(true).silentLogs(true));
}

@Override
@NotNull
public Audience getAudience(@NotNull UUID user) {
final Player player = getServer().getPlayer(user);
return player == null || !player.isOnline() ? Audience.empty() : player;
}

@Override
public void loadPlatform() {
CommandAPI.onEnable();
areCommandsInitialized = true;
getEffectManager().registerEffect(new TntEffect(this));
}

@Override
public void unloadPlatform() {
CommandAPI.onDisable();
}
@Override
public void onLoad() {
CommandAPI.onLoad(new CommandAPIBukkitConfig(this).shouldHookPaperReload(true).silentLogs(true));
}

@Override
@NotNull
public Audience getAudience(@NotNull UUID user) {
final Player player = getServer().getPlayer(user);
return player == null || !player.isOnline() ? Audience.empty() : player;
}

@Override
public void loadPlatform() {
CommandAPI.onEnable();
areCommandsInitialized = true;
getEffectManager().registerEffect(new TntEffect(this));
getHooks().add(new AbeoVanishHook());
}

@Override
public void unloadPlatform() {
CommandAPI.onDisable();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package eu.mikart.animvanish.hooks.impl;

import eu.mikart.abeovanish.api.BukkitAbeoVanishAPI;
import eu.mikart.animvanish.hooks.Hook;
import eu.mikart.animvanish.user.BukkitUser;
import eu.mikart.animvanish.user.OnlineUser;
import org.bukkit.entity.Player;

public class AbeoVanishHook extends Hook {

private final BukkitAbeoVanishAPI abeoVanishAPI;

public AbeoVanishHook() {
super("AbeoVanish");
this.abeoVanishAPI = BukkitAbeoVanishAPI.getInstance();
}

@Override
public void vanish(OnlineUser p) {
Player player = ((BukkitUser) p).getPlayer();
abeoVanishAPI.setVanished(player, !isVanished(p));
}

@Override
public boolean isVanished(OnlineUser p) {
Player player = ((BukkitUser) p).getPlayer();
return abeoVanishAPI.isVanished(player);
}
}
4 changes: 4 additions & 0 deletions paper/src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ dependencies:
load: BEFORE
required: false
join-classpath: true
AbeoVanish:
load: BEFORE
required: false
join-classpath: true
Citizens:
load: BEFORE
required: false
Expand Down
8 changes: 1 addition & 7 deletions spigot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>

<repository>
<id>maven_central</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -247,7 +241,7 @@
<dependency>
<groupId>com.github.stefvanschie.inventoryframework</groupId>
<artifactId>IF</artifactId>
<version>0.10.17</version>
<version>0.10.19</version>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions spigot/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ softdepend:
- PremiumVanish
- Citizens
- AdvancedVanish
- AbeoVanish

permissions:
animvanish.*:
Expand Down

0 comments on commit a04ae27

Please sign in to comment.