Initial commit

This commit is contained in:
2023-01-11 22:19:26 +08:00
commit fe77af8230
23 changed files with 1371 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
package com.github.jie65535.openchat;public class EventListeners {
}

View File

@@ -0,0 +1,2 @@
package com.github.jie65535.openchat;public class OpenChatConfig {
}

View File

@@ -0,0 +1,39 @@
/*
* gc-openchat
* Copyright (C) 2022 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.github.jie65535.openchat;
public class OpenChatConfig {
/**
* 服务器聊天开关
*/
public boolean serverChatEnabled = true;
/**
* 服务器聊天消息格式
* {nickName} 为玩家昵称
* {uid} 为玩家UID
* {message} 为消息内容
*/
public String serverChatFormat = "<color=#99CC99>{nickName}({uid})</color>: {message}";
/**
* 每分钟发言消息数限制
*/
public int messageFreLimitPerMinute = 20;
}

View File

@@ -0,0 +1,2 @@
package com.github.jie65535.openchat;public class OpenChatPlugin {
}

View File

@@ -0,0 +1,2 @@
package com.github.jie65535.openchat;public class OpenChatSystem {
}

View File

@@ -0,0 +1,27 @@
package com.github.jie65535.openchat;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import java.util.List;
@Command(label = "chat", usage = { "<on|off>" })
public class ChatPlayerCommands implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) {
sendUsageMessage(sender);
return;
}
String subCommand = args.get(0).toLowerCase();
var set = OpenChatPlugin.getInstance().getData().offChatPlayers;
if (subCommand.equals("on")) {
set.remove(targetPlayer.getUid());
CommandHandler.sendMessage(sender);
} else if (subCommand.equals("off")) {
set.add(targetPlayer.getUid());
}
}
}

View File

@@ -0,0 +1,12 @@
package com.github.jie65535.openchat;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
@Command(label = "chat",
aliases = { "openchat" },
usage = { "on/off", "unban <uid>", "ban <uid> <time(Minutes)>"},
permission = "player.chat",
permissionTargeted = "server.chat")
public class ChatServerCommands implements CommandHandler {
}

View File

@@ -0,0 +1,7 @@
{
"name": "opencommand-plugin",
"description": "Open command interface for third-party clients",
"version": "dev-1.5.0",
"mainClass": "com.github.jie65535.opencommand.OpenCommandPlugin",
"authors": ["jie65535", "方块君"]
}