Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
quantiom authored Jan 12, 2023
2 parents 0179590 + 8fa1311 commit 31cde5c
Show file tree
Hide file tree
Showing 25 changed files with 696 additions and 187 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
![license](https://img.shields.io/github/license/quantiom/EventHandler?color=%23b59e28&style=for-the-badge) ![made-with-kotlin](https://img.shields.io/badge/MADE%20WITH-KOTLIN-%23b59e28?style=for-the-badge&logo=java) ![last-commit](https://img.shields.io/github/last-commit/quantiom/AdvancedVanish?color=%23b59e28&style=for-the-badge)

AdvancedVanish is a fully customizable and advanced vanish plugin made with Kotlin.

Spigot Resource: https://www.spigotmc.org/resources/advancedvanish.86036/

GitBook: https://quantioms.gitbook.io/advancedvanish/

## Features
- Fully customizable through the [config](src/main/resources/config.yml). (70+ options)
- Messages
Expand All @@ -13,7 +16,7 @@ Spigot Resource: https://www.spigotmc.org/resources/advancedvanish.86036/
- Placeholders
- Much more...
- Vanished players are **completely** invisible, as if they are not even online.
- Vanish priorities/levels ([more info](https://github.com/quantiom/AdvancedVanish/blob/main/src/main/resources/config.yml#L93-L114))
- Vanish priorities/levels ([more info](https://quantioms.gitbook.io/advancedvanish/features#vanish-priorities))
- Supports many different permissions plugins. (LuckPerms, PermissionsEx, bPermissions, GroupManager)
- Many configurable hooks which provide support to other plugins.
- Essentials
Expand All @@ -30,14 +33,16 @@ Spigot Resource: https://www.spigotmc.org/resources/advancedvanish.86036/
- `/vanish status <player>` *- Check if a player is in vanish.*
- `/vanish set <player> <on/off>` *- Set another player's vanish.*
- `/vanish toggle <player>` *- Toggle another player's vanish.*
- For the rest of the features, check out the [config](src/main/resources/config.yml).
- `/vanish interact` *- Toggles interacting while in vanish*
- Cross Server Vanish Synchronization
- For the rest of the features, check out the [GitBook page](https://quantioms.gitbook.io/advancedvanish/).

## Hooks
In AdvancedVanish, there are many hooks which provide support to other plugins.
A full list of hooks with their descriptions can be found in the [config](src/main/resources/config.yml).
A full list of hooks with their descriptions can be found on the [GitBook page](https://quantioms.gitbook.io/advancedvanish/features#hooks).

## Vanish Priority
An explanation and guide of how to use vanish priorities can be found in the [config](src/main/resources/config.yml).
An explanation and guide of how to use vanish priorities can be found on the [GitBook page](https://quantioms.gitbook.io/advancedvanish/features#vanish-priorities).
*Note: Requires a supported permissions plugin to function*

## API
Expand All @@ -49,17 +54,18 @@ your plugin's `plugin.yml`.
Add this repository to your `pom.xml`:
```xml
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<id>repsy</id>
<name>quantiom</name>
<url>https://repo.repsy.io/mvn/quantiom/minecraft</url>
</repository>
```

Add the dependency and replace `<version>...</version>` with the current version:
```xml
<dependency>
<groupId>com.github.quantiom</groupId>
<artifactId>AdvancedVanish</artifactId>
<version>v1.1.8</version>
<groupId>me.quantiom</groupId>
<artifactId>advancedvanish</artifactId>
<version>1.2.4</version>
</dependency>
```

Expand Down
106 changes: 96 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,27 @@

<groupId>me.quantiom</groupId>
<artifactId>advancedvanish</artifactId>
<version>1.1.8</version>
<version>1.2.4</version>
<packaging>jar</packaging>

<name>AdvancedVanish</name>
<description>A fully customizable and advanced vanish plugin.</description>
<url>https://www.spigotmc.org/resources/advancedvanish.86036/</url>

<distributionManagement>
<repository>
<id>repsy</id>
<name>quantiom</name>
<url>https://repo.repsy.io/mvn/quantiom/minecraft</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>1.6.0</kotlin.version>
<kotlin.version>1.7.10</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
<junit.version>4.13.1</junit.version>
<config.version>8</config.version>
<config.version>10</config.version>
</properties>

<repositories>
Expand All @@ -34,7 +43,7 @@
</repository>
<repository>
<id>ess-repo</id>
<url>https://ci.ender.zone/plugin/repository/everything/</url>
<url>https://repo.essentialsx.net/releases/</url>
</repository>
<repository>
<id>paper-repo</id>
Expand All @@ -56,13 +65,22 @@
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>MikeRepo</id>
<url>https://repo.mikeprimm.com/</url>
</repository>
<repository>
<id>AlessioDP</id>
<url>https://repo.alessiodp.com/releases/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
Expand Down Expand Up @@ -96,9 +114,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.ess3</groupId>
<groupId>net.essentialsx</groupId>
<artifactId>EssentialsX</artifactId>
<version>2.17.2</version>
<version>2.19.7</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -138,9 +156,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.webbukkit</groupId>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>2.5</version>
<version>3.4-beta-3</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -161,6 +179,62 @@
<version>7.4</version>
<scope>provided</scope>
</dependency>

<!-- Adventure -->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId>
<version>4.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.11.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-core</artifactId>
<version>0.39.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-dao</artifactId>
<version>0.39.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-jdbc</artifactId>
<version>0.39.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.byteflux</groupId>
<artifactId>libby-bukkit</artifactId>
<version>1.1.5</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -253,15 +327,27 @@
<relocations>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>me.quantiom.advancedvanish.acf</shadedPattern>
<shadedPattern>me.quantiom.advancedvanish.shaded.acf</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>me.quantiom.advancedvanish.locales</shadedPattern>
</relocation>
<relocation>
<pattern>kotlin</pattern>
<shadedPattern>me.quantiom.kotlin</shadedPattern>
<shadedPattern>me.quantiom.advancedvanish.shaded.kotlin</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori.adventure</pattern>
<shadedPattern>me.quantiom.advancedvanish.shaded.adventure</shadedPattern>
</relocation>
<relocation>
<pattern>net.byteflux.libby</pattern>
<shadedPattern>me.quantiom.advancedvanish.shaded.libby</shadedPattern>
</relocation>
<relocation>
<pattern>org.jetbrains.exposed</pattern>
<shadedPattern>me.quantiom.advancedvanish.shaded.exposed</shadedPattern>
</relocation>
</relocations>
</configuration>
Expand Down
37 changes: 22 additions & 15 deletions src/main/kotlin/me/quantiom/advancedvanish/AdvancedVanish.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,30 @@ import me.quantiom.advancedvanish.hook.HooksManager
import me.quantiom.advancedvanish.listener.VanishListener
import me.quantiom.advancedvanish.permission.PermissionsManager
import me.quantiom.advancedvanish.state.VanishStateManager
import me.quantiom.advancedvanish.sync.ServerSyncManager
import me.quantiom.advancedvanish.util.AdvancedVanishAPI
import me.quantiom.advancedvanish.util.DependencyManager
import me.quantiom.advancedvanish.util.UpdateChecker
import net.kyori.adventure.platform.bukkit.BukkitAudiences
import org.bukkit.Bukkit
import org.bukkit.plugin.java.JavaPlugin
import java.util.logging.Level

class AdvancedVanish : JavaPlugin() {
companion object {
var instance: AdvancedVanish? = null
var commandManager: PaperCommandManager? = null
object AdvancedVanish {
var instance: AdvancedVanishPlugin? = null
var commandManager: PaperCommandManager? = null
var adventure: BukkitAudiences? = null

fun log(level: Level, msg: String) {
instance!!.logger.log(level, msg)
}
fun log(level: Level, msg: String) {
instance!!.logger.log(level, msg)
}

override fun onEnable() {
instance = this
fun onEnable(plugin: AdvancedVanishPlugin) {
instance = plugin

adventure = BukkitAudiences.create(plugin)

commandManager = PaperCommandManager(this).also {
commandManager = PaperCommandManager(plugin).also {
it.enableUnstableAPI("help")
it.registerCommand(VanishCommand, true)
}
Expand All @@ -36,20 +40,23 @@ class AdvancedVanish : JavaPlugin() {
// update checker
if (Config.getValueOrDefault("check-for-updates", true)) {
UpdateChecker.getVersion {
if (it != this.description.version) {
this.logger.info("A new update for AdvancedVanish (v${it}) is available:")
this.logger.info("https://www.spigotmc.org/resources/advancedvanish.86036/")
if (it != plugin.description.version) {
plugin.logger.info("A new update for AdvancedVanish (v${it}) is available:")
plugin.logger.info("https://www.spigotmc.org/resources/advancedvanish.86036/")
}
}
}

this.server.pluginManager.registerEvents(VanishListener, this)
plugin.server.pluginManager.registerEvents(ServerSyncManager, plugin)
plugin.server.pluginManager.registerEvents(VanishListener, plugin)

PermissionsManager.setupPermissionsHandler()
HooksManager.setupHooks()
}

override fun onDisable() {
fun onDisable() {
adventure?.close()
ServerSyncManager.close()
VanishStateManager.onDisable()
AdvancedVanishAPI.vanishedPlayers.map(Bukkit::getPlayer).forEach { AdvancedVanishAPI.unVanishPlayer(it!!) }
HooksManager.disableHooks()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package me.quantiom.advancedvanish;

import me.quantiom.advancedvanish.util.DependencyManager;
import org.bukkit.plugin.java.JavaPlugin;

/**
* This class is written in Java only because of the
* dependency management system. After Kotlin is loaded, the
* AdvancedVanish Kotlin class will take over.
*
* Basically, this class just acts as a "loader".
*/

public class AdvancedVanishPlugin extends JavaPlugin {
@Override
public void onEnable() {
// load dependencies
DependencyManager dependencyManager = new DependencyManager(this);
dependencyManager.loadDependencies();

AdvancedVanish.INSTANCE.onEnable(this);
}

@Override
public void onDisable() {
AdvancedVanish.INSTANCE.onDisable();
}
}
Loading

0 comments on commit 31cde5c

Please sign in to comment.