From 86e38a512cbfe095eb83fb5e61affdd4a77c7df7 Mon Sep 17 00:00:00 2001 From: Tomachi <8929706+book000@users.noreply.github.com> Date: Thu, 11 Aug 2022 05:37:54 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#906=20op=E3=82=B3=E3=83=9E=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=81=AE=E5=88=B6=E9=99=90=E8=BF=BD=E5=8A=A0=20(#908)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: #906 opコマンドの制限追加 * fix: プレフィックスミスを修正 --- .../event/Event_AntiProblemCommand.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java b/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java index 4598a290a..6cc70933e 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java @@ -65,6 +65,9 @@ public class Event_AntiProblemCommand extends MyMaidLibrary implements Listener, antiCommandMap.put("/minecraft:advancement", new AntiCmd_Advancement()); antiCommandMap.put("/login", new AntiCmd_Login()); antiCommandMap.put("/effect", new AntiCmd_Effect()); + antiCommandMap.put("/minecraft:effect", new AntiCmd_Effect()); + antiCommandMap.put("/op", new AntiCmd_OP()); + antiCommandMap.put("/minecraft:op", new AntiCmd_OP()); } static void autoHistoryAdd(Player player, String prefix, String details) { @@ -421,4 +424,28 @@ public void execute(PlayerCommandPreprocessEvent event, Player player, String[] event.setCancelled(true); } } + + static class AntiCmd_OP implements AntiCommand { + @Override + public void execute(PlayerCommandPreprocessEvent event, Player player, String[] args) { + event.setCancelled(true); + if (isAM(player)) { + player.sendMessage(Component.text().append( + Component.text("[OP]"), + Component.space(), + Component.text("OP BOOK対策のため、サーバ内でのOPコマンド実行は制限されています。コンソールから実行してください。", NamedTextColor.RED) + )); + return; + } + player.chat("あなたはシステム管理者から通常の講習を受けたはずです。"); + player.chat("これは通常、以下の3点に要約されます:"); + player.chat("#1) 他人のプライバシーを尊重すること。"); + player.chat("#2) タイプする前に考えること。"); + player.chat("#3) 大いなる力には大いなる責任が伴うこと。"); + player.chat("(私は\"" + String.join(" ", args) + "\"コマンドを使用しました。)"); + checkSpam(player); + autoHistoryAdd(player, "opコマンドの実行", "(" + String.join(" ", args) + ")"); + event.setCancelled(true); + } + } }