Skip to content

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghosty920 committed Sep 30, 2024
1 parent b841284 commit 5ab0141
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 10 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "me.ghosty"
version = "1.1.1"
version = "1.1.2"

repositories {
mavenCentral()
Expand All @@ -15,6 +15,7 @@ repositories {

dependencies {
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")

// compileOnly("xyz.haoshoku.nick:nickapi:7.2-SNAPSHOT")
compileOnly("xyz/haoshoku/nick:NickAPI:v6.7")

Expand Down
4 changes: 3 additions & 1 deletion configs/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ drophead:


disguise:
# Being able to pose the heads
# Being able to place the heads
place-head: true
# Giving the head back when doing /undisguise and when using another head
give-back: false


restaure:
Expand Down
2 changes: 2 additions & 0 deletions configs/french.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ drophead:
disguise:
# Le fait de pouvoir poser les têtes
place-head: true
# Le fait de rendre la tête au /undisguise et quand tu utilises une autre tête
give-back: false


restaure:
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/me/ghosty/kamoof/commands/UndisguiseCMD.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package me.ghosty.kamoof.commands;

import me.ghosty.kamoof.KamoofSMP;
import me.ghosty.kamoof.features.disguise.DisguiseManager;
import me.ghosty.kamoof.features.drophead.SkullManager;
import me.ghosty.kamoof.utils.Lang;
import me.ghosty.kamoof.utils.Message;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import xyz.haoshoku.nick.api.NickAPI;

import java.util.List;
Expand All @@ -22,6 +25,11 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
if (NickAPI.isNicked(player)) {
String disguise = NickAPI.getName(player);
DisguiseManager.undisguise(player);
if(KamoofSMP.config().getBoolean("disguise.give-back")) {
ItemStack item = SkullManager.getSkull(disguise);
if(!player.getInventory().addItem(item).isEmpty())
player.getWorld().dropItem(player.getLocation(), item);
}
Message.send(player, "messages.undisguise", Map.of("player", NickAPI.getOriginalName(player), "nick", disguise));
} else {
Message.send(player, "messages.nodisguise", Map.of("player", NickAPI.getOriginalName(player)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ else if (downloadsCount < 1_000_000)
Pattern pattern = Pattern.compile(Lang.VERSION_CHANGELOG_REGEX.get(), Pattern.CANON_EQ);
Matcher matcher = pattern.matcher(changelog);
matcher.find();
changelog = matcher.group().replace("\\n", "<br>");
// changelog = String.join("<br>", matcher.group().split("\\\\n"));
changelog = matcher.group().replace("\\n", "<br>").replace("\"", "\\\"");

String hover = String.format(Lang.NEW_VERSION_HOVER.get(), newVersion, downloads, changelog);
String url = "https://modrinth.com/plugin/camouf2/version/" + newVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import xyz.haoshoku.nick.api.NickAPI;

import java.util.Map;
Expand Down Expand Up @@ -58,6 +59,11 @@ public void onInteract(PlayerInteractEvent event) {
}
}

if (KamoofSMP.config().getBoolean("disguise.give-back") && NickAPI.isNicked(player)) {
ItemStack item = SkullManager.getSkull(NickAPI.getName(player));
if (!player.getInventory().addItem(item).isEmpty())
player.getWorld().dropItem(player.getLocation(), item);
}
DisguiseManager.disguise(player, name);
Message.send(player, "messages.disguised", Map.of("player", NickAPI.getOriginalName(player), "nick", name));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public final class RitualHandler {
new Vector2d(-6, 0),
new Vector2d(-4, -4)
);
public static final NamespacedKey key = new NamespacedKey("kamoofsmp", "ritualstand");
static final AttributeModifier healthBoostModifier = new AttributeModifier(new NamespacedKey("kamoofsmp", "pacte"), KamoofSMP.config().getInt("ritual.pactes.bloody.hpboost"), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.ANY);
public static boolean setup = false;
public static Location location;
public static final NamespacedKey key = new NamespacedKey("kamoofsmp", "ritualstand");

public static void load() {
setup = false;
Expand Down Expand Up @@ -126,6 +126,8 @@ public static boolean isValidUUID(UUID uuid) {
public static void setPacte(Player player, String pacte) {
KamoofSMP.getData().set("pacte." + player.getUniqueId(), pacte);
KamoofSMP.saveData();
if (pacte == null)
return;
switch (pacte) {
case "1" -> {
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).addModifier(healthBoostModifier);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/me/ghosty/kamoof/utils/Lang.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ public enum Lang {
PREFIX + "§cCouldn't download/save the last version"
}),
NEW_VERSION(new String[]{
"<hover:show_text:'%s'><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ Nouvelle version disponible ! <yellow><bold>%s ➞ %s</hover>",
"<hover:show_text:'%s'><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ New version available! <yellow><bold>%s ➞ %s</hover>"
"<hover:show_text:\"%s\"><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ Nouvelle version disponible ! <yellow><bold>%s ➞ %s</hover>",
"<hover:show_text:\"%s\"><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ New version available! <yellow><bold>%s ➞ %s</hover>"
}),
NEW_VERSION_HOVER(new String[]{
"Dernière version: <bold>Version %s</bold><br><gold>Téléchargée %s fois<br><br><white>%s<br><yellow>Cliquez pour ouvrir la page de la version",
"Last version: <bold>Version %s</bold><br><gold>Downloaded %s times<br><br><white>%s<br><yellow>Click to open the version page"
}),
NEW_VERSION_DOWNLOADED(new String[]{
"<hover:show_text:'%s'><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ Nouvelle version téléchargée ! <yellow><bold>%s ➞ %s</hover><br><gold><bold><hover:show_text:'Clique pour relancer le serveur et avoir la mise à jour'><click:run_command:/restart>[RELANCER LE SERVEUR]",
"<hover:show_text:'%s'><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ New version downloaded ! <yellow><bold>%s ➞ %s</hover><br><gold><bold><hover:show_text:'Click to restart the server and get the update'><click:run_command:/restart>[RESTART THE SERVER]"
"<hover:show_text:\"%s\"><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ Nouvelle version téléchargée ! <yellow><bold>%s ➞ %s</hover><br><gold><bold><hover:show_text:'Clique pour relancer le serveur et avoir la mise à jour'><click:run_command:/restart>[RELANCER LE SERVEUR]",
"<hover:show_text:\"%s\"><click:open_url:'%s'><green><bold>[KamoofSMP]</bold> ➤ New version downloaded ! <yellow><bold>%s ➞ %s</hover><br><gold><bold><hover:show_text:'Click to restart the server and get the update'><click:run_command:/restart>[RESTART THE SERVER]"
}),
VERSION_CHANGELOG_REGEX(new String[]{
"Changements:((?!`).)+",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ drophead:
disguise:
# Le fait de pouvoir poser les têtes
place-head: true
# Le fait de rendre la tête au /undisguise et quand tu utilises une autre tête
give-back: false


restaure:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ main: me.ghosty.kamoof.KamoofSMP
commands:
kamoofsmp:
description: La commande principale du KamoofSMP
aliases: [kamoof]
aliases: [kamoof, camouf, camoufsmp]
givehead:
description: Se donner n'importe quelle tête
permission: kamoofsmp.admin
Expand Down

0 comments on commit 5ab0141

Please sign in to comment.