mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-25 02:27:44 +01:00
Added basic 1.14 """"""support"""""".
Addons are NOT compatible with 1.14. Both 1.14 and 1.14.1 are now considered "NOT_SUPPORTED"
This commit is contained in:
parent
bcc5af1758
commit
1207a05d3f
@ -8,15 +8,17 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
import world.bentobox.bentobox.listeners.PanelListenerManager;
|
import world.bentobox.bentobox.listeners.PanelListenerManager;
|
||||||
import world.bentobox.bentobox.util.heads.HeadGetter;
|
import world.bentobox.bentobox.util.heads.HeadGetter;
|
||||||
import world.bentobox.bentobox.util.heads.HeadRequester;
|
import world.bentobox.bentobox.util.heads.HeadRequester;
|
||||||
|
|
||||||
public class Panel implements HeadRequester {
|
public class Panel implements HeadRequester, InventoryHolder {
|
||||||
|
|
||||||
private Inventory inventory;
|
private Inventory inventory;
|
||||||
private Map<Integer, PanelItem> items;
|
private Map<Integer, PanelItem> items;
|
||||||
@ -62,6 +64,8 @@ public class Panel implements HeadRequester {
|
|||||||
if (user != null) this.open(user);
|
if (user != null) this.open(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.event.inventory.InventoryType.SlotType;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.InventoryView;
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.panels.Panel;
|
import world.bentobox.bentobox.api.panels.Panel;
|
||||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||||
@ -25,11 +26,11 @@ public class PanelListenerManager implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
User user = User.getInstance(event.getWhoClicked()); // The player that clicked the item
|
User user = User.getInstance(event.getWhoClicked()); // The player that clicked the item
|
||||||
Inventory inventory = event.getInventory(); // The inventory that was clicked on
|
InventoryView view = event.getView();
|
||||||
// Open the inventory panel that this player has open (they can only ever have one)
|
// Open the inventory panel that this player has open (they can only ever have one)
|
||||||
if (openPanels.containsKey(user.getUniqueId())) {
|
if (openPanels.containsKey(user.getUniqueId())) {
|
||||||
// Check the name of the panel
|
// Check the name of the panel
|
||||||
if (inventory.getName().equals(openPanels.get(user.getUniqueId()).getInventory().getName())) {
|
if (view.getTitle().equals(openPanels.get(user.getUniqueId()).getName())) {
|
||||||
// Close inventory if clicked outside and if setting is true
|
// Close inventory if clicked outside and if setting is true
|
||||||
if (BentoBox.getInstance().getSettings().isClosePanelOnClickOutside() && event.getSlotType().equals(SlotType.OUTSIDE)) {
|
if (BentoBox.getInstance().getSettings().isClosePanelOnClickOutside() && event.getSlotType().equals(SlotType.OUTSIDE)) {
|
||||||
event.getWhoClicked().closeInventory();
|
event.getWhoClicked().closeInventory();
|
||||||
|
@ -124,7 +124,7 @@ public class PortalTeleportationListener implements Listener {
|
|||||||
if (fromWorld.getEnvironment() != Environment.NETHER) {
|
if (fromWorld.getEnvironment() != Environment.NETHER) {
|
||||||
// To Standard Nether
|
// To Standard Nether
|
||||||
e.setTo(plugin.getIWM().getNetherWorld(overWorld).getSpawnLocation());
|
e.setTo(plugin.getIWM().getNetherWorld(overWorld).getSpawnLocation());
|
||||||
e.useTravelAgent(true);
|
// e.useTravelAgent(true); - No longer available in 1.14
|
||||||
}
|
}
|
||||||
// From standard nether
|
// From standard nether
|
||||||
else {
|
else {
|
||||||
|
@ -23,7 +23,7 @@ public class DyeListener extends FlagListener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(final PlayerInteractEvent e) {
|
public void onPlayerInteract(final PlayerInteractEvent e) {
|
||||||
if (!ServerCompatibility.getInstance().isVersion(ServerCompatibility.ServerVersion.V1_14)) {
|
if (!ServerCompatibility.getInstance().isVersion(ServerCompatibility.ServerVersion.V1_14, ServerCompatibility.ServerVersion.V1_14_1)) {
|
||||||
// We're disabling this check for non-1.14 servers.
|
// We're disabling this check for non-1.14 servers.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -226,13 +226,13 @@ public class IslandsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ground.getType().equals(Material.CACTUS) || ground.getType().toString().contains("BOAT") || ground.getType().toString().contains("FENCE")
|
if (ground.getType().equals(Material.CACTUS) || ground.getType().toString().contains("BOAT") || ground.getType().toString().contains("FENCE")
|
||||||
|| ground.getType().equals(Material.SIGN) || ground.getType().equals(Material.WALL_SIGN)) {
|
|| ground.getType().toString().contains("SIGN")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check that the space is not solid
|
// Check that the space is not solid
|
||||||
// The isSolid function is not fully accurate (yet) so we have to check a few other items
|
// The isSolid function is not fully accurate (yet) so we have to check a few other items
|
||||||
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
|
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
|
||||||
return (!space1.getType().isSolid() || space1.getType().equals(Material.SIGN) || space1.getType().equals(Material.WALL_SIGN)) && (!space2.getType().isSolid() || space2.getType().equals(Material.SIGN) || space2.getType().equals(Material.WALL_SIGN));
|
return (!space1.getType().isSolid() || space1.getType().toString().contains("SIGN")) && (!space2.getType().isSolid() || space2.getType().equals(Material.SIGN) || space2.getType().equals(Material.WALL_SIGN));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,14 +53,14 @@ public class SettingsPanel {
|
|||||||
// Add forward and backward icons
|
// Add forward and backward icons
|
||||||
if (page > 0) {
|
if (page > 0) {
|
||||||
// Previous page icon
|
// Previous page icon
|
||||||
panelBuilder.item(new PanelItemBuilder().icon(Material.SIGN).name(user.getTranslation(PROTECTION_PANEL + "previous")).clickHandler((panel, user1, clickType, slot1) -> {
|
panelBuilder.item(new PanelItemBuilder().icon(Material.ARROW).name(user.getTranslation(PROTECTION_PANEL + "previous")).clickHandler((panel, user1, clickType, slot1) -> {
|
||||||
openPanel(BentoBox.getInstance(), user, flagType, world, page - 1);
|
openPanel(BentoBox.getInstance(), user, flagType, world, page - 1);
|
||||||
return true;
|
return true;
|
||||||
}).build());
|
}).build());
|
||||||
}
|
}
|
||||||
if ((page + 1) * 44 < flags.size()) {
|
if ((page + 1) * 44 < flags.size()) {
|
||||||
// Next page icon
|
// Next page icon
|
||||||
panelBuilder.item(new PanelItemBuilder().icon(Material.SIGN).name(user.getTranslation(PROTECTION_PANEL + "next")).clickHandler((panel, user1, clickType, slot1) -> {
|
panelBuilder.item(new PanelItemBuilder().icon(Material.ARROW).name(user.getTranslation(PROTECTION_PANEL + "next")).clickHandler((panel, user1, clickType, slot1) -> {
|
||||||
openPanel(BentoBox.getInstance(), user, flagType, world, page + 1);
|
openPanel(BentoBox.getInstance(), user, flagType, world, page + 1);
|
||||||
return true;
|
return true;
|
||||||
}).build());
|
}).build());
|
||||||
|
@ -276,7 +276,8 @@ public class SafeSpotTeleport {
|
|||||||
Material space1 = chunk.getBlockType(x, Math.min(y + 1, worldHeight), z);
|
Material space1 = chunk.getBlockType(x, Math.min(y + 1, worldHeight), z);
|
||||||
Material space2 = chunk.getBlockType(x, Math.min(y + 2, worldHeight), z);
|
Material space2 = chunk.getBlockType(x, Math.min(y + 2, worldHeight), z);
|
||||||
if ((space1.equals(Material.AIR) && space2.equals(Material.AIR)) || (space1.equals(Material.NETHER_PORTAL) && space2.equals(Material.NETHER_PORTAL))
|
if ((space1.equals(Material.AIR) && space2.equals(Material.AIR)) || (space1.equals(Material.NETHER_PORTAL) && space2.equals(Material.NETHER_PORTAL))
|
||||||
&& (!type.toString().contains("FENCE") && !type.toString().contains("DOOR") && !type.toString().contains("GATE") && !type.toString().contains("PLATE"))) {
|
&& (!type.toString().contains("FENCE") && !type.toString().contains("DOOR") && !type.toString().contains("GATE") && !type.toString().contains("PLATE")
|
||||||
|
&& !type.toString().contains("SIGN"))) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
// Unsafe
|
// Unsafe
|
||||||
case ANVIL:
|
case ANVIL:
|
||||||
@ -291,7 +292,6 @@ public class SafeSpotTeleport {
|
|||||||
case TALL_GRASS:
|
case TALL_GRASS:
|
||||||
case PISTON_HEAD:
|
case PISTON_HEAD:
|
||||||
case MOVING_PISTON:
|
case MOVING_PISTON:
|
||||||
case SIGN:
|
|
||||||
case STONE_BUTTON:
|
case STONE_BUTTON:
|
||||||
case TORCH:
|
case TORCH:
|
||||||
case TRIPWIRE:
|
case TRIPWIRE:
|
||||||
|
@ -4,6 +4,8 @@ import org.bukkit.Bukkit;
|
|||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks and ensures the current server software is compatible with BentoBox.
|
* Checks and ensures the current server software is compatible with BentoBox.
|
||||||
* @author Poslovitch
|
* @author Poslovitch
|
||||||
@ -95,7 +97,11 @@ public class ServerCompatibility {
|
|||||||
/**
|
/**
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
V1_14(Compatibility.INCOMPATIBLE);
|
V1_14(Compatibility.NOT_SUPPORTED),
|
||||||
|
/**
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
V1_14_1(Compatibility.NOT_SUPPORTED);
|
||||||
|
|
||||||
private Compatibility compatibility;
|
private Compatibility compatibility;
|
||||||
|
|
||||||
@ -188,22 +194,22 @@ public class ServerCompatibility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the server runs on the specified version.
|
* Returns whether the server runs on the specified versions.
|
||||||
* @param version the {@link ServerVersion} to check.
|
* @param versions the {@link ServerVersion}s to check.
|
||||||
* @return {@code true} if the server runs on this version, {@code false} otherwise.
|
* @return {@code true} if the server runs on one of the specified versions, {@code false} otherwise.
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public boolean isVersion(@NonNull ServerVersion version) {
|
public boolean isVersion(@NonNull ServerVersion... versions) {
|
||||||
return version.equals(getServerVersion());
|
return Arrays.asList(versions).contains(getServerVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the server runs on the specified software.
|
* Returns whether the server runs on the specified softwares.
|
||||||
* @param software the {@link ServerSoftware} to check.
|
* @param softwares the {@link ServerSoftware}s to check.
|
||||||
* @return {@code true} if the server runs on this software, {@code false} otherwise.
|
* @return {@code true} if the server runs on on of these softwares, {@code false} otherwise.
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public boolean isSoftware(@NonNull ServerSoftware software) {
|
public boolean isSoftware(@NonNull ServerSoftware... softwares) {
|
||||||
return software.equals(getServerSoftware());
|
return Arrays.asList(softwares).contains(getServerSoftware());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user