Skip to content

Commit

Permalink
rename plugin to BungeeSafeguard
Browse files Browse the repository at this point in the history
rename main command and permission nodes
update version code to 2.0
  • Loading branch information
Luluno01 committed Apr 8, 2020
1 parent 9a29799 commit 2460055
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 75 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions .idea/artifacts/BungeeGuard_main_jar.xml

This file was deleted.

62 changes: 42 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# BungeeGuard
# BungeeSafeguard

A blacklist and whitelist BungeeCord plugin with support of UUID look up.

This plugin is formerly named BungeeGuard. In order not to conflict with the existing plugin BungeeGuard, this plugin is renamed to BungeeSafeguard from v2.0.

Tested on Waterfall, version: `git:Waterfall-Bootstrap:1.15-SNAPSHOT:87d2873:326`.

- [BungeeGuard](#bungeeguard)
- [BungeeSafeguard](#bungeesafeguard)
- [Features](#features)
- [Usage](#usage)
- [Migrate to v2.0](#migrate-to-v2.0)
- [Configuration](#configuration)
- [Commands](#commands)
- [Whitelist](#whitelist)
Expand All @@ -24,9 +27,9 @@ Tested on Waterfall, version: `git:Waterfall-Bootstrap:1.15-SNAPSHOT:87d2873:326
- [blacklist on](#blacklist-on)
- [blacklist off](#blacklist-off)
- [Main Command](#main-command)
- [bungeeguard reload](#bungeeguard-reload)
- [bungeeguard status](#bungeeguard-status)
- [bungeeguard dump](#bungeeguard-dump)
- [bungeesafeguard reload](#bungeesafeguard-reload)
- [bungeesafeguard status](#bungeesafeguard-status)
- [bungeesafeguard dump](#bungeesafeguard-dump)
- [Lazy Lists](#lazy-lists)
- [Important Notes](#important-notes)

Expand All @@ -40,19 +43,38 @@ Tested on Waterfall, version: `git:Waterfall-Bootstrap:1.15-SNAPSHOT:87d2873:326

Download pre-compiled jar file from [release page](https://github.com/Luluno01/BungeeGuard/releases). Put downloaded jar file under `<path/to/BungeeCord/plugins>`.

## Migrate to v2.0

Breaking changes in v2.0:

* Plugin name (from BungeeGuard to BungeeSafeguard)
* Internal package name (from `vip.untitled.bungeesafeguard` to `vip.untitled.bungeesafeguard`)
* Internal class names
* Main command name (from `bungeesafeguard` to `bungeesafeguard`, from `bg` to `bsg`)
* Configuration directory (from `plugins/BungeeGuard` to `plugins/BungeeSafeguard`)

To migrate to v2.0 from lower versions, do the following:

1. Remove old plugin jar file
2. Install new plugin jar file
3. Rename old `plugins/BungeeGuard` directory to `plugins/BungeeSafeguard`
4. Update assigned permissions, change `bungeeguard` to `bungeesafeguard` in permission nodes

You are now good to go.

## Configuration

The configuration file for BungeeGuard is `plugins/BungeeGuard/config.yml`.
The configuration file for BungeeSafeguard is `plugins/BungeeSafeguard/config.yml`.

```yaml
#########################################
# BungeeGuard Configuration #
# Version: 1.2 #
# BungeeSafeguard Configuration #
# Version: 2.0 #
# Author: Untitled #
#########################################

# You can safely ignore this
version: "1.2"
version: "2.0"

# Message to be sent to player when that player is blocked for not being whitelisted
whitelist-message: :( You are not whitelisted on this server
Expand Down Expand Up @@ -257,30 +279,30 @@ blacklist off

### Main Command

Alias: `bg`.
Alias: `bsg`.

#### bungeeguard reload
#### bungeesafeguard reload

Reload configuration (from file `plugins/BungeeGuard/config.yml`):
Reload configuration (from file `plugins/BungeeSafeguard/config.yml`):

```
bungeeguard reload
bungeesafeguard reload
```

#### bungeeguard status
#### bungeesafeguard status

Check status of blacklist and whitelist:

```
bungeeguard status
bungeesafeguard status
```

#### bungeeguard dump
#### bungeesafeguard dump

Dump currently loaded blacklist and whitelist:

```
bungeeguard dump
bungeesafeguard dump
```

## Lazy Lists
Expand All @@ -293,7 +315,7 @@ In this way, offline servers should be able to use this plugin painlessly.

## Important Notes

BungeeGuard does asynchronous UUID look up when you execute add/remove on the lists.
It's recommended to execute those command only in console, and wait patiently for the completion feedback from the command before executing other commands of BungeeGuard.
BungeeSafeguard does asynchronous UUID look up when you execute add/remove on the lists.
It's recommended to execute those command only in console, and wait patiently for the completion feedback from the command before executing other commands of BungeeSafeguard.

Offline servers should be able to use this plugin by using lazy lists or supplying BungeeGuard with players' UUIDs rather than their usernames. However, offline servers will still suffering from UUID abuse if they have no authentication plugin installed or have no external authentication mechanism. Offline server owners need to fully understand whitelist and blacklist is **NOT** a prevention of UUID abuse.
Offline servers should be able to use this plugin by using lazy lists or supplying BungeeSafeguard with players' UUIDs rather than their usernames. However, offline servers will still suffering from UUID abuse if they have no authentication plugin installed or have no external authentication mechanism. Offline server owners need to fully understand whitelist and blacklist is **NOT** a prevention of UUID abuse.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'vip.untitled'
version '1.0-SNAPSHOT'
version '2.0-SNAPSHOT'

sourceCompatibility = 1.8

Expand Down
3 changes: 1 addition & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rootProject.name = 'BungeeGuard'

rootProject.name = 'BungeeSafeguard'
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package vip.untitled.bungeeguard
package vip.untitled.bungeesafeguard

import net.md_5.bungee.api.ChatColor
import vip.untitled.bungeeguard.commands.Blacklist
import vip.untitled.bungeeguard.commands.BungeeGuard
import vip.untitled.bungeeguard.commands.Whitelist
import vip.untitled.bungeesafeguard.commands.Blacklist
import vip.untitled.bungeesafeguard.commands.BungeeSafeguard
import vip.untitled.bungeesafeguard.commands.Whitelist


open class BungeeGuard: ConfigHolderPlugin() {
open class BungeeSafeguard: ConfigHolderPlugin() {
internal lateinit var events: Events
override fun onEnable() {
logger.info("${ChatColor.GREEN}BungeeGuard enabled")
logger.info("${ChatColor.GREEN}BungeeSafeguard enabled")
events = Events(this)
proxy.pluginManager.registerListener(this, events)

loadConfig()
proxy.pluginManager.registerCommand(this, Whitelist(this))
proxy.pluginManager.registerCommand(this, Blacklist(this))
proxy.pluginManager.registerCommand(this, BungeeGuard(this))
proxy.pluginManager.registerCommand(this, BungeeSafeguard(this))
}

override fun onDisable() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vip.untitled.bungeeguard
package vip.untitled.bungeesafeguard

import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.plugin.Plugin
Expand Down Expand Up @@ -98,7 +98,7 @@ open class Config(val context: Plugin) {
logger.info("${ChatColor.GREEN}Blacklist ${if (enableBlacklist) "ENABLED" else "${ChatColor.RED}DISABLED"}")
if (enableWhitelist == enableBlacklist) {
if (enableWhitelist) logger.warning("Both blacklist and whitelist are enabled, blacklist will have a higher priority should a player is in both list")
else logger.warning("Both blacklist and whitelist are disabled, BungeeGuard will not block any player")
else logger.warning("Both blacklist and whitelist are disabled, BungeeSafeguard will not block any player")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vip.untitled.bungeeguard
package vip.untitled.bungeesafeguard

import net.md_5.bungee.api.plugin.Plugin

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vip.untitled.bungeeguard
package vip.untitled.bungeesafeguard

import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.chat.TextComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package vip.untitled.bungeeguard.commands
package vip.untitled.bungeesafeguard.commands

import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.CommandSender
import net.md_5.bungee.api.chat.TextComponent
import vip.untitled.bungeeguard.ConfigHolderPlugin
import vip.untitled.bungeeguard.helpers.UserUUIDHelper
import vip.untitled.bungeesafeguard.ConfigHolderPlugin
import vip.untitled.bungeesafeguard.helpers.UserUUIDHelper
import java.util.*

open class Blacklist(context: ConfigHolderPlugin): ListCommand(context, "blacklist", "bungeeguard.blacklist", "blist") {
open class Blacklist(context: ConfigHolderPlugin): ListCommand(context, "blacklist", "bungeesafeguard.blacklist", "blist") {
override fun sendUsage(sender: CommandSender) {
sender.sendMessage(TextComponent("${ChatColor.YELLOW}Usage:"))
sender.sendMessage(TextComponent("${ChatColor.YELLOW} /blacklist <add/remove/rm> <player ...>"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package vip.untitled.bungeeguard.commands
package vip.untitled.bungeesafeguard.commands

import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.CommandSender
import net.md_5.bungee.api.chat.TextComponent
import net.md_5.bungee.api.plugin.Command
import vip.untitled.bungeeguard.ConfigHolderPlugin
import vip.untitled.bungeesafeguard.ConfigHolderPlugin

open class BungeeGuard(val context: ConfigHolderPlugin): Command("bungeeguard", "bungeeguard.main", "bg") {
open class BungeeSafeguard(val context: ConfigHolderPlugin): Command("bungeesafeguard", "bungeesafeguard.main", "bsg") {
open fun sendUsage(sender: CommandSender) {
sender.sendMessage(TextComponent("${ChatColor.YELLOW}Usage:"))
sender.sendMessage(TextComponent("${ChatColor.YELLOW} /bungeeguard reload"))
sender.sendMessage(TextComponent("${ChatColor.YELLOW} /bungeesafeguard reload"))
}
override fun execute(sender: CommandSender, args: Array<out String>) {
if (args.isEmpty()) {
Expand All @@ -21,7 +21,7 @@ open class BungeeGuard(val context: ConfigHolderPlugin): Command("bungeeguard",
"reload" -> context.proxy.scheduler.runAsync(context) {
try {
context.config.reload()
sender.sendMessage(TextComponent("${ChatColor.GREEN}BungeeGuard reloaded"))
sender.sendMessage(TextComponent("${ChatColor.GREEN}BungeeSafeguard reloaded"))
} catch (e: Throwable) {
sender.sendMessage(TextComponent("${ChatColor.RED}Failed to reload: $e"))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package vip.untitled.bungeeguard.commands
package vip.untitled.bungeesafeguard.commands

import net.md_5.bungee.api.CommandSender
import net.md_5.bungee.api.plugin.Command
import vip.untitled.bungeeguard.Config
import vip.untitled.bungeeguard.ConfigHolderPlugin
import vip.untitled.bungeeguard.helpers.ConcurrentTasksHelper
import vip.untitled.bungeesafeguard.Config
import vip.untitled.bungeesafeguard.ConfigHolderPlugin
import vip.untitled.bungeesafeguard.helpers.ConcurrentTasksHelper

abstract class ListCommand(val context: ConfigHolderPlugin, name: String, permission: String, vararg aliases: String): Command(name, permission, *aliases) {
companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package vip.untitled.bungeeguard.commands
package vip.untitled.bungeesafeguard.commands

import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.CommandSender
import net.md_5.bungee.api.chat.TextComponent
import vip.untitled.bungeeguard.ConfigHolderPlugin
import vip.untitled.bungeeguard.helpers.UserUUIDHelper
import vip.untitled.bungeesafeguard.ConfigHolderPlugin
import vip.untitled.bungeesafeguard.helpers.UserUUIDHelper
import java.util.*

open class Whitelist(context: ConfigHolderPlugin): ListCommand(context, "whitelist", "bungeeguard.whitelist", "wlist") {
open class Whitelist(context: ConfigHolderPlugin): ListCommand(context, "whitelist", "bungeesafeguard.whitelist", "wlist") {
override fun sendUsage(sender: CommandSender) {
sender.sendMessage(TextComponent("${ChatColor.YELLOW}Usage:"))
sender.sendMessage(TextComponent("${ChatColor.YELLOW} /whitelist <add/remove/rm> <player ...>"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vip.untitled.bungeeguard.helpers
package vip.untitled.bungeesafeguard.helpers

open class ConcurrentTasksHelper(val total: Int) {
private var _completion = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vip.untitled.bungeeguard.helpers
package vip.untitled.bungeesafeguard.helpers

import com.google.gson.JsonArray
import com.google.gson.JsonElement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vip.untitled.bungeeguard.helpers
package vip.untitled.bungeesafeguard.helpers

import net.md_5.bungee.api.plugin.Plugin
import java.io.IOException
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#########################################
# BungeeGuard Configuration #
# Version: 1.2 #
# BungeeSafeguard Configuration #
# Version: 2.0 #
# Author: Untitled #
#########################################

version: "1.1"
version: "2.0"
whitelist-message: :( You are not whitelisted on this server
blacklist-message: :( We can't let you enter this server
enable-whitelist: true
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: BungeeGuard
main: vip.untitled.bungeeguard.BungeeGuard
version: "1.2"
name: BungeeSafeguard
main: vip.untitled.bungeesafeguard.BungeeSafeguard
version: "2.0"
author: Untitled

0 comments on commit 2460055

Please sign in to comment.