Skip to content

Commit

Permalink
fix: change feature data classes to normal classes (will fix reload a…
Browse files Browse the repository at this point in the history
…nd feature update commands)
  • Loading branch information
Syrent committed Feb 13, 2025
1 parent a8605a3 commit e81e308
Show file tree
Hide file tree
Showing 35 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ open class SayanVanishAPI<U: User>(val type: Class<out User>) {
private fun logDatabaseError() {
Platform.get().logger.severe("Database connection failed. Disabling the plugin.")
Platform.get().logger.severe("Please check the following:")
Platform.get().logger.severe("- Make sure you have `\"` before and after database ip address.")
Platform.get().logger.severe("- Make sure your database server is not misconfigured.")
Platform.get().logger.severe("- Make sure your database server is running.")
Platform.get().logger.severe("Here's the full error trace:")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import java.io.File
public var databaseConfig = DatabaseConfig.fromConfig() ?: DatabaseConfig.defaultConfig()

@ConfigSerializable
data class DatabaseConfig(
class DatabaseConfig(
@Comment("Configuration for the database, including method, SQL, Redis, and caching options.")
val method: DatabaseMethod = DatabaseMethod.SQL,
@Comment("Configuration for SQL database")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.spongepowered.configurate.objectmapping.ConfigSerializable
import org.spongepowered.configurate.objectmapping.meta.Comment

@ConfigSerializable
data class RedisConfig(
class RedisConfig(
@Comment("The type of Redis configuration. Available types: STANDALONE")
val type: RedisType = RedisType.STANDALONE,
@Comment("Configuration for standalone Redis setup")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment
import org.spongepowered.configurate.objectmapping.meta.Setting

@ConfigSerializable
data class SQLConfig(
class SQLConfig(
@Comment("The method to use for the database. Available methods: MYSQL, SQLITE")
val method: SQLMethod = SQLMethod.SQLITE,
@Comment("The host address of the SQL database. If it's an IP address (x.x.x.x), ensure it is enclosed in double quotes (`\"`).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class SayanVanishCommand : BukkitCommand(settings.command.name, *settings.comman
val sender = context.sender().platformSender()
language = LanguageConfig.fromConfig() ?: LanguageConfig.defaultConfig()
Features.features.forEach { feature ->
feature.save()
feature.disable(true)
if (feature::class.java.isAssignableFrom(Listener::class.java)) {
unregisterListener(feature as Listener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.io.File
public var language: LanguageConfig = LanguageConfig.fromConfig() ?: LanguageConfig.defaultConfig()

@ConfigSerializable
data class LanguageConfig(
class LanguageConfig(
val general: General = General(),
val vanish: Vanish = Vanish(),
val feature: Feature = Feature(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import java.util.*
public var settings: SettingsConfig = SettingsConfig.fromConfig() ?: SettingsConfig.defaultConfig()

@ConfigSerializable
data class SettingsConfig(
class SettingsConfig(
@Comment("""
Do NOT copy and paste the SayanVanish directory across multiple servers.
The server-id is generated during the plugin's first startup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureActionbar(
class FeatureActionbar(
@Comment("The content of the actionbar message.")
@Configurable val content: String = "<gray>You are currently vanished!",
@Comment("The delay before the actionbar message is sent. doesn't really matter.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ data class FeatureEffect(
}

@ConfigSerializable
data class PotionEffectData(
class PotionEffectData(
val usePacket: Boolean = true,
val keepAfterAppear: Boolean = false,
val type: String = PotionEffectType.NIGHT_VISION.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureFakeMessage(
class FeatureFakeMessage(
@Comment("Whether to send a fake join message when a player vanishes")
@Configurable val sendFakeJoinMessage: Boolean = false,
@Comment("The message to send when a player vanishes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureGameMode(
class FeatureGameMode(
@Comment("The fallback gamemode when the player is not vanished and doesn't have in-memory gamemode.")
val fallbackMode: GameMode = GameMode.SURVIVAL,
@Comment("Update gamemode history on gamemode change event.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import java.util.*

@RegisteredFeature
@ConfigSerializable
data class FeatureInventoryInspect(
class FeatureInventoryInspect(
@Configurable val modificationPermission: String = "${plugin.name}.features.inventory_inspect.modify"
): ListenedFeature("inventory_inspect") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureInvulnerability(
class FeatureInvulnerability(
@Comment("Disable invulnerability when player reappears.")
@Configurable val disableOnReappear: Boolean = true
) : ListenedFeature("invulnerability") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureLevel(
class FeatureLevel(
@Comment("""
This feature is a CRITICAL feature! do NOT disable this feature if you don't know what you're doing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureProxyVanishQueue(
class FeatureProxyVanishQueue(
@Comment("The time in milliseconds between each check for players in the queue. low values may cause performance issues.")
@Configurable val checkEvery: Long = 100
) : Feature("proxy_vanish_queue", category = FeatureCategories.PROXY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureState(
class FeatureState(
@Comment("""
This is a CRITICAL feature. It is responsible for handling the state of the player when they join or quit the server.
do NOT disable this feature if you don't know what you're doing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import java.util.concurrent.CompletableFuture

@RegisteredFeature
@ConfigSerializable
data class FeatureUpdate(
class FeatureUpdate(
@Comment("The interval to check for updates in minutes")
@Configurable val checkEveryXMinutes: Int = 60 * 24,
@Comment("The permission required to receive update notifications")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureHookCitizens(
class FeatureHookCitizens(
@Comment("Will cancel npc speech event if context of speech contains a vanished player")
val checkSpeech: Boolean = true,
): HookFeature("hook_citizens", "Citizens") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureHookDiscordSRV(
class FeatureHookDiscordSRV(
@Comment("Send quit message on vanish")
@Configurable val sendQuitMessageOnVanish: Boolean = true,
@Comment("Send join message on unvanish")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureHookEssentials(
class FeatureHookEssentials(
@Comment("Prevent Essentials from changing the AFK status of vanished players")
val preventAfkStatusChange: Boolean = true,
@Comment("Prevent players to send private messages to vanished players using Essentials")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureHookPlaceholderAPI(
class FeatureHookPlaceholderAPI(
@Comment("""
Inject placeholders into PlaceholderAPI
Available placeholders:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureHookTAB(
class FeatureHookTAB(
@Comment("Whether to use cache data for vanish status. This will improve performance but may cause a small delay in tablist removal after join.")
val useCacheData: Boolean = false
): HookFeature("hook_tab", "TAB") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.util.*

@RegisteredFeature
@ConfigSerializable
data class FeatureLuckPermsHook(
class FeatureLuckPermsHook(
@Comment("""
Whether to register custom context for vanished players.
This will allow you to check if a player is vanished using the context "vanished".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeaturePreventAdvancementAnnounce(
class FeaturePreventAdvancementAnnounce(
@Comment("Whether to disable the advancement announce message when the player is vanished.")
@Configurable val disableMessage: Boolean = true,
@Comment("Whether to revoke the criteria when the player is vanished.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeaturePreventChat(
class FeaturePreventChat(
@Comment("The character that vanished players can use to bypass the chat prevention.")
@Configurable val bypassChar: String = "!"
): ListenedFeature("prevent_chat", category = FeatureCategories.PREVENTION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeaturePreventInteract(
class FeaturePreventInteract(
@Comment("Prevent players from activating pressure plates while vanished")
@Configurable val pressurePlateTrigger: Boolean = true,
@Comment("Prevent players from interacting with big dripleaf while vanished")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeaturePreventTabComplete(
class FeaturePreventTabComplete(
@Comment("Whether to keep vanished player in tab completion if the player that is getting the suggestion has a higher level of vanish.")
@Configurable val checkVanishLevel: Boolean = false
): ListenedFeature("prevent_tab_complete", category = FeatureCategories.PREVENTION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit

@RegisteredFeature
@ConfigSerializable
data class FeatureSyncEvents(
class FeatureSyncEvents(
@Comment("The period of time to check for vanished players. low values may cause performance issues.")
val checkPeriodMillis: Long = 50
) : ListenedFeature("sync_events") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit

@RegisteredFeature
@ConfigSerializable
data class FeatureUpdate(
class FeatureUpdate(
@Comment("The period of time to check for updates.")
@Configurable val checkEveryXMinutes: Int = 60 * 24,
@Comment("The permission required to bypass update notifications.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeatureHookTAB(
class FeatureHookTAB(
@Comment("Whether to use cache data for vanish status. This will improve performance but may cause a small delay in tablist removal after join.")
val useCacheData: Boolean = false
): HookFeature("hook_tab", "TAB") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit

@RegisteredFeature
@ConfigSerializable
data class FeatureHookVelocitab(
class FeatureHookVelocitab(
@Comment("The delay in milliseconds to check on post server connect event. low values may cause issues.")
val checkOnPostServerConnectDelay: Long = 150,
@Comment("The delay in milliseconds to check on server switch. low values may cause issues.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import java.util.*

@RegisteredFeature
@ConfigSerializable
data class FeatureLuckPermsHook(
class FeatureLuckPermsHook(
@Comment("Register custom context for vanished players, this will allow you to check if a player is vanished using LuckPerms.")
@Configurable val registerCustomContext: Boolean = true,
@Comment("Check permission using LuckPerms, if false, will fallback to velocity permission check.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.spongepowered.configurate.objectmapping.meta.Comment

@RegisteredFeature
@ConfigSerializable
data class FeaturePreventTabComplete(
class FeaturePreventTabComplete(
@Comment("Whether to keep vanished player in tab completion if the player that is getting the suggestion has a higher level of vanish.")
@Configurable val checkVanishLevel: Boolean = false
): ListenedFeature("prevent_tab_complete", category = FeatureCategories.PREVENTION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.io.File
public var language: LanguageConfig = LanguageConfig.fromConfig() ?: LanguageConfig.defaultConfig()

@ConfigSerializable
data class LanguageConfig(
class LanguageConfig(
val general: General = General(),
val vanish: Vanish = Vanish(),
) : Config(languageDirectory, "${settings.general.language}.yml") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.util.UUID
public var settings: SettingsConfig = SettingsConfig.fromConfig() ?: SettingsConfig.defaultConfig()

@ConfigSerializable
data class SettingsConfig(
class SettingsConfig(
@Comment("""
Do NOT copy and paste the SayanVanish directory across multiple servers.
The server-id is generated during the plugin's first startup.
Expand Down

0 comments on commit e81e308

Please sign in to comment.