-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
<h1 align="center">ExampleProject</h1> | ||
<h1 align="center">ObfusPlayer</h1> | ||
<p align="center">One sentence to describe your plugin.<br><br> | ||
<a href="https://mozilla.org/MPL/2.0"><img src="https://img.shields.io/badge/license-MPL%202.0-brightgreen?style=flat-square"></a> <a href="https://github.com/katorlys/ExampleProject/releases/latest"><img src="https://img.shields.io/github/v/release/katorlys/ExampleProject?include_prereleases&style=flat-square"></a> <a href="https://github.com/katorlys/ExampleProject/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/katorlys/ExampleProject/build.yml?style=flat-square"></a> <a href="https://github.com/katorlys/ExampleProject/pulls"><img src="https://img.shields.io/github/issues-pr-closed/katorlys/ExampleProject?style=flat-square"></a> <a href="https://github.com/katorlys/ExampleProject/issues"><img src="https://img.shields.io/github/issues-closed/katorlys/ExampleProject?style=flat-square"></a> <a href="https://github.com/katorlys/ExampleProject"><img src="https://img.shields.io/tokei/lines/github/katorlys/ExampleProject?style=flat-square"></a></p> | ||
<a href="https://mozilla.org/MPL/2.0"><img src="https://img.shields.io/badge/license-MPL%202.0-brightgreen?style=flat-square"></a> <a href="https://github.com/katorlys/ObfusPlayer/releases/latest"><img src="https://img.shields.io/github/v/release/katorlys/ObfusPlayer?include_prereleases&style=flat-square"></a> <a href="https://github.com/katorlys/ObfusPlayer/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/katorlys/ObfusPlayer/build.yml?style=flat-square"></a> <a href="https://github.com/katorlys/ObfusPlayer/pulls"><img src="https://img.shields.io/github/issues-pr-closed/katorlys/ObfusPlayer?style=flat-square"></a> <a href="https://github.com/katorlys/ObfusPlayer/issues"><img src="https://img.shields.io/github/issues-closed/katorlys/ObfusPlayer?style=flat-square"></a></p> | ||
|
||
## Introduction | ||
Describe your plugin clearly. | ||
### Features | ||
- Feature 1 | ||
### Dependencies | ||
A simple Spigot 1.20.4 plugin to obfuscate players' name tag on their head and their names from tab list. | ||
|
||
![](img/screenshot_1.png) | ||
Will obfuscate player's name tag and their name from tab list. | ||
|
||
![](img/screenshot_2.png) | ||
Will not obfuscate player's name in chat. | ||
|
||
## Commands | ||
`/command` Command function. | ||
- `/hide [on|off]` Toggle obfuscation for player's name tag and their name from tab list. | ||
|
||
## Permissions | ||
`permission.node` Permission description. | ||
- `obfusplayer.use` To use `/hide` command. | ||
|
||
## Config | ||
config.yml: | ||
```yml | ||
# Your config here. | ||
## Compile | ||
```shell | ||
./gradlew shadowJar | ||
``` | ||
|
||
## Notice | ||
- Test before reviewing. Please don't leave bad reviews if you dislike it. | ||
- If you find a bug, still don't know how to use the plugin, or have new features to suggest, make sure you're using the lastest version of the plugin and then report bugs [on Github](https://github.com/katorlys/ExampleProject/issues). DO NOT use the review section to do these things, or you won't receive any support! | ||
- If you find a bug, still don't know how to use the plugin, or have new features to suggest, make sure you're using the lastest version of the plugin and then report bugs [on Github](https://github.com/katorlys/ObfusPlayer/issues). DO NOT use the review section to do these things, or you won't receive any support! | ||
- Have any other issues or questions? Go to [Discussions](https://github.com/orgs/katorlys/discussions) for further assistance. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
kotlin.code.style = official | ||
|
||
spigotVersion = 1.19.4-R0.1-SNAPSHOT | ||
spigotVersion = 1.20.4-R0.1-SNAPSHOT | ||
|
||
pluginGroup = com.github.katorly | ||
pluginMain = com.github.katorly.exampleproject.ExampleProject | ||
pluginMain = com.github.katorly.obfusplayer.ObfusPlayer | ||
|
||
pluginName = ExampleProject | ||
pluginApi = 1.19 | ||
pluginName = ObfusPlayer | ||
pluginApi = 1.20 | ||
pluginVersion = 1.0.0 | ||
pluginAuthor = Katorly | ||
pluginDescription = One sentence to describe your plugin. | ||
pluginDescription = A simple Spigot plugin to obfuscate player's name tag and name from tab list. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.github.katorly.obfusplayer | ||
|
||
import com.github.katorly.obfusplayer.commands.Chide | ||
import org.bukkit.Bukkit | ||
import org.bukkit.command.CommandExecutor | ||
import org.bukkit.command.TabCompleter | ||
|
||
class CommandHandler { | ||
companion object { | ||
/** | ||
* Register all the commands of the plugin. | ||
* Please make sure every argument is corresponding. | ||
* | ||
*/ | ||
fun registerCommands() { | ||
val commands = arrayOf( | ||
"hide" | ||
) | ||
val excutors = arrayOf<CommandExecutor>( | ||
Chide() | ||
) | ||
val completers = arrayOf<TabCompleter>( | ||
Chide() | ||
) | ||
for (i in commands.indices) { | ||
Bukkit.getPluginCommand(commands[i])!!.setExecutor(excutors[i]) | ||
Bukkit.getPluginCommand(commands[i])!!.tabCompleter = completers[i] | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.github.katorly.obfusplayer | ||
|
||
import org.bukkit.plugin.java.JavaPlugin | ||
|
||
class ObfusPlayer: JavaPlugin() { | ||
companion object { | ||
lateinit var INSTANCE: ObfusPlayer | ||
private set | ||
} | ||
|
||
override fun onEnable() { | ||
INSTANCE = this | ||
CommandHandler.registerCommands() | ||
logger.info("[ObfusPlayer] Repo: https://github.com/katorlys/ObfusPlayer") | ||
logger.info("[ObfusPlayer] Author: Katorly") | ||
logger.info("[ObfusPlayer] ObfusPlayer enabled!") | ||
} | ||
|
||
override fun onDisable() { | ||
logger.info("[ObfusPlayer] ObfusPlayer disabled!") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.github.katorly.obfusplayer.commands | ||
|
||
import com.github.katorly.obfusplayer.playername.obfuscatePlayerName | ||
import com.github.katorly.obfusplayer.playername.toggleObfuscation | ||
import com.github.katorly.obfusplayer.playername.unobfuscatePlayerName | ||
import com.github.katorly.obfusplayer.utils.sm | ||
import org.bukkit.command.Command | ||
import org.bukkit.command.CommandSender | ||
import org.bukkit.command.TabExecutor | ||
import org.bukkit.entity.Player | ||
|
||
/** | ||
* The /hide command. | ||
* | ||
*/ | ||
class Chide : TabExecutor { | ||
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<String>): Boolean { | ||
if (command.name.equals("hide", ignoreCase = true)) { | ||
if (sender is Player) { | ||
if (sender.isOp || sender.hasPermission("obfusplayer.hide")) { | ||
if (args.isEmpty()) { | ||
toggleObfuscation(sender) | ||
} else if (args.size == 1) { | ||
if (args[0] == "on") { | ||
obfuscatePlayerName(sender) | ||
} else if (args[0] == "off") { | ||
unobfuscatePlayerName(sender) | ||
} | ||
} else { | ||
sender.sm("&e&lObfusPlayer &r&8>> &7Usage: &f/hide [on|off].") | ||
} | ||
} else { | ||
sender.sm("&e&lObfusPlayer &r&8>> &7Insufficient permission!") | ||
} | ||
} else { | ||
sender.sm("&e&lObfusPlayer &r&8>> &7Only players can use this command!") | ||
} | ||
} | ||
return true | ||
} | ||
|
||
override fun onTabComplete( | ||
sender: CommandSender, | ||
command: Command, | ||
label: String, | ||
args: Array<String> | ||
): List<String>? { | ||
if (sender !is Player) { | ||
return null | ||
} else if (sender.isOp || sender.hasPermission("obfusplayer.hide")) { | ||
val sub: MutableList<String> = ArrayList() | ||
sub.add("on") | ||
sub.add("off") | ||
return sub | ||
} | ||
return null | ||
} | ||
} |