-
Notifications
You must be signed in to change notification settings - Fork 2
API Examples
KoutaChan edited this page Aug 25, 2022
·
5 revisions
- このWikiはあまり活発的に更新されていません
- コードが更新され、非推奨、削除されている可能性があります
- これらのコードは非効率な可能性があります
public class example extends JavaPlugin {
@Override
public void onEnable() {
PlayerRoleCheckerAPI.getConnectorAPI()
.getPlayerData()
/* random user uuid */
.asyncDiscordId(UUID.randomUUID(), result -> {
System.out.printf("User Discord ID: %s%n", result);
});
}
}
public class example extends JavaPlugin {
@Override
public void onEnable() {
PlayerRoleCheckerAPI.getConnectorAPI()
.getCustomDataBase()
.setBypass(new CustomBypassTable());
}
public static class CustomBypassTable implements ConnectorBypassTable {
@Override
public String getUUID(UUID uuid) {
return null;
}
@Override
public String getUUID(String uuid) {
return null;
}
@Override
public void put(String uuid) {
}
@Override
public void remove(UUID uuid) {
}
@Override
public void remove(String uuid) {
}
@Override
public Connection getConnection() throws SQLException {
return null;
}
@Override
public void setConnection(Connection connection) {
}
}
}
public class example extends JavaPlugin {
@Override
public void onEnable() {
PlayerRoleCheckerAPI.getConnectorAPI()
.getCommandManager().register(new TestCommand());
}
}
public class TestCommand extends CommandMessage {
public TestCommand() {
super(null);
}
@Override
public String getCommandName() {
return "!test";
}
@Override
public String getPath() {
return null;
}
@Override
public boolean isWork(CommandData data) {
return true;
}
@Override
public void onMessageReceiveEvent(CommandData event) throws Exception {
event.getMessage().reply("Test Message!").queue();
}
@Override
public void onErrorCaught(CommandData event, Exception exception) {
event.getMessage().reply("Error Detected!").queue();
}
}