forked from Tutorialwork/ProfessionalBans-Reloaded
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,172 additions
and
856 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,38 @@ | ||
package de.tutorialwork.commands | ||
|
||
import de.tutorialwork.* | ||
import de.tutorialwork.global.executor | ||
import de.tutorialwork.global.prefix | ||
import de.tutorialwork.utils.* | ||
import net.darkdevelopers.darkbedrock.darkness.general.functions.simpleName | ||
import net.md_5.bungee.api.CommandSender | ||
import net.md_5.bungee.api.connection.ProxiedPlayer | ||
import net.md_5.bungee.api.plugin.Command | ||
|
||
object Ban : Command(Ban::class.simpleName) { | ||
object Ban : Command(simpleName<Ban>()) { | ||
|
||
override fun execute(sender: CommandSender, args: Array<String>) { | ||
val executor = if (sender is ProxiedPlayer) sender.uniqueId.toString() else consoleName | ||
if (sender.hasPermission("professionalbans.ban")) { | ||
if (args.size == 2) { | ||
val uuid = UUIDFetcher.getUUID(args[0]) ?: return | ||
val id = args[1].toIntOrNull() ?: return //add fail message | ||
val banned = instance.proxy.getPlayer(uuid) | ||
if (uuid.playerExists()) { | ||
if (uuid.isWebaccountAdmin) sender.msg("$prefix§cDiesen Spieler kannst du nicht bannen/muten") | ||
else { | ||
if (id.isBanReason) { | ||
if (id.hasExtraPermissions) { | ||
if (!sender.hasPermission(id.extraPermissions)) sender.msg("$prefix§cDu hast keine Berechtigung diesen Bangrund zu nutzen") | ||
} else { | ||
uuid.ban(id, executor, increaseValue, increaseBans) | ||
LogManager.createEntry("", executor, ActionType.Ban(id)) | ||
uuid.bans += 1 | ||
ActionType.Ban(id).sendNotify(uuid.name, sender.name) | ||
if (banned.uniqueId.rawEnd == -1L) { | ||
banned.kick(config.getString("LAYOUT.BAN").replace("%grund%", id.reason).translateColors()) | ||
} else banned.sendTempban() | ||
saveConfig() | ||
} | ||
} else { | ||
if (id.hasExtraPermissions) { | ||
if (!sender.hasPermission(id.extraPermissions)) sender.msg("$prefix§cDu hast keine Berechtigung diesen Mutegrund zu nutzen") | ||
} else { | ||
uuid.mute(id, executor) | ||
LogManager.createEntry(uuid.toString(), executor, ActionType.Mute(id)) | ||
uuid.mutes += 1 | ||
ActionType.Mute(id).sendNotify(uuid.name, sender.name) | ||
if (banned != null) { | ||
if (banned.uniqueId.rawEnd == -1L) { | ||
banned.msg(config.getString("LAYOUT.MUTE").replace("%grund%", id.reason).translateColors()) | ||
} else banned.sendTempmute() | ||
saveConfig() | ||
} | ||
} | ||
} | ||
} | ||
} else sender.msg("$prefix§cDieser Spieler hat den Server noch nie betreten") | ||
} else { | ||
sender.sendBanReasonsList() | ||
sender.msg("$prefix/ban <Spieler> <Grund-ID>") | ||
} | ||
} else sender.msg(noPerms) | ||
override fun execute(sender: CommandSender, args: Array<String>) = sender.hasPermission(name.toLowerCase()) { | ||
if (args.size != 2) { | ||
sender.sendBanReasonsList() | ||
sender.msg("$prefix/${name.toLowerCase()} <Spieler> <Grund-ID>") | ||
return | ||
} | ||
val uuid = UUIDFetcher.getUUID(args[0]) ?: return | ||
if (!uuid.playerExists()) { | ||
sender.msg("${prefix}§cDieser Spieler hat den Server noch nie betreten") | ||
return | ||
} | ||
if (uuid.isWebaccountAdmin) { | ||
sender.msg("${prefix}§cDiesen Spieler kannst du nicht bannen/muten") | ||
return | ||
} | ||
val id = args[1].toIntOrNull() ?: return //add fail message | ||
val type = if (id.isBanReason) ActionType.Ban(id) else ActionType.Mute(id) | ||
if (id.hasExtraPermissions && !sender.hasPermission(id.extraPermissions)) { | ||
sender.msg("${prefix}§cDu hast keine Berechtigung diesen ${type::class.java.simpleName}grund zu nutzen") | ||
return | ||
} | ||
val executor = sender.executor | ||
type.execute(uuid, executor) | ||
type.sendNotify(uuid.name, sender.name) | ||
LogManager.createEntry(uuid.toString(), executor, type) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package de.tutorialwork.commands | ||
|
||
import de.tutorialwork.global.config | ||
import de.tutorialwork.global.executor | ||
import de.tutorialwork.global.prefix | ||
import de.tutorialwork.listener.Chat | ||
import de.tutorialwork.utils.* | ||
import net.darkdevelopers.darkbedrock.darkness.general.functions.simpleName | ||
import net.md_5.bungee.api.CommandSender | ||
import net.md_5.bungee.api.connection.ProxiedPlayer | ||
import net.md_5.bungee.api.plugin.Command | ||
|
||
object ChatLog : Command(simpleName<ChatLog>()) { | ||
|
||
private val chatLogUrl by lazy { config.getString("CHATLOG.URL") } | ||
|
||
override fun execute(sender: CommandSender, args: Array<String>) { | ||
if (args.size != 1) { | ||
sender.msg("$prefix/${name.toLowerCase()} <Spieler>") | ||
return | ||
} | ||
val target = args[0].getUUID(sender) ?: return | ||
target.exists(sender) ?: return | ||
if (sender is ProxiedPlayer && sender.uniqueId == target) { | ||
sender.msg("${prefix}§cDu kannst kein ChatLog von dir selbst erstellen") | ||
return | ||
} | ||
if (!Chat.hasMessages(target)) { | ||
sender.msg("${prefix}§cDieser Spieler hat in der letzten Zeit keine Nachrichten verfasst") | ||
return | ||
} | ||
val executor = sender.executor | ||
val id = Chat.createChatlog(target, executor) | ||
LogManager.createEntry(target.toString(), executor, ActionType.Chatlog("CREATE_CHATLOG", id)) | ||
sender.msg("${prefix}Der ChatLog von §e§l${target.name} §7wurde erfolgreich erstellt") | ||
sender.msg("${prefix}Link: §e§l$chatLogUrl$id") | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.