Skip to content

Commit

Permalink
complete some TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
RegadPoleCN committed Oct 19, 2024
1 parent 943221c commit b85a21a
Show file tree
Hide file tree
Showing 22 changed files with 745 additions and 194 deletions.
11 changes: 11 additions & 0 deletions bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
taboolib { subproject = true }

repositories {
maven("https://repo.codemc.io/repository/maven-public/")
maven("https://repo.glaremasters.me/repository/bloodshot")
}

dependencies {
compileOnly(project(":common"))
compileOnly("fr.xephi:authme:5.6.0-SNAPSHOT")
compileOnly("org.maxgamer:QuickShop:5.1.1.2")
compileOnly("com.ghostchu:quickshop-bukkit:4.2.2.11")
compileOnly("com.griefdefender:api:2.1.0-SNAPSHOT")
// compileOnly("com.bekvon.bukkit.residence:Residence:5.1.0.1")
compileOnly(fileTree("lib"))
}
gradle.buildFinished {
buildDir.deleteRecursively()
Expand Down
Binary file added bukkit/lib/Residence5.1.0.1.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.regadpole.plumbot.bukkit.hook;

import fr.xephi.authme.api.v3.AuthMeApi;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import taboolib.common.platform.function.IOKt;

public class AuthMeHook {

public static Boolean hasAuthMe;
public static AuthMeApi authMeApi;

public static void hookAuthme() {

Plugin authMe = Bukkit.getPluginManager().getPlugin("AuthMe");
try {
if (authMe != null) {
hasAuthMe = true;
authMeApi = AuthMeApi.getInstance();
IOKt.info("AuthMe 关联成功");
}else{
hasAuthMe = false;
IOKt.info("AuthMe 关联失败");
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package me.regadpole.plumbot.bukkit.hook;

import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import taboolib.common.platform.function.IOKt;

public class GriefDefenderHook {


public static Boolean hasGriefDefender;

public static void hookGriefDefender() {

Plugin authMe = Bukkit.getPluginManager().getPlugin("GriefDefender");
try {
if (authMe != null) {
hasGriefDefender = true;
IOKt.info("GriefDefender 关联成功");
}else{
hasGriefDefender = false;
IOKt.info("GriefDefender 关联失败");
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package me.regadpole.plumbot.bukkit.hook;

import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import taboolib.common.platform.function.IOKt;

public class QuickShopHook {

public static Boolean hasQs;

public static Boolean hasQsHikari;

public static void hookQuickShop() {

Plugin quickShop = Bukkit.getPluginManager().getPlugin("QuickShop");
try {
if (quickShop != null) {
hasQs = true;
hasQsHikari = false;
IOKt.info("QuickShop-Reremake 关联成功");
}else{
hasQs = false;
Plugin quickShopHikari = Bukkit.getPluginManager().getPlugin("QuickShop-Hikari");
try {
if (quickShopHikari != null) {
hasQsHikari = true;
IOKt.info("QuickShop-Hikari 关联成功");
}else{
hasQsHikari = false;
IOKt.info("QuickShop 关联失败");
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package me.regadpole.plumbot.bukkit.hook;

import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.chat.ChatManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import taboolib.common.platform.function.IOKt;

public class ResidenceHook {

public static Boolean hasRes;

public static ChatManager resChatApi;

public static void hookRes() {

Plugin residence = Bukkit.getPluginManager().getPlugin("Residence");
try {
if (residence != null) {
hasRes = true;
resChatApi = Residence.getInstance().getChatManager();
IOKt.info("Residence 关联成功");
}else{
hasRes = false;
IOKt.info("Residence 关联失败");
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package me.regadpole.plumbot.bukkit.listener;

import me.regadpole.plumbot.bukkit.util.ServerManager;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Set;
import java.util.UUID;

public class ConsoleSender implements ConsoleCommandSender {

private final Server server = Bukkit.getServer();

public Server getServer() {
return this.server;
}

public String getName() {
return "CONSOLE";
}

public void sendMessage(String message) {
ServerManager.msgList.add(message);
}

public void sendMessage(String[] messages) {
for (String msg : messages)
sendMessage(msg);
}

public void sendMessage(@Nullable UUID sender, @NotNull String message) {
ServerManager.msgList.add(message);
}

public void sendMessage(@Nullable UUID sender, @NotNull String[] messages) {
for (String msg : messages)
sendMessage(null, msg);
}

public boolean isPermissionSet(String s) {
return false;
}

public boolean isPermissionSet(Permission permission) {
return false;
}

public boolean hasPermission(String s) {
return true;
}

public boolean hasPermission(Permission permission) {
return true;
}

public boolean isOp() {
return true;
}

public void setOp(boolean b) {
throw new UnsupportedOperationException();
}

public Spigot spigot() {
throw new UnsupportedOperationException();
}

public boolean isConversing() {
throw new UnsupportedOperationException();
}

public void acceptConversationInput(String s) {
ServerManager.msgList.add(s);
throw new UnsupportedOperationException();
}

public boolean beginConversation(Conversation conversation) {
throw new UnsupportedOperationException();
}

public void abandonConversation(Conversation conversation) {
throw new UnsupportedOperationException();
}

public void abandonConversation(Conversation conversation, ConversationAbandonedEvent conversationAbandonedEvent) {
throw new UnsupportedOperationException();
}

public void sendRawMessage(String s) {
ServerManager.msgList.add(s);
}

public void sendRawMessage(@Nullable UUID sender, @NotNull String message) {
ServerManager.msgList.add(message);
}

public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b) {
ServerManager.msgList.add(s);
throw new UnsupportedOperationException();
}

public PermissionAttachment addAttachment(Plugin plugin) {
throw new UnsupportedOperationException();
}

public PermissionAttachment addAttachment(Plugin plugin, String s, boolean b, int i) {
ServerManager.msgList.add(s);
throw new UnsupportedOperationException();
}

public PermissionAttachment addAttachment(Plugin plugin, int i) {
throw new UnsupportedOperationException();
}

public void removeAttachment(PermissionAttachment permissionAttachment) {
throw new UnsupportedOperationException();
}

public void recalculatePermissions() {
throw new UnsupportedOperationException();
}

public Set<PermissionAttachmentInfo> getEffectivePermissions() {
throw new UnsupportedOperationException();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package me.regadpole.plumbot.bukkit.listener;

import com.griefdefender.api.event.ClaimEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;

public class GDClaimEvent implements Listener {


private static String gdMessage;

@EventHandler(priority = EventPriority.HIGH)
public void onGDClaim (ClaimEvent e){
setGDMessage(e.getMessage().toString());
}

public static String getGDMessage() {return gdMessage;}
private static void setGDMessage(String s) {gdMessage = s;}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package me.regadpole.plumbot.bukkit.listener;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;

public class QsChatEvent implements Listener {

private static String qsMessage;
private static Player qsSender;

@EventHandler(priority = EventPriority.HIGH)
public void onQSChat (org.maxgamer.quickshop.api.event.QSHandleChatEvent e){
setQsMessage(e.getMessage());
setQsSender(e.getSender());
}

public static String getQsMessage() {return qsMessage;}
public static Player getQsSender() {return qsSender;}
private static void setQsMessage(String s) {qsMessage = s;}
private static void setQsSender(Player p) {qsSender = p;}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package me.regadpole.plumbot.bukkit.listener;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class QsHikariChatEvent implements Listener {

private static String qsMessage;
private static Player qsSender;

@EventHandler(priority = EventPriority.HIGH)
public void onQSChat (com.ghostchu.quickshop.api.event.QSHandleChatEvent e){
setQsMessage(e.getMessage());
setQsSender(e.getSender());
}


public static String getQsMessage() {return qsMessage;}
public static Player getQsSender() {return qsSender;}
private static void setQsMessage(String s) {qsMessage = s;}
private static void setQsSender(Player p) {qsSender = p;}
}
Loading

0 comments on commit b85a21a

Please sign in to comment.