mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-23 02:35:25 +01:00
Teleporting to island by coordinates, change some event priorities
This commit is contained in:
parent
f451ea8912
commit
c193d2d7c5
@ -2,7 +2,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
group 'com.songoda.fabledskyblock'
|
group 'com.songoda.fabledskyblock'
|
||||||
version 'Build-75'
|
version 'Build-76'
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
||||||
|
@ -555,11 +555,12 @@ public class IslandManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadIslandAtLocation(Location location) {
|
public Island loadIslandAtLocation(Location location) {
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
|
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
|
||||||
|
|
||||||
if (!configFile.exists()) return;
|
if (!configFile.exists())
|
||||||
|
return null;
|
||||||
|
|
||||||
for (File fileList : configFile.listFiles()) {
|
for (File fileList : configFile.listFiles()) {
|
||||||
if (fileList != null && fileList.getName().contains(".yml") && fileList.getName().length() > 35) {
|
if (fileList != null && fileList.getName().contains(".yml") && fileList.getName().length() > 35) {
|
||||||
@ -576,14 +577,15 @@ public class IslandManager {
|
|||||||
|
|
||||||
if (LocationUtil.isLocationAtLocationRadius(location, islandLocation, size)) {
|
if (LocationUtil.isLocationAtLocationRadius(location, islandLocation, size)) {
|
||||||
UUID islandOwnerUUID = UUID.fromString(fileList.getName().replace(".yml", ""));
|
UUID islandOwnerUUID = UUID.fromString(fileList.getName().replace(".yml", ""));
|
||||||
this.loadIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
return this.loadIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unloadIsland(Island island, org.bukkit.OfflinePlayer player) {
|
public void unloadIsland(Island island, org.bukkit.OfflinePlayer player) {
|
||||||
|
@ -45,7 +45,7 @@ public class Block implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
org.bukkit.block.Block block = event.getBlock();
|
org.bukkit.block.Block block = event.getBlock();
|
||||||
@ -159,7 +159,7 @@ public class Block implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
org.bukkit.block.Block block = event.getBlock();
|
org.bukkit.block.Block block = event.getBlock();
|
||||||
|
@ -49,7 +49,7 @@ public class Interact implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
org.bukkit.block.Block block = event.getClickedBlock();
|
org.bukkit.block.Block block = event.getClickedBlock();
|
||||||
|
@ -40,7 +40,7 @@ public class Move implements Listener {
|
|||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
|
|
||||||
if (from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ()) {
|
if (to == null || (from.getBlockX() == to.getBlockX() && from.getBlockY() == to.getBlockY() && from.getBlockZ() == to.getBlockZ())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,8 @@ public class Move implements Listener {
|
|||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
|
|
||||||
if (!worldManager.isIslandWorld(player.getWorld())) return;
|
if (!worldManager.isIslandWorld(player.getWorld()))
|
||||||
|
return;
|
||||||
|
|
||||||
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
|
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
|
||||||
|
|
||||||
@ -187,7 +188,7 @@ public class Move implements Listener {
|
|||||||
|
|
||||||
if (LocationUtil.isLocationAtLocationRadius(to,
|
if (LocationUtil.isLocationAtLocationRadius(to,
|
||||||
island.getLocation(world, IslandEnvironment.Island), island.getRadius() + 2)) {
|
island.getLocation(world, IslandEnvironment.Island), island.getRadius() + 2)) {
|
||||||
if (!configLoad.getBoolean("Island.WorldBorder.Enable")) {
|
if (!configLoad.getBoolean("Island.WorldBorder.Enable") || !island.isBorder()) {
|
||||||
player.teleport(player.getLocation()
|
player.teleport(player.getLocation()
|
||||||
.add(from.toVector().subtract(to.toVector()).normalize().multiply(2.0D)));
|
.add(from.toVector().subtract(to.toVector()).normalize().multiply(2.0D)));
|
||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
@ -212,6 +213,16 @@ public class Move implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load the island they are now on if one exists
|
||||||
|
if (player.hasPermission("fabledskyblock.bypass")) {
|
||||||
|
Island loadedIsland = islandManager.loadIslandAtLocation(player.getLocation());
|
||||||
|
if (loadedIsland != null) {
|
||||||
|
Bukkit.broadcastMessage("Sidestepped normal rules for bypass user");
|
||||||
|
playerData.setIsland(loadedIsland.getOwnerUUID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LocationUtil.teleportPlayerToSpawn(player);
|
LocationUtil.teleportPlayerToSpawn(player);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
|
Loading…
Reference in New Issue
Block a user