3
0
Mirror von https://github.com/St3venAU/ArmorStandTools.git synchronisiert 2024-12-27 12:00:07 +01:00

Merge pull request #35 from Lost-Fables/master

1.16 Update & Maven Conversion
Dieser Commit ist enthalten in:
St3venAU 2020-11-13 21:05:53 +08:00 committet von GitHub
Commit d2cfb114f8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
24 geänderte Dateien mit 285 neuen und 31 gelöschten Zeilen

128
.gitignore vendored
Datei anzeigen

@ -1,8 +1,122 @@
.idea/
libs/
out/
ArmorStand.iml
/bin/
### Java template
target/classes/io/github/archemedes/knockoutplus/corpse/CorpseRegistry.class
/.idea
*.project
.classpath
# Mobile Tools for Java (J2ME)
.mtj.tmp/
/knockoutplus.iml
# Package Files #
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Eclipse template
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries
# Mongo Explorer plugin:
.idea/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# Created by .ignore support plugin (hsz.mobi)

Datei anzeigen

@ -9,7 +9,7 @@ I wanted to create an armor stand for each kit in my mini-game, and I quickly be
Compatibility
-------------
- Armor Stand Tools v3.x.x - Spigot/CraftBukkit 1.13 to 1.15 only
- Armor Stand Tools v3.x.x - Spigot/CraftBukkit 1.13 to 1.16.4 only
- Armor Stand Tools v2.4.3 - Spigot/CraftBukkit 1.8, 1.9, 1.10, 1.11, 1.12 (https://www.spigotmc.org/resources/armor-stand-tools.2237/download?version=175162)
Features

80
pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.St3venAU.plugins</groupId>
<artifactId>ArmorStandTools</artifactId>
<version>3.7.0</version>
<name>ArmorStandTools</name>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<!-- WorldEdit -->
<repository>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<!-- PlotSquared -->
<repository>
<id>IntellectualSites</id>
<url>https://mvn.intellectualsites.com/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- PlotSquared Core API -->
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>PlotSquared-Core</artifactId>
<version>5.13.0</version>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package install</defaultGoal>
<sourceDirectory>src/main/java</sourceDirectory>
<finalName>${project.name}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

Datei anzeigen

@ -4,6 +4,7 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -24,7 +25,7 @@ import java.util.logging.Level;
public class Main extends JavaPlugin {
private static final String LATEST_VERSION = "v1_14_R1";
private static final String LATEST_VERSION = "v1_16_R4";
private static Object WG_AST_FLAG;
@ -172,7 +173,7 @@ public class Main extends JavaPlugin {
p.sendMessage(ChatColor.RED + Config.noAirError);
return;
}
b.setType(Material.SIGN);
b.setType(Material.OAK_SIGN);
nms.openSign(p, b);
b.setMetadata("armorStand", new FixedMetadataValue(this, as.getUniqueId()));
b.setMetadata("setName", new FixedMetadataValue(this, true));
@ -184,7 +185,7 @@ public class Main extends JavaPlugin {
p.sendMessage(ChatColor.RED + Config.noAirError);
return;
}
b.setType(Material.SIGN);
b.setType(Material.OAK_SIGN);
nms.openSign(p, b);
b.setMetadata("armorStand", new FixedMetadataValue(this, as.getUniqueId()));
b.setMetadata("setSkull", new FixedMetadataValue(this, true));
@ -212,9 +213,14 @@ public class Main extends JavaPlugin {
}
private boolean getWorldGuardAstFlag(Location l) {
RegionManager regions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(BukkitAdapter.adapt(l.getWorld()));
if(regions == null) return true;
return regions.getApplicableRegions(BukkitAdapter.asBlockVector(l)).testState(null, (StateFlag) WG_AST_FLAG);
if (l != null) {
RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionManager regions = regionContainer.get(BukkitAdapter.adapt(l.getWorld()));
if (regions == null) return true;
return regions.getApplicableRegions(BukkitAdapter.asBlockVector(l)).testState(null, (StateFlag) WG_AST_FLAG);
} else {
return false;
}
}
boolean playerHasPermission(Player p, Block b, ArmorStandTool tool) {

Datei anzeigen

@ -424,7 +424,7 @@ public class MainListener implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block b = event.getBlock();
if((b.getType() == Material.PLAYER_HEAD && b.hasMetadata("protected")) || (b.getType() == Material.SIGN && b.hasMetadata("armorStand"))) {
if((b.getType() == Material.PLAYER_HEAD && b.hasMetadata("protected")) || (b.getType() == Material.OAK_SIGN && b.hasMetadata("armorStand"))) {
event.setCancelled(true);
}
}

Datei anzeigen

@ -165,10 +165,10 @@ abstract class NMS {
+ (as.getCustomName() == null ? "" : ("CustomName:\"\\\"" + as.getCustomName() + "\\\"\",") )
+ (as.getLocation().getYaw() == 0F ? "" : ("Rotation:[" + Utils.twoDec(as.getLocation().getYaw()) + "f],"))
+ "ArmorItems:["
+ (as.getBoots() == null ? "{}," : ("{id:" + as.getBoots().getType().getKey().getKey() + ",Count:" + as.getBoots().getAmount() + ",tag:{Damage:" + as.getBoots().getDurability() + getItemStackTags(as.getBoots()) + "}},"))
+ (as.getLeggings() == null ? "{}," : ("{id:" + as.getLeggings().getType().getKey().getKey() + ",Count:" + as.getLeggings().getAmount() + ",tag:{Damage:" + as.getLeggings().getDurability() + getItemStackTags(as.getLeggings()) + "}},"))
+ (as.getChestplate() == null ? "{}," : ("{id:" + as.getChestplate().getType().getKey().getKey() + ",Count:" + as.getChestplate().getAmount() + ",tag:{Damage:" + as.getChestplate().getDurability() + getItemStackTags(as.getChestplate()) + "}},"))
+ (as.getHelmet() == null ? "{}" : ("{id:" + as.getHelmet().getType().getKey().getKey() + ",Count:" + as.getHelmet().getAmount() + ",tag:{Damage:" + as.getHelmet().getDurability() + getItemStackTags(as.getHelmet()) + skullOwner(as.getHelmet()) + "}}" ))
+ (as.getEquipment() != null && as.getEquipment().getBoots() == null ? "{}," : ("{id:" + as.getEquipment().getBoots().getType().getKey().getKey() + ",Count:" + as.getEquipment().getBoots().getAmount() + ",tag:{Damage:" + as.getEquipment().getBoots().getDurability() + getItemStackTags(as.getEquipment().getBoots()) + "}},"))
+ (as.getEquipment() != null && as.getEquipment().getLeggings() == null ? "{}," : ("{id:" + as.getEquipment().getLeggings().getType().getKey().getKey() + ",Count:" + as.getEquipment().getLeggings().getAmount() + ",tag:{Damage:" + as.getEquipment().getLeggings().getDurability() + getItemStackTags(as.getEquipment().getLeggings()) + "}},"))
+ (as.getEquipment() != null && as.getEquipment().getChestplate() == null ? "{}," : ("{id:" + as.getEquipment().getChestplate().getType().getKey().getKey() + ",Count:" + as.getEquipment().getChestplate().getAmount() + ",tag:{Damage:" + as.getEquipment().getChestplate().getDurability() + getItemStackTags(as.getEquipment().getChestplate()) + "}},"))
+ (as.getEquipment() != null && as.getEquipment().getHelmet() == null ? "{}" : ("{id:" + as.getEquipment().getHelmet().getType().getKey().getKey() + ",Count:" + as.getEquipment().getHelmet().getAmount() + ",tag:{Damage:" + as.getEquipment().getHelmet().getDurability() + getItemStackTags(as.getEquipment().getHelmet()) + skullOwner(as.getEquipment().getHelmet()) + "}}" ))
+ "],"
+ "HandItems:["
+ (as.getEquipment().getItemInMainHand() == null ? "{}," : ("{id:" + as.getEquipment().getItemInMainHand().getType().getKey().getKey() + ",Count:" + as.getEquipment().getItemInMainHand().getAmount() + ",tag:{Damage:" + as.getEquipment().getItemInMainHand().getDurability() + getItemStackTags(as.getEquipment().getItemInMainHand()) + "}},"))
@ -190,10 +190,10 @@ abstract class NMS {
ArmorStand clone(ArmorStand as) {
ArmorStand clone = (ArmorStand) as.getWorld().spawnEntity(as.getLocation().add(1, 0, 0), EntityType.ARMOR_STAND);
clone.setGravity(as.hasGravity());
clone.setHelmet(as.getHelmet());
clone.setChestplate(as.getChestplate());
clone.setLeggings(as.getLeggings());
clone.setBoots(as.getBoots());
clone.getEquipment().setHelmet(as.getEquipment().getHelmet());
clone.getEquipment().setChestplate(as.getEquipment().getChestplate());
clone.getEquipment().setLeggings(as.getEquipment().getLeggings());
clone.getEquipment().setBoots(as.getEquipment().getBoots());
clone.getEquipment().setItemInMainHand(as.getEquipment().getItemInMainHand());
clone.getEquipment().setItemInOffHand(as.getEquipment().getItemInOffHand());
clone.setHeadPose(as.getHeadPose());

Datei anzeigen

@ -0,0 +1,13 @@
package com.gmail.St3venAU.plugins.ArmorStandTools;
@SuppressWarnings("unused")
class NMS_v1_16_R1 extends NMS {
public NMS_v1_16_R1(String nmsVersion) {
super(
nmsVersion,
"bA"
);
}
}

Datei anzeigen

@ -0,0 +1,13 @@
package com.gmail.St3venAU.plugins.ArmorStandTools;
@SuppressWarnings("unused")
class NMS_v1_16_R2 extends NMS {
public NMS_v1_16_R2(String nmsVersion) {
super(
nmsVersion,
"bv"
);
}
}

Datei anzeigen

@ -0,0 +1,13 @@
package com.gmail.St3venAU.plugins.ArmorStandTools;
@SuppressWarnings("unused")
class NMS_v1_16_R3 extends NMS {
public NMS_v1_16_R3(String nmsVersion) {
super(
nmsVersion,
"disabledSlots"
);
}
}

Datei anzeigen

@ -0,0 +1,13 @@
package com.gmail.St3venAU.plugins.ArmorStandTools;
@SuppressWarnings("unused")
class NMS_v1_16_R4 extends NMS {
public NMS_v1_16_R4(String nmsVersion) {
super(
nmsVersion,
"disabledSlots"
);
}
}

Datei anzeigen

@ -1,10 +1,9 @@
package com.gmail.St3venAU.plugins.ArmorStandTools;
import com.github.intellectualsites.plotsquared.api.PlotAPI;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.plotsquared.core.api.PlotAPI;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -25,7 +24,10 @@ class PlotSquaredHook {
}
public static boolean checkPermission(Player player, Location location) {
com.github.intellectualsites.plotsquared.plot.object.Location plotLocation = BukkitUtil.getLocation(location);
com.plotsquared.core.location.Location plotLocation = new com.plotsquared.core.location.Location(location.getWorld().getName(),
location.getBlockX(),
location.getBlockY(),
location.getBlockZ());
PlotArea plotArea = plotLocation.getPlotArea();
if(plotArea == null) {
plugin.debug("plots.admin.build.road: " + player.hasPermission("plots.admin.build.road"));

Datei anzeigen

@ -1,7 +1,7 @@
main: com.gmail.St3venAU.plugins.ArmorStandTools.Main
name: ArmorStandTools
version: 3.5.0
api-version: 1.15
version: ${project.version}
api-version: 1.16
author: St3venAU
description: Armor stand manipulation tools
softdepend: [WorldGuard, PlotSquared]