Skip to content

Commit

Permalink
1.1.7: updated for new api
Browse files Browse the repository at this point in the history
  • Loading branch information
benfiratkaya committed Jan 11, 2025
1 parent 1ebb7a7 commit c2a48b3
Show file tree
Hide file tree
Showing 45 changed files with 72 additions and 899 deletions.
2 changes: 0 additions & 2 deletions bukkit/src/main/java/net/leaderos/plugin/Bukkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import net.leaderos.plugin.configuration.Modules;
import net.leaderos.plugin.helpers.ChatUtil;
import net.leaderos.plugin.helpers.DebugBukkit;
import net.leaderos.plugin.modules.auth.AuthModule;
import net.leaderos.plugin.modules.bazaar.BazaarModule;
import net.leaderos.plugin.modules.cache.CacheModule;
import net.leaderos.plugin.modules.connect.ConnectModule;
Expand Down Expand Up @@ -100,7 +99,6 @@ public void onEnable() {
setupCommands();

// Loads modules
LeaderOSAPI.getModuleManager().registerModule(new AuthModule());
LeaderOSAPI.getModuleManager().registerModule(new DiscordModule());
LeaderOSAPI.getModuleManager().registerModule(new CacheModule());
LeaderOSAPI.getModuleManager().registerModule(new CreditModule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public static class Messages extends OkaeriConfig {

private String haveRequestOngoing = "&cPlease wait for your current request to be done!";

private String registrationRequired = "{prefix} &cYou must register on the website for this action!";

/**
* Help commands message
*/
Expand Down Expand Up @@ -157,33 +159,6 @@ public static class Command extends OkaeriConfig {

}

/**
* Auth messages
*/
private Auth auth = new Auth();

/**
* Auth messages of plugin
*/
@Getter @Setter
public static class Auth extends OkaeriConfig {

/**
* Command Message
*/
private String commandMessage = "{prefix} <&aClick here for authentication!{&eClick Me!}(open_url:%link%)>";

/**
* Module error message
*/
private String moduleError = "{prefix} <&cThis system require you to login website, click here!{&eClick Me!}(open_url:%link%)>";

/**
* error on auth link
*/
private String noLink = "{prefix} &cAn error occurred while connecting web-server. Please visit our website.";
}

/**
* Discord messages
*/
Expand Down Expand Up @@ -446,11 +421,6 @@ public static class WebStoreGui extends OkaeriConfig {
*/
private String buyWebStoreError = "&cAn error occurred during the purchase process!";

/**
* register website for this action
*/
private String buyWebStoreNoAuthLinkError = "{prefix} &cYou must register on the website for this action!";

/**
* Default Category attributes
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,6 @@
@Setter
@Names(strategy = NameStrategy.IDENTITY)
public class Modules extends OkaeriConfig {

/**
* Auth system
*/
private Auth Auth = new Auth();

/**
* Auth module settings
*
* @since 1.0
* @author poyrazinan
*/
@Getter
@Setter
public static class Auth extends OkaeriConfig {
/**
* Status of Auth mode
*/
private boolean status = false;
}

/**
* Discord module
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public static class Messages extends Language.Messages {

private String haveRequestOngoing = "&cPlease wait for your current request to be done!";

private String registrationRequired = "{prefix} &cYou must register on the website for this action!";

/**
* Help commands message
*/
Expand Down Expand Up @@ -157,33 +159,6 @@ public static class Command extends Language.Messages.Command {

}

/**
* Auth messages
*/
private Auth auth = new Auth();

/**
* Auth messages of plugin
*/
@Getter @Setter
public static class Auth extends Language.Messages.Auth {

/**
* Command Message
*/
private String commandMessage = "{prefix} <&aClick here for authentication!{&eClick Me!}(open_url:%link%)>";

/**
* Module error message
*/
private String moduleError = "{prefix} <&cThis system require you to login website, click here!{&eClick Me!}(open_url:%link%)>";

/**
* error on auth link
*/
private String noLink = "{prefix} &cAn error occurred while connecting web-server. Please visit our website.";
}

/**
* Discord messages
*/
Expand Down Expand Up @@ -446,11 +421,6 @@ public static class WebStoreGui extends Language.Gui.WebStoreGui {
*/
private String buyWebStoreError = "&cAn error occurred during the purchase process!";

/**
* register website for this action
*/
private String buyWebStoreNoAuthLinkError = "{prefix} &cYou must register on the website for this action!";

/**
* Default Category attributes
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public static class Messages extends Language.Messages {

private String cannotCreateFull = "{prefix} &cEnvanterinde yeterli boşluk bulunmamakta, lütfen envanterini boşalt ve tekrar dene.";

private String haveRequestOngoing = "&cLütfen şu anki işleminin bitmesini bekle!";
private String haveRequestOngoing = "&cLütfen şu anki işleminin bitmesini bekleyiniz.";

private String registrationRequired = "{prefix} &cBu işlemi yapabilmek için siteye kayıt olmalısın!";

/**
* Help commands message
Expand Down Expand Up @@ -157,33 +159,6 @@ public static class Command extends Language.Messages.Command {

}

/**
* Auth messages
*/
private Auth auth = new Auth();

/**
* Auth messages of plugin
*/
@Getter @Setter
public static class Auth extends Language.Messages.Auth {

/**
* Command Message
*/
private String commandMessage = "{prefix} <&aHesabını eşlemek için tıkla!{&eTıkla!}(open_url:%link%)>";

/**
* Module error message
*/
private String moduleError = "{prefix} <&cBu sistem siteye girişi gerektirmektedir. Giriş yapmak için tıkla!{&eTıkla!}(open_url:%link%)>";

/**
* error on auth link
*/
private String noLink = "{prefix} &cSunucuya bağlanırken hata oluştu.";
}

/**
* Discord messages
*/
Expand Down Expand Up @@ -444,11 +419,6 @@ public static class WebStoreGui extends Language.Gui.WebStoreGui {
*/
private String buyWebStoreError = "&cSatın alım hatası.";

/**
* register website for this action
*/
private String buyWebStoreNoAuthLinkError = "{prefix} &cBu işlemi yapabilmek için siteye kayıt olmalısın.";

/**
* Default Category attributes
*/
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import dev.triumphteam.cmd.core.annotation.Command;
import dev.triumphteam.cmd.core.annotation.Default;
import lombok.RequiredArgsConstructor;
import net.leaderos.plugin.Bukkit;
import net.leaderos.plugin.api.managers.ModuleManager;
import net.leaderos.plugin.helpers.ChatUtil;
import net.leaderos.plugin.modules.cache.model.User;
import net.leaderos.plugin.modules.bazaar.gui.BazaarGui;
import org.bukkit.entity.Player;
Expand All @@ -26,7 +28,10 @@ public class BazaarCommand extends BaseCommand {
@Default
@Permission("leaderos.bazaar.open")
public void defaultCommand(Player player) {
if (ModuleManager.getModule("Bazaar").isEnabled() && User.isPlayerAuthed(player))
BazaarGui.showGui(player);
if (ModuleManager.getModule("Bazaar").isEnabled())
if (User.isPlayerAuthed(player))
BazaarGui.showGui(player);
else
ChatUtil.sendMessage(player, Bukkit.getInstance().getLangFile().getMessages().getRegistrationRequired());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import net.leaderos.plugin.Bukkit;
import net.leaderos.plugin.helpers.ChatUtil;
import net.leaderos.plugin.helpers.MDChat.MDChatAPI;
import net.leaderos.shared.Shared;
import net.leaderos.shared.helpers.RequestUtil;
import net.leaderos.shared.modules.discord.DiscordHelper;
import org.bukkit.entity.Player;

/**
Expand All @@ -36,16 +36,13 @@ public void defaultCommand(Player player) {
RequestUtil.addRequest(player.getUniqueId());

org.bukkit.Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getInstance(), () -> {
String link = DiscordHelper.getSyncLink(player.getName());
if (link != null)
player.spigot().sendMessage(
MDChatAPI.getFormattedMessage(ChatUtil.color(Bukkit.getInstance()
.getLangFile().getMessages()
.getDiscord().getCommandMessage()
.replace("%link%", link)
.replace("{prefix}", Bukkit.getInstance().getLangFile().getMessages().getPrefix()))));
else
ChatUtil.sendMessage(player, Bukkit.getInstance().getLangFile().getMessages().getDiscord().getNoLink());
String link = Shared.getLink() + "/discord/link";
player.spigot().sendMessage(
MDChatAPI.getFormattedMessage(ChatUtil.color(Bukkit.getInstance()
.getLangFile().getMessages()
.getDiscord().getCommandMessage()
.replace("%link%", link)
.replace("{prefix}", Bukkit.getInstance().getLangFile().getMessages().getPrefix()))));

RequestUtil.invalidate(player.getUniqueId());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.jetbrains.annotations.NotNull;

import java.util.Objects;
import java.util.UUID;

/**
* Donations module main class
Expand Down Expand Up @@ -61,7 +60,7 @@ public DonationsModule() {}
// Player head collector
ItemStack item = XMaterial.PLAYER_HEAD.parseItem();
assert item != null;
OfflinePlayer player = org.bukkit.Bukkit.getOfflinePlayer(donation.getUsername());
OfflinePlayer player = org.bukkit.Bukkit.getOfflinePlayer(donation.getDisplayName());
SkullMeta meta;
try {
meta = (SkullMeta) XSkull.of(Objects.requireNonNull(item.getItemMeta())).profile(Profileable.of(player)).apply();
Expand All @@ -71,14 +70,14 @@ public DonationsModule() {}
meta.setDisplayName(ChatUtil.replacePlaceholders(
Bukkit.getInstance().getLangFile().getGui().getDonationsGui().getDisplayName(),
new Placeholder("%i%", String.valueOf(donation.getRank())),
new Placeholder("%player%", donation.getUsername()),
new Placeholder("%player%", donation.getDisplayName()),
new Placeholder("%amount%", String.valueOf(donation.getAmount())),
new Placeholder("%symbol%", donation.getSymbol())
));
meta.setLore(ChatUtil.replacePlaceholders(
Bukkit.getInstance().getLangFile().getGui().getDonationsGui().getLore(),
new Placeholder("%i%", String.valueOf(donation.getRank())),
new Placeholder("%player%", donation.getUsername()),
new Placeholder("%player%", donation.getDisplayName()),
new Placeholder("%amount%", String.valueOf(donation.getAmount())),
new Placeholder("%symbol%", donation.getSymbol())
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void loadDonationsData() {
JSONArray data = recentDonationResponse.getResponseMessage().getJSONArray("array");
for (int i = 0; i < data.length(); i++) {
JSONObject donation = (JSONObject) data.get(i);
donations.add(new Donation(i + 1, donation.getString("username"), donation.getDouble("raw_total"), donation.getString("currency")));
donations.add(new Donation(i + 1, donation.getString("display_name"), donation.getString("username"), donation.getDouble("raw_total"), donation.getString("currency")));
}
}
} catch (IOException ignored) {}
Expand Down
Loading

0 comments on commit c2a48b3

Please sign in to comment.