Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge MASTER to Final Spigot Release #684

Merged
merged 3 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

# Set up the Java Development Kit (JDK)
- name: Setup JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4.2.2
uses: actions/setup-java@v4.7.0
with:
java-version: ${{ matrix.java_version }}
distribution: 'zulu'
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>io.github.rypofalem.armorstandeditor</groupId>
<artifactId>armorstandeditor</artifactId>
<packaging>jar</packaging>
<version>1.21.4-48</version>
<version>1.21.4-48.1</version>
<name>armorstandeditor</name>
<url>https://maven.apache.org</url>

Expand Down Expand Up @@ -188,7 +188,7 @@
<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>SpigotUpdateChecker</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
<scope>compile</scope>
</dependency>
<!-- SuperiorSkyblock API -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,12 @@ public void onDisable() {
}

public String getNmsVersion() {
return this.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
// return this.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
if (getHasPaper() || getHasFolia()){
return this.getMinecraftVersion();
} else {
return this.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
}
}

public boolean getHasSpigot() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private void commandStats(Player player) {
leftLegZ = Math.toDegrees(leftLegZ);
leftLegZ = Math.rint(leftLegZ);

if (plugin.getServer().getMinecraftVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
if (plugin.getNmsVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
sizeAttribute = Objects.requireNonNull(as.getAttribute(Attribute.SCALE)).getBaseValue();
} else {
sizeAttribute = 0;
Expand Down Expand Up @@ -440,7 +440,7 @@ private void commandStats(Player player) {
player.sendMessage(ChatColor.YELLOW + "Coordinates: " + ChatColor.AQUA + " X: " + locationX + " / Y: " + locationY + " / Z: " + locationZ);
player.sendMessage(ChatColor.YELLOW + "Is Visible: " + ChatColor.AQUA + isVisible + ". " + ChatColor.YELLOW + "Arms Visible: " + ChatColor.AQUA + armsVisible + ". " + ChatColor.YELLOW + "Base Plate Visible: " + ChatColor.AQUA + basePlateVisible);
player.sendMessage(ChatColor.YELLOW + "Is Vulnerable: " + ChatColor.AQUA + isVulnerable + ". " + ChatColor.YELLOW + "Affected by Gravity: " + ChatColor.AQUA + hasGravity);
if (plugin.getServer().getMinecraftVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
if (plugin.getNmsVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
player.sendMessage(ChatColor.YELLOW + "Size: " + ChatColor.AQUA + sizeAttribute + "/" + plugin.getMaxScaleValue() + ". " + ChatColor.YELLOW + "Is Glowing: " + ChatColor.AQUA + isGlowing + ". " + ChatColor.YELLOW + "Is Locked: " + ChatColor.AQUA + isLocked);
} else {
player.sendMessage(ChatColor.YELLOW + "Is Small: " + ChatColor.AQUA + isSmall + ". " + ChatColor.YELLOW + "Is Glowing: " + ChatColor.AQUA + isGlowing + ". " + ChatColor.YELLOW + "Is Locked: " + ChatColor.AQUA + isLocked);
Expand Down Expand Up @@ -578,4 +578,4 @@ private List<String> getAdjOptions() {
return List.of("Coarse", "Fine");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private void openEquipment(ArmorStand armorStand) {
if(team != null && !team.hasEntry(armorStandInUseId.toString())){
debug.log("ArmorStand Not on a Team and Player '" + getPlayer().getDisplayName() + "' has triggered to Open the Equipment Menu, Adding to In Use Team");
team.addEntry(armorStandInUseId.toString());
getPlayer().closeInventory();
equipMenu = new EquipmentMenu(this, armorStand);
equipMenu.openMenu();
} else {
Expand All @@ -246,6 +247,7 @@ private void openEquipment(ArmorStand armorStand) {
private void choosePreset(ArmorStand armorStand) {
if (!getPlayer().hasPermission("asedit.basic")) return;
debug.log("Player '" + getPlayer().getDisplayName() + "' has triggered the Preset Poses Menu");
getPlayer().closeInventory();
presetPoseMenu = new PresetArmorPosesMenu(this, armorStand);
presetPoseMenu.openMenu();
}
Expand All @@ -256,9 +258,10 @@ private void chooseSize(ArmorStand armorStand){
sendMessage("nopermoption", "warn", "size");
return;
} else {
if (plugin.getServer().getMinecraftVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
if (plugin.getNmsVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
//NOTE: New Sizing Menu ONLY WORKS IN 1.21.3 and HIGHER
debug.log("Player '" + getPlayer().getDisplayName() + "' has triggered the AS Attribute Size Menu");
getPlayer().closeInventory();
sizeModificationMenu = new SizeMenu(this, armorStand);
sizeModificationMenu.openMenu();
} else {
Expand Down Expand Up @@ -391,7 +394,7 @@ private void paste(ArmorStand armorStand) {
armorStand.setLeftLegPose(data.leftLegPos);
armorStand.setRightLegPose(data.rightLegPos);

if (plugin.getServer().getMinecraftVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
if (plugin.getNmsVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
armorStand.getAttribute(Attribute.SCALE).setBaseValue(data.attributeScale);
} else {
armorStand.setSmall(data.size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ArmorStandData {
this.leftLegPos = as.getLeftLegPose();
this.rightLegPos = as.getRightLegPose();
this.size = as.isSmall();
if (plugin.getServer().getMinecraftVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
if (plugin.getNmsVersion().compareTo("1.21.4") >= 0 || plugin.getNmsVersion().compareTo("v1_21_R3") >= 0) {
this.attributeScale = as.getAttribute(Attribute.SCALE).getValue();
}
this.basePlate = as.hasBasePlate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,55 @@
package io.github.rypofalem.armorstandeditor.protections;

import com.palmergames.bukkit.towny.TownyAPI;
import com.palmergames.bukkit.towny.event.executors.TownyActionEventExecutor;

import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin;
import io.github.rypofalem.armorstandeditor.Debug;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;

//FIX for https://github.com/Wolfieheart/ArmorStandEditor-Issues/issues/15
public class TownyProtection implements Protection {
private final boolean tEnabled;
private Debug debug;
private ArmorStandEditorPlugin plugin;


public TownyProtection() {
plugin = ArmorStandEditorPlugin.instance();
debug = new Debug(plugin);
tEnabled = Bukkit.getPluginManager().isPluginEnabled("Towny");
}

public boolean checkPermission(Block block, Player player) {
TownyAPI towny;
if (!tEnabled) return true;
if (player.isOp()) return true;
if (player.hasPermission("asedit.ignoreProtection.towny")) return true; //Add Additional Permission

towny = TownyAPI.getInstance();
Location playerLoc = player.getLocation();
Location asLoc = block.getLocation();

if (TownyAPI.getInstance().isWilderness(playerLoc)) return false;
return TownyActionEventExecutor.canDestroy(player, block.getLocation(), Material.ARMOR_STAND);
if(towny.isWilderness(playerLoc) && player.hasPermission("asedit.townyProtection.canEditInWild")){
debug.log(" User is in the Wilderness and Can Edit.");
return true;
} else if(towny.isWilderness(playerLoc) && !player.hasPermission("asedit.townyProtection.canEditInWild")) {
player.sendMessage(plugin.getLang().getMessage("townyNoWildEdit","warn"));
return false;
}

Resident resident = towny.getResident(player);
TownBlock townBlock = towny.getTownBlock(asLoc);
Town town = townBlock.getTownOrNull();

if(resident == null || town == null) return true;
if(townBlock.hasResident(resident) || townBlock.hasTrustedResident(resident)) return true;
return town.hasResident(resident);
}
}

2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#-----------------------------#

#DO NOT CHANGE THIS - CHANGES AUTOMATICALLY PER UPDATE
version: "1.21.4-48"
version: "1.21.4-48.1"

#----------- LANGUAGE
#Name of the language file you wish to use
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/lang/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ noconsolecom:
msg: Sorry but this command only works from in-game and not from Console!
renamestopped:
msg: Please make sure you have the ability/permission to give your ArmorStand Colored Names.

townyNoWildEdit:
msg: Unable to change this ArmorStand as you are not allowed to edit in the wild.

#menutitle
mainmenutitle:
Expand Down Expand Up @@ -433,7 +434,7 @@ scaleremove12:
scaleadd110:
msg: Scale + 0.1 (Fine)
description:
msg: Remove 0.5 to the current Scale of your ArmorStand
msg: Add 0.1 to the current Scale of your ArmorStand
scaleremove110:
msg: Scale - 0.1 (Fine)
description:
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ArmorStandEditor
main: io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin
version: 1.21.4-48
version: 1.21.4-48.1
api-version: "1.17"
folia-supported: true
website: https://www.spigotmc.org/resources/94503/
Expand Down Expand Up @@ -124,6 +124,10 @@ permissions:
description: Allows user to ignore ItemAdder/LoneDev Protection Limitations.
default: false

asedit.townyProtection.canEditInWild:
description: Allows for editing in the Wilderness - ONLY use IF you have Towny
default: false

asedit.ignoreProtection.*:
description: Ignore all Protection Limitations
default: op
Expand Down
Loading