Update to 1.14 in a backwards compatible way.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.drtshock</groupId>
|
||||
<artifactId>PlayerVaultsX</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<version>4.1.2</version>
|
||||
<name>PlayerVaultsX</name>
|
||||
<url>https://www.spigotmc.org/resources/51204/</url>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.14-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryInteractEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -388,12 +389,13 @@ public class PlayerVaults extends JavaPlugin {
|
||||
*/
|
||||
public String getVersion() {
|
||||
if (_versionString == null) {
|
||||
if (Bukkit.getServer() == null) {
|
||||
return null;
|
||||
}
|
||||
final String name = Bukkit.getServer().getClass().getPackage().getName();
|
||||
_versionString = name.substring(name.lastIndexOf(46) + 1) + ".";
|
||||
}
|
||||
return _versionString;
|
||||
}
|
||||
|
||||
public boolean isSign(Material mat) {
|
||||
return mat.name().toUpperCase().contains("SIGN");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class Listeners implements Listener {
|
||||
VaultViewInfo info = PlayerVaults.getInstance().getInVault().get(player.getUniqueId().toString());
|
||||
if (info != null) {
|
||||
int num = info.getNumber();
|
||||
String inventoryTitle = clickedInventory.getTitle();
|
||||
String inventoryTitle = event.getView().getTitle();
|
||||
String title = Lang.VAULT_TITLE.toString().replace("%number", String.valueOf(num)).replace("%p", info.getVaultName());
|
||||
if (((inventoryTitle != null && inventoryTitle.equalsIgnoreCase(title)) || event.getCurrentItem() != null)) {
|
||||
if (PlayerVaults.getInstance().isBlockedMaterial(event.getCurrentItem().getType())) {
|
||||
@@ -144,7 +144,7 @@ public class Listeners implements Listener {
|
||||
VaultViewInfo info = PlayerVaults.getInstance().getInVault().get(player.getUniqueId().toString());
|
||||
if (info != null) {
|
||||
int num = info.getNumber();
|
||||
String inventoryTitle = clickedInventory.getTitle();
|
||||
String inventoryTitle = event.getView().getTitle();
|
||||
String title = Lang.VAULT_TITLE.toString().replace("%number", String.valueOf(num)).replace("%p", info.getVaultName());
|
||||
if ((inventoryTitle != null && inventoryTitle.equalsIgnoreCase(title)) && event.getNewItems() != null) {
|
||||
for (ItemStack item : event.getNewItems().values()) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SignListener implements Listener {
|
||||
PlayerVaults.getInstance().getSetSign().remove(player.getName());
|
||||
event.setCancelled(true);
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (isValidSign(block.getType())) {
|
||||
if (block != null && plugin.isSign(block.getType())) {
|
||||
Sign s = (Sign) block.getState();
|
||||
Location l = s.getLocation();
|
||||
String world = l.getWorld().getName();
|
||||
@@ -91,7 +91,7 @@ public class SignListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (isValidSign(block.getType())) {
|
||||
if (block != null && plugin.isSign(block.getType())) {
|
||||
Location l = block.getLocation();
|
||||
String world = l.getWorld().getName();
|
||||
int x = l.getBlockX();
|
||||
@@ -172,15 +172,6 @@ public class SignListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidSign(Material material) {
|
||||
if (PlayerVaults.getInstance().getVersion().contains("v1_13")) {
|
||||
PlayerVaults.debug("[PlayerVaults] [Debug/SignListener] Sign material checked for >= 1.13");
|
||||
return material == Material.SIGN || material == Material.WALL_SIGN;
|
||||
}
|
||||
PlayerVaults.debug("[PlayerVaults] [Debug/SignListener] Sign material checked for < 1.13");
|
||||
return material == Material.valueOf("SIGN_POST") || material == Material.WALL_SIGN;
|
||||
}
|
||||
|
||||
private boolean isInvalidBlock(Material material) {
|
||||
if (PlayerVaults.getInstance().getVersion().contains("v1_13")) {
|
||||
PlayerVaults.debug("[PlayerVaults] [Debug/SignListener] Block material checked for >= 1.13");
|
||||
|
||||
Reference in New Issue
Block a user