Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
feat: Verified以下による他人を対象としたeffectコマンドを拒否するように (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
book000 authored Aug 10, 2022
1 parent 5943e0d commit 79eac78
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class Event_AntiProblemCommand extends MyMaidLibrary implements Listener,
antiCommandMap.put("/advancement", new AntiCmd_Advancement());
antiCommandMap.put("/minecraft:advancement", new AntiCmd_Advancement());
antiCommandMap.put("/login", new AntiCmd_Login());
antiCommandMap.put("/effect", new AntiCmd_Effect());
}

static void autoHistoryAdd(Player player, String prefix, String details) {
Expand Down Expand Up @@ -302,7 +303,6 @@ public void execute(PlayerCommandPreprocessEvent event, Player player, String[]
static class AntiCmd_KickCmd implements AntiCommand {
@Override
public void execute(PlayerCommandPreprocessEvent event, Player player, String[] args) {
Main.getMyMaidLogger().info("args.length: " + args.length);
if (args.length >= 2 &&
(args[1].equalsIgnoreCase(player.getName()) ||
args[1].equalsIgnoreCase("me") ||
Expand Down Expand Up @@ -394,4 +394,31 @@ public void execute(PlayerCommandPreprocessEvent event, Player player, String[]
autoHistoryAdd(player, "loginコマンドの実行", "(" + String.join(" ", args) + ")");
}
}

static class AntiCmd_Effect implements AntiCommand {
@Override
public void execute(PlayerCommandPreprocessEvent event, Player player, String[] args) {
if (isAMR(player)) {
return;
}

// effect give <targets> <effect> [<seconds>] [<amplifier>] [<hideParticles>]
// effect clear [<targets>] [<effect>]
if (args.length < 3 || !args[1].equalsIgnoreCase("give")) {
return;
}

String target = args[2];
if (target.equalsIgnoreCase(player.getName())) {
return;
}

player.chat("メロンパン2つ買ったら、おっぱい盛るためにメロンパン2つ買ったと思われるかな、思われるよね");
player.chat("メロンパン2つ買う理由なんておっぱいにもるため以外にないもんね");
player.chat("(私は\"" + String.join(" ", args) + "\"コマンドを使用しました。)");
checkSpam(player);
autoHistoryAdd(player, "他人を対象としたeffectコマンドの実行", "(" + String.join(" ", args) + ")");
event.setCancelled(true);
}
}
}

0 comments on commit 79eac78

Please sign in to comment.