Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
style, ci: format code with Ktlint, update build workflow (#1)
Browse files Browse the repository at this point in the history
* style: format code with Ktlint

* ci: add upload artifact, remove cla, ignore another issue

* ci: update all actions in build workflow to v4

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Katorly <i@katorly.com>
Co-authored-by: Katorly <70022443+katorly@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 20, 2024
1 parent 4f0dadd commit d89a4ac
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 88 deletions.
21 changes: 0 additions & 21 deletions .github/cla.md

This file was deleted.

19 changes: 13 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
name: Build

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Build and analyze
uses: gradle/wrapper-validation-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
- name: Make Gradle Wrapper executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew shadowJar
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: plugin-jars
path: build/libs/*.jar
36 changes: 0 additions & 36 deletions .github/workflows/cla.yml

This file was deleted.

5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ Will not obfuscate player's name in chat.
## Permissions
- `obfusplayer.use` To use `/hide` command.

## 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/ObfusPlayer/issues). DO NOT use the review section to do these things, or you won't receive any support!
Expand Down
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ plugins {
id("com.github.johnrengelman.shadow") version "8.1.1" // Documentation: https://github.com/johnrengelman/shadow
}

val spigotVersion : String by project
val pluginGroup : String by project
val pluginVersion : String by project
val spigotVersion: String by project
val pluginGroup: String by project
val pluginVersion: String by project

group = project.property("pluginGroup") as String
version = project.property("pluginVersion") as String
Expand Down Expand Up @@ -60,4 +60,4 @@ tasks {
archiveBaseName.set(pluginName)
archiveClassifier.set("shadow")
}
}
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
val pluginName: String by settings
rootProject.name = pluginName
rootProject.name = pluginName
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ class CommandHandler {
*/
fun registerCommands() {
val commands = arrayOf(
"hide"
"hide",
)
val excutors = arrayOf<CommandExecutor>(
Chide()
Chide(),
)
val completers = arrayOf<TabCompleter>(
Chide()
Chide(),
)
for (i in commands.indices) {
Bukkit.getPluginCommand(commands[i])!!.setExecutor(excutors[i])
Bukkit.getPluginCommand(commands[i])!!.tabCompleter = completers[i]
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/main/kotlin/com/github/katorly/obfusplayer/ObfusPlayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.github.katorly.obfusplayer

import org.bukkit.plugin.java.JavaPlugin

class ObfusPlayer: JavaPlugin() {
class ObfusPlayer : JavaPlugin() {
companion object { // skipcq: KT-W1047
lateinit var INSTANCE: ObfusPlayer
private set
Expand All @@ -19,4 +19,4 @@ class ObfusPlayer: JavaPlugin() {
override fun onDisable() {
logger.info("[ObfusPlayer] ObfusPlayer disabled!")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Chide : TabExecutor {
sender: CommandSender,
command: Command,
label: String,
args: Array<String>
args: Array<String>,
): List<String>? {
if (sender !is Player) {
return null
Expand All @@ -55,4 +55,4 @@ class Chide : TabExecutor {
}
return null
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.bukkit.entity.Player
import org.bukkit.scoreboard.Team
import java.util.*


private val obfuscatedPlayers = HashMap<UUID, Boolean>()
private val scoreboard = Bukkit.getScoreboardManager()!!.mainScoreboard

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.bukkit.scheduler.BukkitRunnable
fun String.color(): String {
return this.multiReplace(
"&" to "§",
"§§" to "&"
"§§" to "&",
)
}

Expand Down Expand Up @@ -145,9 +145,10 @@ fun bb(plugin: JavaPlugin, message: String, seconds: Number = 1, color: BarColor
*/
fun Player.sa(message: String) {
this.spigot().sendMessage(
ChatMessageType.ACTION_BAR, *TextComponent.fromLegacyText(
message.color()
)
ChatMessageType.ACTION_BAR,
*TextComponent.fromLegacyText(
message.color(),
),
)
}

Expand All @@ -158,4 +159,4 @@ fun Player.sa(message: String) {
*/
fun ba(message: String) {
for (player in Bukkit.getOnlinePlayers()) player.sa(message)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ fun String.multiReplace(vararg re: Pair<String, Any>): String {
}
}
return s.toString()
}
}

0 comments on commit d89a4ac

Please sign in to comment.