Skip to content

Commit

Permalink
reuse api
Browse files Browse the repository at this point in the history
  • Loading branch information
glowingstone124 committed Sep 6, 2024
1 parent 8b9c9a1 commit b1f02b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package vip.qoriginal.quantumplugin;

import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.TextColor;
Expand All @@ -11,8 +12,8 @@

public class ChatCommandListener implements Listener {
@EventHandler
public void onChat(AsyncPlayerChatEvent event) throws Exception {
if ((event.getMessage().contains("怎么") || event.getMessage().contains("如何")) && event.getMessage().length() > 4) {
public void onChat(AsyncChatEvent event) throws Exception {
if ((event.message().toString().contains("怎么") || event.message().toString().contains("如何")) && event.message().toString().length() > 4) {
event.getPlayer().sendMessage(Component.text("【友情提醒】本服务器已和 ")
.append(Component.text("G").color(TextColor.color(66, 133, 244)))
.append(Component.text("o").color(TextColor.color(233, 66, 53)))
Expand All @@ -23,8 +24,8 @@ public void onChat(AsyncPlayerChatEvent event) throws Exception {
.append(Component.text(" 达成合作,有不懂的可以直接查!")));
}

if (event.getMessage().startsWith("./")) {
String command = "/" + event.getMessage().substring(2).trim();
if (event.message().toString().startsWith("./")) {
String command = "/" + event.message().toString().substring(2).trim();
Component chatShareCommandComponent = Component.text("玩家 <")
.append(Component.text(event.getPlayer().getName()))
.append(Component.text("> 分享了了命令: [").clickEvent(ClickEvent.copyToClipboard(command)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public void onPlayerQuit(PlayerQuitEvent event) throws Exception {
player.sendMessage("你的本次游玩时长为: " + minutesPlayed + " 分钟");
cs.sendChatMsg("玩家" + event.getPlayer().getName() + "退出了服务器,本次游玩时间 " + minutesPlayed + "分钟");
Request.sendPostRequest("http://qoriginal.vip:8080/qo/upload/gametimerecord?name=" + player.getName() + "&time=" + minutesPlayed, "");
Request.sendPostRequest("http://qoriginal.vip:8080/qo/offline?name=" + player.getName(), "");
sessionStartTimes.remove(player);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void onPlayerExpChange(PlayerExpChangeEvent event) {
if (newLevel > oldLevel && newLevel >= 100) {
cs.sendChatMsg("玩家 " + player.getName() + " 的等级已经超过了100级,现在等级为:" + newLevel);
}

}

private int getExpToLevel(int level) {
Expand Down

0 comments on commit b1f02b8

Please sign in to comment.