Skip to content

Commit

Permalink
Add HexUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
Refrac committed Aug 22, 2024
1 parent 6975ed9 commit 3e3da38
Show file tree
Hide file tree
Showing 9 changed files with 538 additions and 50 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public void perform(CommandSender commandSender, String[] args) {
SimpleTags.getInstance().getMySQLManager().delete();

Bukkit.getOnlinePlayers().forEach(player -> {
player.kick(RyMessageUtils.translate(player, SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
player.kick(RyMessageUtils.adventureTranslate(player, SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
});
break;
case SQLITE:
SimpleTags.getInstance().getSqLiteManager().delete();

Bukkit.getOnlinePlayers().forEach(player -> {
player.kick(RyMessageUtils.translate(player, SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
player.kick(RyMessageUtils.adventureTranslate(player, SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
});
break;
default:
Expand All @@ -74,13 +74,13 @@ public void perform(CommandSender commandSender, String[] args) {
SimpleTags.getInstance().getMySQLManager().deletePlayer(target.getPlayer().getUniqueId().toString());

RyMessageUtils.sendPluginMessage(commandSender, "tags-reset-player");
target.getPlayer().kick(RyMessageUtils.translate(target.getPlayer(), SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
target.getPlayer().kick(RyMessageUtils.adventureTranslate(target.getPlayer(), SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
break;
case SQLITE:
SimpleTags.getInstance().getSqLiteManager().deletePlayer(target.getPlayer().getUniqueId().toString());

RyMessageUtils.sendPluginMessage(commandSender, "tags-reset-player");
target.getPlayer().kick(RyMessageUtils.translate(target.getPlayer(), SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
target.getPlayer().kick(RyMessageUtils.adventureTranslate(target.getPlayer(), SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
break;
default:
RyMessageUtils.sendSender(commandSender, "This command is only available for MySQL, MariaDB and SQLite.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onJoin(PlayerJoinEvent event) {
Tasks.runAsync(() -> profile.getData().load(player));

if (profile == null || profile.getData() == null) {
player.kick(RyMessageUtils.translate(player, SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
player.kick(RyMessageUtils.adventureTranslate(player, SimpleTags.getInstance().getLocaleFile().getString("kick-messages-error")));
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public HashMap<Integer, ItemStack> getCustomMenuBorderItems() {
}

@Override
public Component getMenuName() {
public String getMenuName() {
return RyMessageUtils.translate(SimpleTags.getInstance().getMenus().TAGS_TITLE.replace("%total-tags%", String.valueOf(SimpleTags.getInstance().getTagManager().getLoadedTags().size())));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public ItemBuilder setDurability(int dur) {
return this;
}

public ItemBuilder setName(Component name) {
public ItemBuilder setName(String name) {
ItemMeta im = is.getItemMeta();
im.displayName(name);
im.setDisplayName(name);
is.setItemMeta(im);
return this;
}
Expand Down Expand Up @@ -115,49 +115,49 @@ public ItemBuilder setInfinityDurability() {
return this;
}

public ItemBuilder setLore(Component... lore) {
public ItemBuilder setLore(String... lore) {
ItemMeta im = is.getItemMeta();
im.lore(Arrays.asList(lore));
im.setLore(Arrays.asList(lore));
is.setItemMeta(im);
return this;
}

public ItemBuilder setLore(List<Component> lore) {
public ItemBuilder setLore(List<String> lore) {
ItemMeta im = is.getItemMeta();
im.lore(lore);
im.setLore(lore);
is.setItemMeta(im);
return this;
}

public ItemBuilder removeLoreLine(Component line) {
public ItemBuilder removeLoreLine(String line) {
ItemMeta im = is.getItemMeta();
List<Component> lore = new ArrayList<>(im.lore());
List<String> lore = new ArrayList<>(im.getLore());
if (!lore.contains(line))
return this;
lore.remove(line);
im.lore(lore);
im.setLore(lore);
is.setItemMeta(im);
return this;
}

public ItemBuilder removeLoreLine(int index) {
ItemMeta im = is.getItemMeta();
List<Component> lore = new ArrayList<>(im.lore());
List<String> lore = new ArrayList<>(im.getLore());
if (index < 0 || index > lore.size())
return this;
lore.remove(index);
im.lore(lore);
im.setLore(lore);
is.setItemMeta(im);
return this;
}

public ItemBuilder addLoreLine(Component line) {
public ItemBuilder addLoreLine(String line) {
ItemMeta im = is.getItemMeta();
List<Component> lore = new ArrayList<>();
List<String> lore = new ArrayList<>();
if (im.hasLore())
lore = new ArrayList<>(im.lore());
lore = new ArrayList<>(im.getLore());
lore.add(line);
im.lore(lore);
im.setLore(lore);
is.setItemMeta(im);
return this;
}
Expand Down
Loading

0 comments on commit 3e3da38

Please sign in to comment.