mirror of
https://github.com/jie65535/gc-openchat-plugin.git
synced 2025-12-05 18:01:38 +08:00
Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
package com.github.jie65535.openchat;public class EventListeners {
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.github.jie65535.openchat;public class OpenChatConfig {
|
||||
}
|
||||
39
src/main/java/com/github/jie65535/openchat/OpenChatData.java
Normal file
39
src/main/java/com/github/jie65535/openchat/OpenChatData.java
Normal 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;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.github.jie65535.openchat;public class OpenChatPlugin {
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.github.jie65535.openchat;public class OpenChatSystem {
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
7
src/main/resources/plugin.json
Normal file
7
src/main/resources/plugin.json
Normal 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", "方块君"]
|
||||
}
|
||||
Reference in New Issue
Block a user