mirror of
https://github.com/Shiewk/SModeration.git
synced 2026-04-29 06:34:17 +02:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d095c40f0 | |||
| 8df1029d42 | |||
| 2f66c6f12c | |||
| 1f9758f3d0 | |||
| c7502fd661 | |||
| 1a9cf76a93 | |||
| b3ec076cae | |||
| 3cb3314f4c | |||
| fb785fb53a | |||
| e44f6489af | |||
| faa2eb0a43 | |||
| 8c00347ef2 | |||
| 8de4382ec4 | |||
| 7e90939b84 | |||
| 4266b7ebb6 |
@@ -14,7 +14,7 @@ SModeration provides a nice user interface that can be used instead of chat comm
|
||||
|
||||

|
||||
|
||||
It has helpful functions like filtering and sorting options.
|
||||
It has helpful functions like filtering, searching and sorting options.
|
||||
|
||||
## Commands
|
||||
This plugin has many commands, for a complete list of commands and their usage, please see [the commands list](https://github.com/Shiewk/SModeration/blob/main/docs/commands.md).
|
||||
|
||||
+11
-21
@@ -5,21 +5,20 @@ plugins {
|
||||
group = 'de.shiewk'
|
||||
version = pluginVersion
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "papermc-repo"
|
||||
url = "https://repo.papermc.io/repository/maven-public/"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/groups/public/"
|
||||
subprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "papermc-repo"
|
||||
url = "https://repo.papermc.io/repository/maven-public/"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/groups/public/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
def targetJavaVersion = 17
|
||||
java {
|
||||
@@ -38,12 +37,3 @@ tasks.withType(JavaCompile).configureEach {
|
||||
options.release.set(targetJavaVersion)
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
def props = [version: version]
|
||||
inputs.properties props
|
||||
filteringCharset 'UTF-8'
|
||||
filesMatching('plugin.yml') {
|
||||
expand props
|
||||
}
|
||||
}
|
||||
|
||||
+16
-15
@@ -1,17 +1,18 @@
|
||||
# SModeration commands
|
||||
|
||||
| Command | Description | Permission |
|
||||
|----------------------------------------|------------------------------------------------------------------------------|---------------------|
|
||||
| /smod | Opens the SMod menu. | smod.menu |
|
||||
| /mute \<player> \<duration> \<reason?> | Mutes a player so that they can't type in chat for the specified duration. | smod.mute |
|
||||
| /ban \<player> \<duration> \<reason?> | Bans a player so that they can't join the server for the specified duration. | smod.ban |
|
||||
| /kick \<player> \<reason?> | Kicks a player from the server. | smod.kick |
|
||||
| /modlogs <player\|uuid> | Lists a player's active punishments in chat. | smod.logs |
|
||||
| /unmute <player> | Clears a player's mute status. | smod.unmute |
|
||||
| /unban <player> | Clears a player's ban status. | smod.unban |
|
||||
| /invsee \<player> inventory | Views another player's inventory. | smod.invsee |
|
||||
| /invsee \<player> equipment | Views another player's equipment (armor and offhand). | smod.invsee |
|
||||
| /enderchestsee <player> | Views another player's ender chest. | smod.enderchestsee |
|
||||
| /vanish | Toggles vanish mode so that other players can't see you're online. | smod.vanish |
|
||||
| /vanish toggle \<player> | Toggles vanish mode for another player. | smod.vanish |
|
||||
| /vanish list | Lists all vanished players. | smod.vanish.see |
|
||||
| Command | Description | Permission |
|
||||
|----------------------------------------|------------------------------------------------------------------------------|--------------------|
|
||||
| /smod | Opens the SMod menu. | smod.menu |
|
||||
| /mute \<player> \<duration> \<reason?> | Mutes a player so that they can't type in chat for the specified duration. | smod.mute |
|
||||
| /ban \<player> \<duration> \<reason?> | Bans a player so that they can't join the server for the specified duration. | smod.ban |
|
||||
| /kick \<player> \<reason?> | Kicks a player from the server. | smod.kick |
|
||||
| /modlogs <player\|uuid> | Lists a player's active punishments in chat. | smod.logs |
|
||||
| /unmute <player> | Clears a player's mute status. | smod.unmute |
|
||||
| /unban <player> | Clears a player's ban status. | smod.unban |
|
||||
| /invsee \<player> inventory | Views another player's inventory. | smod.invsee |
|
||||
| /invsee \<player> equipment | Views another player's equipment (armor and offhand). | smod.invsee |
|
||||
| /enderchestsee <player> | Views another player's ender chest. | smod.enderchestsee |
|
||||
| /vanish | Toggles vanish mode so that other players can't see you're online. | smod.vanish |
|
||||
| /vanish toggle \<player> | Toggles vanish mode for another player. | smod.vanish |
|
||||
| /vanish list | Lists all vanished players. | smod.vanish.see |
|
||||
| /socialspy | Enables SocialSpy mode where you can see other player's private messages. | smod.socialspy |
|
||||
@@ -19,5 +19,6 @@
|
||||
| smod.enderchestsee.modify | Allows the player to view and modify other players ender chests. |
|
||||
| smod.vanish | Allows the player to enter and leave vanish mode. |
|
||||
| smod.vanish.see | Allows the player to see vanished players |
|
||||
| smod.socialspy | Allows the player to enable SocialSpy |
|
||||
|
||||
All of these permissions are granted by default if the player is a server operator.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
pluginVersion = 1.3.1
|
||||
pluginVersion = 1.4.2
|
||||
@@ -1 +1,2 @@
|
||||
rootProject.name = 'SModeration'
|
||||
include 'smoderation-paper'
|
||||
@@ -0,0 +1,19 @@
|
||||
apply plugin: 'java'
|
||||
|
||||
dependencies {
|
||||
compileOnly "io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
jar {
|
||||
archiveBaseName.set('SModeration-Paper')
|
||||
archiveVersion.set(pluginVersion)
|
||||
}
|
||||
|
||||
processResources {
|
||||
def props = [version: version]
|
||||
inputs.properties props
|
||||
filteringCharset 'UTF-8'
|
||||
filesMatching('plugin.yml') {
|
||||
expand props
|
||||
}
|
||||
}
|
||||
+15
-10
@@ -1,9 +1,10 @@
|
||||
package de.shiewk.smoderation;
|
||||
package de.shiewk.smoderation.paper;
|
||||
|
||||
import de.shiewk.smoderation.command.*;
|
||||
import de.shiewk.smoderation.input.ChatInputListener;
|
||||
import de.shiewk.smoderation.listener.*;
|
||||
import de.shiewk.smoderation.storage.PunishmentContainer;
|
||||
import de.shiewk.smoderation.paper.command.*;
|
||||
import de.shiewk.smoderation.paper.config.SModerationConfig;
|
||||
import de.shiewk.smoderation.paper.input.ChatInputListener;
|
||||
import de.shiewk.smoderation.paper.listener.*;
|
||||
import de.shiewk.smoderation.paper.storage.PunishmentContainer;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
@@ -16,16 +17,17 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static de.shiewk.smoderation.command.VanishCommand.isVanished;
|
||||
import static de.shiewk.smoderation.command.VanishCommand.toggleVanish;
|
||||
import static de.shiewk.smoderation.paper.command.VanishCommand.isVanished;
|
||||
import static de.shiewk.smoderation.paper.command.VanishCommand.toggleVanish;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
import static org.bukkit.Bukkit.getPluginManager;
|
||||
|
||||
public final class SModeration extends JavaPlugin {
|
||||
public final class SModerationPaper extends JavaPlugin {
|
||||
|
||||
public static final PunishmentContainer container = new PunishmentContainer();
|
||||
public static ComponentLogger LOGGER = null;
|
||||
public static SModeration PLUGIN = null;
|
||||
public static SModerationPaper PLUGIN = null;
|
||||
public static SModerationConfig CONFIG = null;
|
||||
public static File SAVE_FILE = null;
|
||||
|
||||
public static final TextColor PRIMARY_COLOR = TextColor.color(212, 0, 255);
|
||||
@@ -38,6 +40,7 @@ public final class SModeration extends JavaPlugin {
|
||||
public void onLoad() {
|
||||
LOGGER = getComponentLogger();
|
||||
PLUGIN = this;
|
||||
CONFIG = new SModerationConfig(this.getConfig(), this);
|
||||
SAVE_FILE = new File(this.getDataFolder().getAbsolutePath() + "/container.gz");
|
||||
}
|
||||
|
||||
@@ -49,6 +52,7 @@ public final class SModeration extends JavaPlugin {
|
||||
getPluginManager().registerEvents(new EnderchestSeeListener(), this);
|
||||
getPluginManager().registerEvents(new VanishListener(), this);
|
||||
getPluginManager().registerEvents(new ChatInputListener(), this);
|
||||
getPluginManager().registerEvents(new SocialSpyListener(), this);
|
||||
|
||||
registerCommand("mute", new MuteCommand());
|
||||
registerCommand("ban", new BanCommand());
|
||||
@@ -60,6 +64,7 @@ public final class SModeration extends JavaPlugin {
|
||||
registerCommand("invsee", new InvseeCommand());
|
||||
registerCommand("enderchestsee", new EnderchestSeeCommand());
|
||||
registerCommand("vanish", new VanishCommand());
|
||||
registerCommand("socialspy", new SocialSpyCommand());
|
||||
|
||||
container.load(SAVE_FILE);
|
||||
}
|
||||
@@ -76,7 +81,7 @@ public final class SModeration extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
SModeration.container.save(SModeration.SAVE_FILE);
|
||||
SModerationPaper.container.save(SModerationPaper.SAVE_FILE);
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
// in case players are still vanished when the server shuts down
|
||||
if (isVanished(player)){
|
||||
+6
-6
@@ -1,9 +1,9 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.util.TimeUtil;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.util.TimeUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -81,7 +81,7 @@ public class BanCommand implements TabExecutor {
|
||||
reason.append(args[i]);
|
||||
}
|
||||
final Punishment punishment = Punishment.ban(System.currentTimeMillis(), System.currentTimeMillis() + duration, senderUUID, uuid, reason.isEmpty() ? Punishment.DEFAULT_REASON : reason.toString());
|
||||
Punishment.issue(punishment, SModeration.container);
|
||||
Punishment.issue(punishment, SModerationPaper.container);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+9
-13
@@ -1,6 +1,6 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.*;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.*;
|
||||
|
||||
public class EnderchestSeeCommand implements TabExecutor {
|
||||
|
||||
@@ -28,16 +28,12 @@ public class EnderchestSeeCommand implements TabExecutor {
|
||||
if (sender instanceof HumanEntity human){
|
||||
final Player player = PlayerUtil.findOnlinePlayer(args[0]);
|
||||
if (player != null) {
|
||||
if (human.getUniqueId().equals(player.getUniqueId())){
|
||||
human.sendMessage(Component.text("You can't open your own ender chest.").color(FAIL_COLOR));
|
||||
} else {
|
||||
human.sendMessage(CHAT_PREFIX.append(
|
||||
Component.text("Opening ender chest of ").color(PRIMARY_COLOR)
|
||||
.append(Component.text(player.getName()).color(SECONDARY_COLOR))
|
||||
.append(Component.text("."))
|
||||
));
|
||||
human.openInventory(player.getEnderChest());
|
||||
}
|
||||
human.sendMessage(CHAT_PREFIX.append(
|
||||
Component.text("Opening ender chest of ").color(PRIMARY_COLOR)
|
||||
.append(Component.text(player.getName()).color(SECONDARY_COLOR))
|
||||
.append(Component.text("."))
|
||||
));
|
||||
human.openInventory(player.getEnderChest());
|
||||
} else {
|
||||
human.sendMessage(Component.text("This player is not online.").color(FAIL_COLOR));
|
||||
}
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.inventory.InvSeeEquipmentInventory;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.inventory.InvSeeEquipmentInventory;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.*;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.*;
|
||||
|
||||
public class InvseeCommand implements TabExecutor {
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -59,7 +59,7 @@ public class KickCommand implements TabExecutor {
|
||||
reason.append(args[i]);
|
||||
}
|
||||
final Punishment punishment = Punishment.kick(System.currentTimeMillis(), senderUUID, uuid, reason.isEmpty() ? Punishment.DEFAULT_REASON : reason.toString());
|
||||
Punishment.issue(punishment, SModeration.container);
|
||||
Punishment.issue(punishment, SModerationPaper.container);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,10 +1,10 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.util.TimeUtil;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.util.TimeUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -20,7 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.*;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.*;
|
||||
|
||||
public class ModLogsCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -45,7 +45,7 @@ public class ModLogsCommand implements TabExecutor {
|
||||
.append(Component.text(name).color(SECONDARY_COLOR))
|
||||
.append(Component.text(" (%s)".formatted(uuid)).color(INACTIVE_COLOR))));
|
||||
UUID finalUuid = uuid;
|
||||
final List<Punishment> punishments = SModeration.container.findAll(p -> p.to.equals(finalUuid) && p.isActive());
|
||||
final List<Punishment> punishments = SModerationPaper.container.findAll(p -> p.to.equals(finalUuid) && p.isActive());
|
||||
for (Punishment punishment : punishments) {
|
||||
sender.sendMessage(Component.text("- is currently ").color(PRIMARY_COLOR)
|
||||
.append(Component.text(punishment.type == PunishmentType.BAN ? "banned" : "muted").color(SECONDARY_COLOR))
|
||||
+6
-6
@@ -1,9 +1,9 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.util.TimeUtil;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.util.TimeUtil;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.*;
|
||||
@@ -80,7 +80,7 @@ public class MuteCommand implements TabExecutor {
|
||||
reason.append(args[i]);
|
||||
}
|
||||
final Punishment punishment = Punishment.mute(System.currentTimeMillis(), System.currentTimeMillis() + duration, senderUUID, uuid, reason.isEmpty() ? Punishment.DEFAULT_REASON : reason.toString());
|
||||
Punishment.issue(punishment, SModeration.container);
|
||||
Punishment.issue(punishment, SModerationPaper.container);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.inventory.SModMenu;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.inventory.SModMenu;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@@ -15,7 +15,7 @@ public class SModCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||
if (commandSender instanceof Player player){
|
||||
new SModMenu(player, SModeration.container).open();
|
||||
new SModMenu(player, SModerationPaper.container).open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.paper.listener.SocialSpyListener;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.CHAT_PREFIX;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
public class SocialSpyCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
final boolean enabled = SocialSpyListener.toggle(sender);
|
||||
sender.sendMessage(CHAT_PREFIX.append(text("SocialSpy ").append(
|
||||
enabled ?
|
||||
text("enabled").color(NamedTextColor.GREEN) :
|
||||
text("disabled").color(NamedTextColor.RED)
|
||||
).append(text("."))));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,9 +1,9 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.command.*;
|
||||
@@ -46,10 +46,10 @@ public class UnbanCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
UUID finalUuid = uuid;
|
||||
final Punishment punishment = SModeration.container.find(p -> p.to.equals(finalUuid) && p.isActive() && p.type == PunishmentType.BAN);
|
||||
final Punishment punishment = SModerationPaper.container.find(p -> p.to.equals(finalUuid) && p.isActive() && p.type == PunishmentType.BAN);
|
||||
if (punishment != null) {
|
||||
punishment.undo(senderUUID);
|
||||
punishment.broadcastUndo(SModeration.container);
|
||||
punishment.broadcastUndo(SModerationPaper.container);
|
||||
} else {
|
||||
sender.sendMessage(Component.text("This player is not banned.").color(NamedTextColor.RED));
|
||||
}
|
||||
+7
-7
@@ -1,9 +1,9 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.command.*;
|
||||
@@ -46,10 +46,10 @@ public class UnmuteCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
UUID finalUuid = uuid;
|
||||
final Punishment punishment = SModeration.container.find(p -> p.to.equals(finalUuid) && p.isActive() && p.type == PunishmentType.MUTE);
|
||||
final Punishment punishment = SModerationPaper.container.find(p -> p.to.equals(finalUuid) && p.isActive() && p.type == PunishmentType.MUTE);
|
||||
if (punishment != null) {
|
||||
punishment.undo(senderUUID);
|
||||
punishment.broadcastUndo(SModeration.container);
|
||||
punishment.broadcastUndo(SModerationPaper.container);
|
||||
} else {
|
||||
sender.sendMessage(Component.text("This player is not muted.").color(NamedTextColor.RED));
|
||||
}
|
||||
+11
-5
@@ -1,7 +1,8 @@
|
||||
package de.shiewk.smoderation.command;
|
||||
package de.shiewk.smoderation.paper.command;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.event.VanishToggleEvent;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -16,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.*;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.*;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
public class VanishCommand implements TabExecutor {
|
||||
@@ -63,9 +64,14 @@ public class VanishCommand implements TabExecutor {
|
||||
|
||||
public static void toggleVanish(Player player){
|
||||
final boolean newStatus = !isVanished(player);
|
||||
VanishToggleEvent event = new VanishToggleEvent(player, newStatus);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()){
|
||||
return;
|
||||
}
|
||||
if (newStatus){
|
||||
vanishedPlayers.add(player);
|
||||
for (CommandSender sender : SModeration.container.collectBroadcastTargets()) {
|
||||
for (CommandSender sender : SModerationPaper.container.collectBroadcastTargets()) {
|
||||
sender.sendMessage(CHAT_PREFIX.append(
|
||||
player.displayName()
|
||||
.colorIfAbsent(SECONDARY_COLOR)
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package de.shiewk.smoderation.paper.config;
|
||||
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SModerationConfig {
|
||||
|
||||
private final FileConfiguration config;
|
||||
private final SModerationPaper plugin;
|
||||
|
||||
public SModerationConfig(FileConfiguration config, SModerationPaper plugin) {
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public List<String> getSocialSpyCommands(List<String> default_){
|
||||
final String path = "socialspy-commands";
|
||||
if (!config.contains(path)){
|
||||
config.set(path, default_);
|
||||
plugin.saveConfig();
|
||||
}
|
||||
return config.getStringList(path);
|
||||
}
|
||||
|
||||
public FileConfiguration getConfig() {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package de.shiewk.smoderation.event;
|
||||
package de.shiewk.smoderation.paper.event;
|
||||
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.storage.PunishmentContainer;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.storage.PunishmentContainer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package de.shiewk.smoderation.paper.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class VanishToggleEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlerList = new HandlerList();
|
||||
|
||||
private final boolean state;
|
||||
private boolean cancelled;
|
||||
|
||||
public VanishToggleEvent(Player player, boolean state) {
|
||||
super(player);
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public boolean getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return handlerList;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlerList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.input;
|
||||
package de.shiewk.smoderation.paper.input;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.title.Title;
|
||||
@@ -10,7 +10,7 @@ import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.CHAT_PREFIX;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.CHAT_PREFIX;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.GRAY;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ChatInput {
|
||||
this.player = player;
|
||||
this.prompt = prompt;
|
||||
this.action = action;
|
||||
this.remainingTicks = remainingSeconds * 20;
|
||||
this.remainingTicks = remainingSeconds * 20 + 1;
|
||||
}
|
||||
|
||||
static void tickAll() {
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.input;
|
||||
package de.shiewk.smoderation.paper.input;
|
||||
|
||||
import com.destroystokyo.paper.event.server.ServerTickStartEvent;
|
||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import static de.shiewk.smoderation.input.ChatInput.runningInputs;
|
||||
import static de.shiewk.smoderation.paper.input.ChatInput.runningInputs;
|
||||
|
||||
public class ChatInputListener implements Listener {
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
package de.shiewk.smoderation.inventory;
|
||||
package de.shiewk.smoderation.paper.inventory;
|
||||
|
||||
public interface AutoUpdatingCustomInventory extends CustomInventory { }
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.inventory;
|
||||
package de.shiewk.smoderation.paper.inventory;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.inventory;
|
||||
package de.shiewk.smoderation.paper.inventory;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package de.shiewk.smoderation.inventory;
|
||||
package de.shiewk.smoderation.paper.inventory;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
@@ -47,7 +47,7 @@ public class InvSeeEquipmentInventory implements AutoUpdatingCustomInventory {
|
||||
if (viewer.hasPermission("smod.invsee.modify") && !subject.hasPermission("smod.invsee.preventmodify")){
|
||||
event.setCancelled(false);
|
||||
changing = true;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SModeration.PLUGIN, () -> {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SModerationPaper.PLUGIN, () -> {
|
||||
changing = false;
|
||||
final EntityEquipment equipment = subject.getEquipment();
|
||||
equipment.setHelmet(inventory.getItem(0));
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.inventory;
|
||||
package de.shiewk.smoderation.paper.inventory;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+9
-9
@@ -1,11 +1,11 @@
|
||||
package de.shiewk.smoderation.inventory;
|
||||
package de.shiewk.smoderation.paper.inventory;
|
||||
|
||||
import de.shiewk.smoderation.input.ChatInput;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.storage.PunishmentContainer;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.util.TimeUtil;
|
||||
import de.shiewk.smoderation.paper.input.ChatInput;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.paper.storage.PunishmentContainer;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.util.TimeUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.*;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.*;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
public class SModMenu extends PageableCustomInventory {
|
||||
@@ -277,7 +277,7 @@ public class SModMenu extends PageableCustomInventory {
|
||||
skullMeta.setOwningPlayer(Bukkit.getOfflinePlayer(punishment.to));
|
||||
} catch (NullPointerException e) {
|
||||
LOGGER.warn("Player {} has a punishment but was never on this server!", punishment.to);
|
||||
};
|
||||
}
|
||||
}
|
||||
meta.displayName(applyFormatting(text(punishment.type.name).color(NamedTextColor.RED).decorate(TextDecoration.BOLD)));
|
||||
ArrayList<Component> lore = new ArrayList<>();
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package de.shiewk.smoderation.listener;
|
||||
package de.shiewk.smoderation.paper.listener;
|
||||
|
||||
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
|
||||
import de.shiewk.smoderation.inventory.AutoUpdatingCustomInventory;
|
||||
import de.shiewk.smoderation.inventory.CustomInventory;
|
||||
import de.shiewk.smoderation.paper.inventory.AutoUpdatingCustomInventory;
|
||||
import de.shiewk.smoderation.paper.inventory.CustomInventory;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.listener;
|
||||
package de.shiewk.smoderation.paper.listener;
|
||||
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.listener;
|
||||
package de.shiewk.smoderation.paper.listener;
|
||||
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
package de.shiewk.smoderation.listener;
|
||||
package de.shiewk.smoderation.paper.listener;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.event.PunishmentIssueEvent;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.storage.PunishmentContainer;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.event.PunishmentIssueEvent;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.punishments.PunishmentType;
|
||||
import de.shiewk.smoderation.paper.storage.PunishmentContainer;
|
||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -14,13 +14,13 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.world.WorldSaveEvent;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.CHAT_PREFIX;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.CHAT_PREFIX;
|
||||
|
||||
public class PunishmentListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerLogin(PlayerLoginEvent event){
|
||||
Punishment punishment = SModeration.container.find(p ->
|
||||
Punishment punishment = SModerationPaper.container.find(p ->
|
||||
p.type == PunishmentType.BAN
|
||||
&& p.to.equals(event.getPlayer().getUniqueId())
|
||||
&& p.isActive());
|
||||
@@ -32,7 +32,7 @@ public class PunishmentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerChat(AsyncChatEvent event){
|
||||
final Player player = event.getPlayer();
|
||||
final Punishment punishment = SModeration.container.find(p ->
|
||||
final Punishment punishment = SModerationPaper.container.find(p ->
|
||||
p.type == PunishmentType.MUTE
|
||||
&& p.to.equals(player.getUniqueId())
|
||||
&& p.isActive());
|
||||
@@ -64,7 +64,7 @@ public class PunishmentListener implements Listener {
|
||||
@EventHandler
|
||||
public void onWorldSave(WorldSaveEvent event){
|
||||
if (event.getWorld().equals(Bukkit.getServer().getWorlds().get(0))){
|
||||
SModeration.container.save(SModeration.SAVE_FILE);
|
||||
SModerationPaper.container.save(SModerationPaper.SAVE_FILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package de.shiewk.smoderation.paper.listener;
|
||||
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.PRIMARY_COLOR;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.SECONDARY_COLOR;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
public class SocialSpyListener implements Listener {
|
||||
|
||||
private static final List<String> defaultCommands = List.of(
|
||||
"w",
|
||||
"tell",
|
||||
"msg",
|
||||
"teammsg",
|
||||
"tm",
|
||||
"minecraft:w",
|
||||
"minecraft:tell",
|
||||
"minecraft:msg",
|
||||
"minecraft:teammsg",
|
||||
"minecraft:tm"
|
||||
);
|
||||
|
||||
private static final NamespacedKey SAVE_KEY = new NamespacedKey("smoderation", "socialspy");
|
||||
private static final ObjectArrayList<CommandSender> targets = new ObjectArrayList<>();
|
||||
|
||||
public static boolean toggle(CommandSender sender) {
|
||||
boolean enabledNow = isEnabled(sender);
|
||||
if (enabledNow){
|
||||
targets.remove(sender);
|
||||
if (sender instanceof Player player){
|
||||
player.getPersistentDataContainer().set(SAVE_KEY, PersistentDataType.BOOLEAN, false);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
targets.add(sender);
|
||||
if (sender instanceof Player player){
|
||||
player.getPersistentDataContainer().set(SAVE_KEY, PersistentDataType.BOOLEAN, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onPlayerJoin(PlayerJoinEvent event){
|
||||
final PersistentDataContainer pdc = event.getPlayer().getPersistentDataContainer();
|
||||
if (Boolean.TRUE.equals(pdc.get(SAVE_KEY, PersistentDataType.BOOLEAN))){
|
||||
targets.add(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onPlayerQuit(PlayerQuitEvent event){
|
||||
targets.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
public static boolean isEnabled(CommandSender sender){
|
||||
return targets.contains(sender);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
|
||||
public void onPlayerSendCommand(PlayerCommandPreprocessEvent event){
|
||||
List<String> ssCommands = SModerationPaper.CONFIG.getSocialSpyCommands(defaultCommands);
|
||||
final String message = event.getMessage();
|
||||
if (ssCommands.stream().anyMatch(str ->
|
||||
message.startsWith("/"+str+" ")
|
||||
|| message.startsWith(str+" ")
|
||||
)){
|
||||
SocialSpyListener.command(event.getPlayer(), message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void command(Player player, String command){
|
||||
for (CommandSender target : targets) {
|
||||
target.sendMessage(text("[", PRIMARY_COLOR)
|
||||
.append(text("SocialSpy", SECONDARY_COLOR))
|
||||
.append(text("] "))
|
||||
.append(player.displayName().colorIfAbsent(PRIMARY_COLOR))
|
||||
.append(text(": ", PRIMARY_COLOR))
|
||||
.append(text(command, SECONDARY_COLOR))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+24
-6
@@ -1,15 +1,20 @@
|
||||
package de.shiewk.smoderation.listener;
|
||||
package de.shiewk.smoderation.paper.listener;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.command.VanishCommand;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.command.VanishCommand;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.SECONDARY_COLOR;
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
|
||||
public class VanishListener implements Listener {
|
||||
|
||||
@EventHandler public void onPlayerQuit(PlayerQuitEvent event){
|
||||
@@ -19,22 +24,35 @@ public class VanishListener implements Listener {
|
||||
}
|
||||
for (Player vanishedPlayer : VanishCommand.getVanishedPlayers()) {
|
||||
// to clean up visibility status
|
||||
player.hideEntity(SModeration.PLUGIN, vanishedPlayer);
|
||||
player.hideEntity(SModerationPaper.PLUGIN, vanishedPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event){
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SModeration.PLUGIN, () -> {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SModerationPaper.PLUGIN, () -> {
|
||||
final Player player = event.getPlayer().getPlayer();
|
||||
assert player != null;
|
||||
if (player.hasPermission("smod.vanish.see")){
|
||||
for (Player vanishedPlayer : VanishCommand.getVanishedPlayers()) {
|
||||
// to show visible vanished players
|
||||
player.showEntity(SModeration.PLUGIN, vanishedPlayer);
|
||||
player.showEntity(SModerationPaper.PLUGIN, vanishedPlayer);
|
||||
}
|
||||
VanishCommand.listVanishedPlayersTo(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerDeath(PlayerDeathEvent event){
|
||||
final Component message = event.deathMessage();
|
||||
if (VanishCommand.isVanished(event.getPlayer()) && message != null){
|
||||
event.deathMessage(null);
|
||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (onlinePlayer.hasPermission("smod.vanish.see")){
|
||||
onlinePlayer.sendMessage(text("[VANISH] ").color(SECONDARY_COLOR).append(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
package de.shiewk.smoderation.punishments;
|
||||
package de.shiewk.smoderation.paper.punishments;
|
||||
|
||||
import de.shiewk.smoderation.event.PunishmentIssueEvent;
|
||||
import de.shiewk.smoderation.storage.PunishmentContainer;
|
||||
import de.shiewk.smoderation.util.ByteUtil;
|
||||
import de.shiewk.smoderation.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.util.TimeUtil;
|
||||
import de.shiewk.smoderation.paper.event.PunishmentIssueEvent;
|
||||
import de.shiewk.smoderation.paper.storage.PunishmentContainer;
|
||||
import de.shiewk.smoderation.paper.util.ByteUtil;
|
||||
import de.shiewk.smoderation.paper.util.PlayerUtil;
|
||||
import de.shiewk.smoderation.paper.util.TimeUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -15,7 +15,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.UUID;
|
||||
|
||||
import static de.shiewk.smoderation.SModeration.*;
|
||||
import static de.shiewk.smoderation.paper.SModerationPaper.*;
|
||||
|
||||
public class Punishment {
|
||||
public static final String DEFAULT_REASON = "No reason provided.";
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.punishments;
|
||||
package de.shiewk.smoderation.paper.punishments;
|
||||
|
||||
public enum PunishmentType {
|
||||
MUTE("Mute"),
|
||||
+5
-7
@@ -1,7 +1,7 @@
|
||||
package de.shiewk.smoderation.storage;
|
||||
package de.shiewk.smoderation.paper.storage;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -75,7 +75,7 @@ public class PunishmentContainer {
|
||||
}
|
||||
|
||||
public void load(File file){
|
||||
final ComponentLogger logger = SModeration.LOGGER;
|
||||
final ComponentLogger logger = SModerationPaper.LOGGER;
|
||||
try {
|
||||
logger.info("Loading from {}", file.getPath());
|
||||
if (!file.isFile()){
|
||||
@@ -100,9 +100,8 @@ public class PunishmentContainer {
|
||||
}
|
||||
|
||||
public void save(File file) {
|
||||
final ComponentLogger logger = SModeration.LOGGER;
|
||||
final ComponentLogger logger = SModerationPaper.LOGGER;
|
||||
try {
|
||||
logger.info("Saving to {}", file.getPath());
|
||||
if (!file.isFile()){
|
||||
file.mkdirs();
|
||||
file.delete();
|
||||
@@ -115,7 +114,6 @@ public class PunishmentContainer {
|
||||
}
|
||||
gzout.close();
|
||||
}
|
||||
logger.info("Successfully saved.");
|
||||
} catch (IOException e){
|
||||
logger.error("An error occurred while saving: {}", e.toString());
|
||||
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.util;
|
||||
package de.shiewk.smoderation.paper.util;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.UUID;
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
package de.shiewk.smoderation.util;
|
||||
package de.shiewk.smoderation.paper.util;
|
||||
|
||||
import de.shiewk.smoderation.SModeration;
|
||||
import de.shiewk.smoderation.punishments.Punishment;
|
||||
import de.shiewk.smoderation.paper.SModerationPaper;
|
||||
import de.shiewk.smoderation.paper.punishments.Punishment;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -25,7 +25,7 @@ public abstract class PlayerUtil {
|
||||
return "CONSOLE";
|
||||
}
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
||||
return player.getName() == null ? "Unknown Player" + uuid : player.getName();
|
||||
return player.getName() == null ? "Unknown Player " + uuid : player.getName();
|
||||
}
|
||||
|
||||
public static @Nullable UUID offlinePlayerUUIDByName(String name){
|
||||
@@ -34,7 +34,7 @@ public abstract class PlayerUtil {
|
||||
return offlinePlayer.getUniqueId();
|
||||
} else {
|
||||
// try to find uuid by searching through punishments
|
||||
final Punishment punishment = SModeration.container.find(p -> offlinePlayerName(p.to).equalsIgnoreCase(name));
|
||||
final Punishment punishment = SModerationPaper.container.find(p -> offlinePlayerName(p.to).equalsIgnoreCase(name));
|
||||
if (punishment != null) {
|
||||
return punishment.to;
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.shiewk.smoderation.util;
|
||||
package de.shiewk.smoderation.paper.util;
|
||||
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: SModeration
|
||||
version: '${version}'
|
||||
main: de.shiewk.smoderation.SModeration
|
||||
version: '1.4.2'
|
||||
main: de.shiewk.smoderation.paper.SModerationPaper
|
||||
api-version: '1.20'
|
||||
load: STARTUP
|
||||
authors:
|
||||
@@ -75,8 +75,20 @@ commands:
|
||||
usage: "§cUsage: /vanish list or /vanish toggle <player>"
|
||||
aliases:
|
||||
- smvanish
|
||||
- smodvanish
|
||||
- v
|
||||
- smv
|
||||
permission: smod.vanish
|
||||
description: Toggles vanish mode which prevents other players from seeing you're online
|
||||
socialspy:
|
||||
usage: "§cUsage: /socialspy"
|
||||
description: Enables socialspy mode (you can see private messages of other players)
|
||||
permission: smod.socialspy
|
||||
aliases:
|
||||
- smodsocialspy
|
||||
- smsocialspy
|
||||
- smss
|
||||
- ss
|
||||
permissions:
|
||||
smod.mute:
|
||||
default: op
|
||||
@@ -138,3 +150,6 @@ permissions:
|
||||
smod.vanish.see:
|
||||
default: op
|
||||
description: Allows the player to see vanished players
|
||||
smod.socialspy:
|
||||
default: op
|
||||
description: Allows the player to enable SocialSpy
|
||||
Reference in New Issue
Block a user