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