From 067bcad3c8deed185ff82e8a52d10b1fdc56fdb6 Mon Sep 17 00:00:00 2001 From: CatsT0day Date: Thu, 30 Apr 2026 18:36:03 +0300 Subject: [PATCH 1/2] added elytrafly command --- .idea/.gitignore | 10 +++ .idea/compiler.xml | 13 ++++ .idea/encodings.xml | 7 ++ .idea/jarRepositories.xml | 40 +++++++++++ .idea/misc.xml | 13 ++++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 ++ CMI-API.iml | 13 ++++ pom.xml | 1 - resources/plugin.yml | 2 +- src/com/Zrips/CMI/Containers/CMIUser.java | 27 ------- .../Zrips/CMI/commands/list/elytrafly.java | 70 +++++++++++++++++++ 12 files changed, 181 insertions(+), 29 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 CMI-API.iml create mode 100644 src/com/Zrips/CMI/commands/list/elytrafly.java diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..30cf57e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..5486482 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..8a1bdc0 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..df950dc --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..72428fd --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ae7aefd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CMI-API.iml b/CMI-API.iml new file mode 100644 index 0000000..3cf00db --- /dev/null +++ b/CMI-API.iml @@ -0,0 +1,13 @@ + + + + + + + PAPER + + 1 + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 85ac35d..155af55 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,6 @@ - maven-compiler-plugin 3.14.0 diff --git a/resources/plugin.yml b/resources/plugin.yml index 33a91f1..fd17b81 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -3,7 +3,7 @@ main: com.Zrips.CMI.CMI version: ${project.version} website: https://www.spigotmc.org/resources/content-management-interface.3742/ author: Zrips -description: Powerfull server management tool +description: Powerful server management tool softdepend: [Essentials, ProtocolLib, LWC, Vault, mcMMO, PlayerVaults, PermissionsEx, bPermissions, GroupManagerX, zPermissions, LuckPerms, PlaceholderAPI, Multiverse-Core] commands: cmi: diff --git a/src/com/Zrips/CMI/Containers/CMIUser.java b/src/com/Zrips/CMI/Containers/CMIUser.java index 9139864..53bf101 100644 --- a/src/com/Zrips/CMI/Containers/CMIUser.java +++ b/src/com/Zrips/CMI/Containers/CMIUser.java @@ -28,33 +28,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import com.Zrips.CMI.Modules.Afk.AfkInfo; -import com.Zrips.CMI.Modules.Chat.CMIPlayerMessageColor; -import com.Zrips.CMI.Modules.ChatFormat.CMIChatRoom; -import com.Zrips.CMI.Modules.CmdCooldown.CmdCooldown; -import com.Zrips.CMI.Modules.DeathMessages.damageInformation; -import com.Zrips.CMI.Modules.Economy.CMIEconomyAcount; -import com.Zrips.CMI.Modules.FlightCharge.FlightCharge; -import com.Zrips.CMI.Modules.Homes.CmiHome; -import com.Zrips.CMI.Modules.Jail.CMIJail; -import com.Zrips.CMI.Modules.Jail.CMIJailCell; -import com.Zrips.CMI.Modules.Kits.Kit; -import com.Zrips.CMI.Modules.Permissions.PermissionsManager.CMIPerm; -import com.Zrips.CMI.Modules.PlayTime.CMIPlayTime; -import com.Zrips.CMI.Modules.PlayTimeRewards.PTROneTime; -import com.Zrips.CMI.Modules.PlayerCombat.EntityKillCount; -import com.Zrips.CMI.Modules.PlayerCombat.PlayerKillCount; -import com.Zrips.CMI.Modules.PlayerMeta.PlayerMeta; -import com.Zrips.CMI.Modules.PlayerOptions.PlayerOption; -import com.Zrips.CMI.Modules.Ranks.CMIRank; -import com.Zrips.CMI.Modules.SavedInv.SavedInventories; -import com.Zrips.CMI.Modules.SpawnerCharge.PlayerCharge; -import com.Zrips.CMI.Modules.Statistics.StatsManager.CMIStatistic; -import com.Zrips.CMI.Modules.Teleportations.CMITeleportFeedback; -import com.Zrips.CMI.Modules.Teleportations.CMITeleportType; -import com.Zrips.CMI.Modules.Warnings.CMIPlayerWarning; -import com.Zrips.CMI.Modules.Warnings.CMIWarningCategory; -import com.Zrips.CMI.events.CMIAfkEnterEvent.AfkType; import net.Zrips.CMILib.BossBar.BossBarInfo; import net.Zrips.CMILib.Colors.CMIChatColor; diff --git a/src/com/Zrips/CMI/commands/list/elytrafly.java b/src/com/Zrips/CMI/commands/list/elytrafly.java new file mode 100644 index 0000000..ca137a1 --- /dev/null +++ b/src/com/Zrips/CMI/commands/list/elytrafly.java @@ -0,0 +1,70 @@ +package com.Zrips.CMI.commands.list; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import com.Zrips.CMI.CMI; +import com.Zrips.CMI.Containers.CMIUser; +import com.Zrips.CMI.commands.CAnnotation; +import com.Zrips.CMI.commands.Cmd; +import net.Zrips.CMILib.FileHandler.ConfigReader; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + +public class elytrafly implements Cmd { + + @Override + public void getExtra(ConfigReader var1) { + var1.get("ElytraRequired", "{gcw}&cYou must wear an elytra to use /efly"); // Zrips, put msgs that you need here + var1.get("flyToggled", "{gcp}Elytra flight [status]&p!"); // Zrips, put msgs that you need here + } + + @Override + @CAnnotation( + info = "Toggle flight mode specifically for Elytra users", + args = "([on/off])", + tab = {"on", "off"}, + explanation = {"Enables or disables flight, but only if the player is wearing an Elytra."}, + others = true + ) + public Boolean perform(CMI plugin, CommandSender sender, String[] args) { + if (!(sender instanceof Player)) { + return false; + } + + Player player = (Player) sender; + CMIUser user = plugin.getPlayerManager().getUser(player); + + ItemStack chest = player.getInventory().getChestplate(); + CMIItemStack cmiChest = new CMIItemStack(chest); + + if (chest == null || cmiChest.getCMIType() != CMIMaterial.ELYTRA) { + com.Zrips.CMI.Locale.CMILC.info(this, sender, "ElytraRequired"); + return false; + } + + boolean newState = !player.getAllowFlight(); + + if (args.length > 0) { + if (args[0].equalsIgnoreCase("on")) { + newState = true; + } else if (args[0].equalsIgnoreCase("off")) { + newState = false; + } + } + + player.setAllowFlight(newState); + if (!newState) { + player.setFlying(false); + } + + String status = newState ? CMIMessages.getMsg(LC.info_variables_Enabled) : CMIMessages.getMsg(LC.info_variables_Disabled); + + com.Zrips.CMI.Locale.CMILC.info(this, sender, "flyToggled", "[status]", status, "[playerName]", user.getDisplayName()); + + return true; + } +} \ No newline at end of file From acccacc3b37e6fb216236956e236e5f86edb528a Mon Sep 17 00:00:00 2001 From: CatsT0day Date: Mon, 4 May 2026 18:50:45 +0300 Subject: [PATCH 2/2] Update elytrafly.java --- .../Zrips/CMI/commands/list/elytrafly.java | 96 +++++++++++++------ 1 file changed, 65 insertions(+), 31 deletions(-) diff --git a/src/com/Zrips/CMI/commands/list/elytrafly.java b/src/com/Zrips/CMI/commands/list/elytrafly.java index ca137a1..6e58e47 100644 --- a/src/com/Zrips/CMI/commands/list/elytrafly.java +++ b/src/com/Zrips/CMI/commands/list/elytrafly.java @@ -1,70 +1,104 @@ package com.Zrips.CMI.commands.list; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import com.Zrips.CMI.CMI; import com.Zrips.CMI.Containers.CMIUser; +import com.Zrips.CMI.Containers.Snd; +import com.Zrips.CMI.Locale.CMILC; +import com.Zrips.CMI.Modules.Permissions.PermissionsManager.CMIPerm; import com.Zrips.CMI.commands.CAnnotation; import com.Zrips.CMI.commands.Cmd; import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIMaterial; -import net.Zrips.CMILib.Locale.LC; -import net.Zrips.CMILib.Messages.CMIMessages; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class elytrafly implements Cmd { + public elytrafly() { + } + @Override - public void getExtra(ConfigReader var1) { - var1.get("ElytraRequired", "{gcw}&cYou must wear an elytra to use /efly"); // Zrips, put msgs that you need here - var1.get("flyToggled", "{gcp}Elytra flight [status]&p!"); // Zrips, put msgs that you need here + public void getExtra(ConfigReader reader) { + reader.get("ElytraRequired", "{gcw}&cYou must wear an elytra to use this command!"); + reader.get("feedback", "{gcp}You have set elytra fly to {gcs}[boolean]{gcp} for {gcs}[playerDisplayName]{gcp}."); + reader.get("targetFeedback", "{gcp}Your elytra fly mode set to {gcs}[boolean]{gcp} by {gcs}[senderDisplayName]{gcp}."); } @Override @CAnnotation( info = "Toggle flight mode specifically for Elytra users", - args = "([on/off])", - tab = {"on", "off"}, - explanation = {"Enables or disables flight, but only if the player is wearing an Elytra."}, + args = "[playerName] (true/false) (-s)", + regVar = {0, 1, 2}, others = true ) public Boolean perform(CMI plugin, CommandSender sender, String[] args) { - if (!(sender instanceof Player)) { - return false; + boolean silent = false; + String targetName = null; + Boolean state = null; + + for (String arg : args) { + if (arg.equalsIgnoreCase("-s")) { + if (CMIPerm.command_silent.hasPermission(sender)) { + silent = true; + } + continue; + } + if (arg.equalsIgnoreCase("true") || arg.equalsIgnoreCase("on") || arg.equalsIgnoreCase("t")) { + state = true; + continue; + } + if (arg.equalsIgnoreCase("false") || arg.equalsIgnoreCase("off") || arg.equalsIgnoreCase("f")) { + state = false; + continue; + } + targetName = arg; } - Player player = (Player) sender; - CMIUser user = plugin.getPlayerManager().getUser(player); + Player player = plugin.getTarget(sender, targetName, this); + if (player == null) { + return null; + } ItemStack chest = player.getInventory().getChestplate(); CMIItemStack cmiChest = new CMIItemStack(chest); - if (chest == null || cmiChest.getCMIType() != CMIMaterial.ELYTRA) { - com.Zrips.CMI.Locale.CMILC.info(this, sender, "ElytraRequired"); + CMILC.info(this, sender, "ElytraRequired"); return false; } - boolean newState = !player.getAllowFlight(); - - if (args.length > 0) { - if (args[0].equalsIgnoreCase("on")) { - newState = true; - } else if (args[0].equalsIgnoreCase("off")) { - newState = false; - } + if (state == null) { + state = !player.getAllowFlight(); } - player.setAllowFlight(newState); - if (!newState) { + player.setFallDistance(0.0F); + player.setAllowFlight(state); + if (!state) { player.setFlying(false); } - String status = newState ? CMIMessages.getMsg(LC.info_variables_Enabled) : CMIMessages.getMsg(LC.info_variables_Disabled); + CMIUser user = plugin.getPlayerManager().getUser(player); + if (user != null) { + user.setTfly(0L); + if (!user.isOnline()) { + user.setHadAllowFlight(state); + user.setWasFlying(state); + user.setFlying(state); + } + } + + plugin.save(player); - com.Zrips.CMI.Locale.CMILC.info(this, sender, "flyToggled", "[status]", status, "[playerName]", user.getDisplayName()); + Snd snd = new Snd().setSender(sender).setTarget(player); + if (!silent) { + CMILC.info(this, sender, "feedback", snd, "[boolean]", state); + } + + if (!player.getName().equalsIgnoreCase(sender.getName()) && !silent) { + CMILC.info(this, player, "targetFeedback", "[boolean]", state, snd); + } return true; } -} \ No newline at end of file +}