Hooked in grid database to track where islands are.

Added Nether events and portal function.
Added default /island command operation.
This commit is contained in:
tastybento 2017-07-06 16:51:40 -07:00
parent 3a6a1eae6d
commit f31dcb5ce1
9 changed files with 765 additions and 126 deletions

View File

@ -342,6 +342,7 @@ island:
islandDeletedLifeboats: "Island deleted! Head to the lifeboats!"
islandLevelis: "Island level is"
new: "Creating a new island for you..."
protected: "Island protected."
requiredPointsToNextLevel: "You need [points] more points to reach level [next]!"
reset:
Confirm: "Type /[label] confirm within [seconds] seconds to delete your island and restart!"
@ -360,7 +361,6 @@ island:
titlecolor: "gold"
unlimited: "Unlimited"
url: ""
islandProtected: "Island protected."
islandguardsettings:
TNTdamage: "TNT Damage"
allowed: "Allowed"
@ -557,15 +557,16 @@ topTen:
header: "These are the Top 10 islands:"
warps:
deactivate: "Deactivating old sign!"
errorDoesNotExist: "That warp doesn't exist!"
errorDuplicate: "Sorry! There is a sign already in that location!"
errorNoPerm: "You do not have permission to place Welcome Signs yet!"
errorNoPlace: "You must be on your island to place a Welcome Sign!"
errorNoRemove: "You can only remove your own Welcome Sign!"
errorNoWarpsYet: "There are no warps available yet!"
errorNotReadyYet: "That warp is not ready yet. Try again later."
errorNotSafe: "That warp is not safe right now. Try again later."
errorNotEnoughLevel: "You do not have enough island levels to create a Welcome Sign!"
error:
DoesNotExist: "That warp doesn't exist!"
Duplicate: "Sorry! There is a sign already in that location!"
NoPerm: "You do not have permission to place Welcome Signs yet!"
NoPlace: "You must be on your island to place a Welcome Sign!"
NoRemove: "You can only remove your own Welcome Sign!"
NoWarpsYet: "There are no warps available yet!"
NotReadyYet: "That warp is not ready yet. Try again later."
NotSafe: "That warp is not safe right now. Try again later."
NotEnoughLevel: "You do not have enough island levels to create a Welcome Sign!"
next: "Next"
playerWarped: "[name] &2warped to your island!"
previous: "Previous"

View File

@ -24,6 +24,8 @@ import us.tastybento.bskyblock.database.managers.OfflineHistoryMessages;
import us.tastybento.bskyblock.database.managers.PlayersManager;
import us.tastybento.bskyblock.generators.IslandWorld;
import us.tastybento.bskyblock.listeners.JoinLeaveListener;
import us.tastybento.bskyblock.listeners.NetherEvents;
import us.tastybento.bskyblock.listeners.NetherPortals;
import us.tastybento.bskyblock.schematics.SchematicsMgr;
import us.tastybento.bskyblock.util.FileLister;
import us.tastybento.bskyblock.util.VaultHelper;
@ -99,7 +101,7 @@ public class BSkyBlock extends JavaPlugin{
Settings.worldName = "BSkyBlock_world";
Settings.createNether = true;
Settings.createEnd = true;
Settings.islandNether = false;
Settings.islandNether = true;
Settings.islandEnd = false;
new IslandWorld(plugin);
@ -156,6 +158,8 @@ public class BSkyBlock extends JavaPlugin{
PluginManager manager = getServer().getPluginManager();
// Player join events
manager.registerEvents(new JoinLeaveListener(plugin), plugin);
manager.registerEvents(new NetherEvents(plugin), plugin);
manager.registerEvents(new NetherPortals(plugin), plugin);
/*
*DEBUG CODE
Island loadedIsland = islandsManager.getIsland(owner);
@ -278,10 +282,10 @@ public class BSkyBlock extends JavaPlugin{
* @return the locale for this player
*/
public BSBLocale getLocale(UUID player){
getLogger().info("DEBUG: " + player);
getLogger().info("DEBUG: " + getPlayers() == null ? "Players is null":"Players in not null");
getLogger().info("DEBUG: " + getPlayers().getPlayer(player));
getLogger().info("DEBUG: " + getPlayers().getPlayer(player).getLocale());
//getLogger().info("DEBUG: " + player);
//getLogger().info("DEBUG: " + getPlayers() == null ? "Players is null":"Players in not null");
//getLogger().info("DEBUG: " + getPlayers().getPlayer(player));
//getLogger().info("DEBUG: " + getPlayers().getPlayer(player).getLocale());
String locale = getPlayers().getPlayer(player).getLocale();
if(locale.isEmpty() || !locales.containsKey(locale)) return locales.get(Settings.defaultLanguage);

View File

@ -46,7 +46,18 @@ public class IslandCommand extends BSBCommand{
@Override
public void onExecuteDefault(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
if (sender instanceof Player) {
Player player = (Player)sender;
if (plugin.getIslands().hasIsland(player.getUniqueId())) {
// Has island
plugin.getIslands().homeTeleport(player);
} else {
// Create island
createIsland(player);
}
} else {
Util.sendMessage(sender, plugin.getLocale().get("general.errors.use-in-game"));
}
}
@Override
@ -81,7 +92,7 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return true;
}
@ -97,7 +108,7 @@ public class IslandCommand extends BSBCommand{
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -114,13 +125,13 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@ -140,7 +151,7 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return true;
}
@ -149,8 +160,7 @@ public class IslandCommand extends BSBCommand{
if (sender instanceof Player) {
Player player = (Player)sender;
if (!plugin.getIslands().hasIsland(player.getUniqueId())) {
Schematic schematic = plugin.getSchematics().getSchematic("default");
plugin.getIslands().newIsland(player, schematic);
createIsland(player);
} else {
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).get("island.error.YouAlreadyHaveAnIsland"));
}
@ -159,7 +169,7 @@ public class IslandCommand extends BSBCommand{
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -174,19 +184,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -201,19 +211,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -228,13 +238,13 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return true;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
if (!(sender instanceof Player)) {
Util.sendMessage(sender, plugin.getLocale().get("error.useInGame"));
}
@ -258,7 +268,7 @@ public class IslandCommand extends BSBCommand{
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -273,19 +283,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -414,19 +424,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -441,19 +451,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -468,19 +478,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -495,19 +505,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -522,19 +532,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -549,19 +559,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -576,19 +586,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -603,19 +613,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -630,19 +640,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -657,19 +667,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -684,19 +694,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -711,19 +721,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -738,19 +748,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -765,19 +775,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -792,19 +802,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -819,19 +829,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -846,19 +856,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -873,19 +883,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -900,19 +910,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -927,19 +937,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -954,19 +964,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -981,19 +991,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -1055,19 +1065,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -1082,19 +1092,19 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
}
@Override
public List<String> onTabComplete(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return null;
}
@ -1105,4 +1115,14 @@ public class IslandCommand extends BSBCommand{
});
}
/**
* Creates an island for player
* @param player
*/
protected void createIsland(Player player) {
//TODO: Add panels, make a selection.
Schematic schematic = plugin.getSchematics().getSchematic("default");
plugin.getIslands().newIsland(player, schematic);
}
}

View File

@ -83,6 +83,7 @@ public class IslandsManager {
for (Island island : handler.loadObjects()) {
islandsByLocation.put(island.getCenter(), island);
islandsByUUID.put(island.getOwner(), island);
addToGrid(island);
}
} catch (Exception e) {
// TODO Auto-generated catch block
@ -163,9 +164,60 @@ public class IslandsManager {
islandsByLocation.put(location, island);
if (owner != null)
islandsByUUID.put(owner, island);
addToGrid(island);
return island;
}
/**
* Adds an island to the grid register
* @param newIsland
*/
private void addToGrid(Island newIsland) {
if (islandGrid.containsKey(newIsland.getMinX())) {
//plugin.getLogger().info("DEBUG: min x is in the grid :" + newIsland.getMinX());
TreeMap<Integer, Island> zEntry = islandGrid.get(newIsland.getMinX());
if (zEntry.containsKey(newIsland.getMinZ())) {
//plugin.getLogger().info("DEBUG: min z is in the grid :" + newIsland.getMinZ());
// Island already exists
Island conflict = islandGrid.get(newIsland.getMinX()).get(newIsland.getMinZ());
plugin.getLogger().warning("*** Duplicate or overlapping islands! ***");
plugin.getLogger().warning(
"Island at (" + newIsland.getCenter().getBlockX() + ", " + newIsland.getCenter().getBlockZ() + ") conflicts with ("
+ conflict.getCenter().getBlockX() + ", " + conflict.getCenter().getBlockZ() + ")");
if (conflict.getOwner() != null) {
plugin.getLogger().warning("Accepted island is owned by " + plugin.getPlayers().getName(conflict.getOwner()));
plugin.getLogger().warning(conflict.getOwner().toString() + ".yml");
} else {
plugin.getLogger().warning("Accepted island is unowned.");
}
if (newIsland.getOwner() != null) {
plugin.getLogger().warning("Denied island is owned by " + plugin.getPlayers().getName(newIsland.getOwner()));
plugin.getLogger().warning(newIsland.getOwner().toString() + ".yml");
} else {
plugin.getLogger().warning("Denied island is unowned and was just found in the islands folder. Skipping it...");
}
plugin.getLogger().warning("Recommend that the denied player file is deleted otherwise weird things can happen.");
return;
} else {
// Add island
//plugin.getLogger().info("DEBUG: added island to grid at " + newIsland.getMinX() + "," + newIsland.getMinZ());
zEntry.put(newIsland.getMinZ(), newIsland);
islandGrid.put(newIsland.getMinX(), zEntry);
// plugin.getLogger().info("Debug: " + newIsland.toString());
}
} else {
// Add island
//plugin.getLogger().info("DEBUG: added island to grid at " + newIsland.getMinX() + "," + newIsland.getMinZ());
TreeMap<Integer, Island> zEntry = new TreeMap<Integer, Island>();
zEntry.put(newIsland.getMinZ(), newIsland);
islandGrid.put(newIsland.getMinX(), zEntry);
}
}
/**
* Deletes an island from the database. Does not remove blocks
* @param location
*/
public void deleteIsland(Location location){
if (islandsByLocation.containsKey(location)) {
Island island = islandsByLocation.get(location);
@ -174,6 +226,29 @@ public class IslandsManager {
}
islandsByLocation.remove(location);
}
// Remove from grid
// plugin.getLogger().info("DEBUG: deleting island at " + location);
Island island = getIslandAt(location);
if (island != null) {
int x = island.getMinX();
int z = island.getMinZ();
// plugin.getLogger().info("DEBUG: x = " + x + " z = " + z);
if (islandGrid.containsKey(x)) {
// plugin.getLogger().info("DEBUG: x found");
TreeMap<Integer, Island> zEntry = islandGrid.get(x);
if (zEntry.containsKey(z)) {
// plugin.getLogger().info("DEBUG: z found - deleting the island");
// Island exists - delete it
Island deletedIsland = zEntry.get(z);
deletedIsland.setOwner(null);
deletedIsland.setLocked(false);
zEntry.remove(z);
islandGrid.put(x, zEntry);
} // else {
// plugin.getLogger().info("DEBUG: could not find z");
// }
}
}
}
/**
@ -332,14 +407,17 @@ public class IslandsManager {
*/
public Island getIslandAt(Location location) {
if (location == null) {
plugin.getLogger().info("DEBUG: location is null");
return null;
}
// World check
if (!inWorld(location)) {
plugin.getLogger().info("DEBUG: not in right world");
return null;
}
// Check if it is spawn
if (spawn != null && spawn.onIsland(location)) {
plugin.getLogger().info("DEBUG: spawn");
return spawn;
}
return getIslandAt(location.getBlockX(), location.getBlockZ());
@ -354,6 +432,8 @@ public class IslandsManager {
* @return PlayerIsland or null
*/
public Island getIslandAt(int x, int z) {
plugin.getLogger().info("DEBUG: getting island at " + x + "," + z);
plugin.getLogger().info("DEBUG: island grid is " + islandGrid.size());
Entry<Integer, TreeMap<Integer, Island>> en = islandGrid.floorEntry(x);
if (en != null) {
Entry<Integer, Island> ent = en.getValue().floorEntry(z);
@ -361,10 +441,10 @@ public class IslandsManager {
// Check if in the island range
Island island = ent.getValue();
if (island.inIslandSpace(x, z)) {
// plugin.getLogger().info("DEBUG: In island space");
plugin.getLogger().info("DEBUG: In island space");
return island;
}
//plugin.getLogger().info("DEBUG: not in island space");
plugin.getLogger().info("DEBUG: not in island space");
}
}
return null;
@ -745,7 +825,7 @@ public class IslandsManager {
public void newIsland(Player player, Schematic schematic) {
newIsland(player, schematic, null);
}
/**
* Makes an island using schematic. No permission checks are made. They have to be decided
* before this method is called. If oldIsland is not null, it will be deleted after the new
@ -765,13 +845,13 @@ public class IslandsManager {
plugin.getLogger().info("DEBUG: finding island location");
Location next = getNextIsland(player.getUniqueId());
plugin.getLogger().info("DEBUG: found " + next);
// Add to the grid
Island myIsland = plugin.getIslands().createIsland(next, playerUUID);
myIsland.setLevelHandicap(schematic.getLevelHandicap());
// Save the player so that if the server is reset weird things won't happen
plugin.getPlayers().save(true);
// Clear any old home locations (they should be clear, but just in case)
plugin.getPlayers().clearHomeLocations(playerUUID);
@ -950,7 +1030,7 @@ public class IslandsManager {
nextPos.setZ(nextPos.getZ() - Settings.islandDistance);
return nextPos;
}
/**
* This removes players from an island overworld and nether - used when reseting or deleting an island
* Mobs are killed when the chunks are refreshed.
@ -994,7 +1074,7 @@ public class IslandsManager {
*/
public void removeMobs(Location location) {
// TODO Auto-generated method stub
}
}

View File

@ -108,29 +108,34 @@ public class PlayersManager{
* Cache control methods
*/
/**
* Adds a player to the cache
* @param playerUUID
* @return the players object
*/
public Players addPlayer(final UUID playerUUID) {
if (playerUUID == null)
return null;
plugin.getLogger().info("DEBUG: adding player " + playerUUID);
//plugin.getLogger().info("DEBUG: adding player " + playerUUID);
if (!playerCache.containsKey(playerUUID)) {
plugin.getLogger().info("DEBUG: player not in cache");
//plugin.getLogger().info("DEBUG: player not in cache");
Players player = null;
// If the player is in the database, load it, otherwise create a new player
if (handler.objectExits(playerUUID.toString())) {
plugin.getLogger().info("DEBUG: player in database");
//plugin.getLogger().info("DEBUG: player in database");
try {
player = handler.loadObject(playerUUID.toString());
} catch (Exception e) {
e.printStackTrace();
}
} else {
plugin.getLogger().info("DEBUG: new player");
//plugin.getLogger().info("DEBUG: new player");
player = new Players(playerUUID);
}
playerCache.put(playerUUID, player);
return player;
} else {
plugin.getLogger().info("DEBUG: known player");
//plugin.getLogger().info("DEBUG: known player");
return playerCache.get(playerUUID);
}
}

View File

@ -7,6 +7,7 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import us.tastybento.bskyblock.api.events.island.IslandLockEvent;
@ -484,8 +485,16 @@ public class Island extends DataObject {
/**
* @return the island display name or the owner's name if none is set
*/
public String getName(){
return (name != null && owner != null) ? name : Bukkit.getServer().getOfflinePlayer(owner).getName();
public String getName() {
if (name != null) {
return name;
}
if (owner != null) {
OfflinePlayer player = Bukkit.getServer().getOfflinePlayer(owner);
name = player.getName();
return player.getName();
}
return "";
}
/**

View File

@ -0,0 +1,248 @@
/*******************************************************************************
* This file is part of BSkyBlock.
*
* BSkyBlock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BSkyBlock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BSkyBlock. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package us.tastybento.bskyblock.listeners;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World.Environment;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.util.Vector;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.config.Settings;
import us.tastybento.bskyblock.generators.IslandWorld;
import us.tastybento.bskyblock.util.SafeSpotTeleport;
import us.tastybento.bskyblock.util.Util;
import us.tastybento.bskyblock.util.VaultHelper;
public class NetherEvents implements Listener {
private final BSkyBlock plugin;
private final static boolean DEBUG = false;
public NetherEvents(BSkyBlock plugin) {
this.plugin = plugin;
}
/**
* This handles non-player portal use
* Currently disables portal use by entities
*
* @param event
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityPortal(EntityPortalEvent event) {
if (DEBUG)
plugin.getLogger().info("DEBUG: nether portal entity " + event.getFrom().getBlock().getType());
// If the nether is disabled then quit immediately
if (!Settings.createNether || IslandWorld.getNetherWorld() == null) {
return;
}
if (event.getEntity() == null) {
return;
}
if (event.getFrom() != null && event.getFrom().getBlock().getType().equals(Material.ENDER_PORTAL)) {
event.setCancelled(true);
// Same action for all worlds except the end itself
if (!event.getFrom().getWorld().getEnvironment().equals(Environment.THE_END)) {
if (plugin.getServer().getWorld(Settings.worldName + "_the_end") != null) {
// The end exists
Location end_place = plugin.getServer().getWorld(Settings.worldName + "_the_end").getSpawnLocation();
event.getEntity().teleport(end_place);
if (DEBUG)
plugin.getLogger().info("DEBUG: Result teleported " + event.getEntityType() + " to " + end_place);
return;
}
}
return;
}
Location currentLocation = event.getFrom().clone();
String currentWorld = currentLocation.getWorld().getName();
// Only operate if this is Island territory
if (!currentWorld.equalsIgnoreCase(Settings.worldName) && !currentWorld.equalsIgnoreCase(Settings.worldName + "_nether")) {
return;
}
// No entities may pass with the old nether
if (!Settings.islandNether) {
event.setCancelled(true);
return;
}
// New nether
// Entities can pass only if there are adjoining portals
Location dest = event.getFrom().toVector().toLocation(IslandWorld.getIslandWorld());
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
dest = event.getFrom().toVector().toLocation(IslandWorld.getNetherWorld());
}
// Vehicles
if (event.getEntity() instanceof Vehicle) {
Vehicle vehicle = (Vehicle)event.getEntity();
vehicle.eject();
}
new SafeSpotTeleport(plugin, event.getEntity(), dest);
event.setCancelled(true);
}
// Nether portal spawn protection
/**
* Function to check proximity to nether spawn location
*
* @param player
* @return true if in the spawn area, false if not
*/
private boolean awayFromSpawn(Player player) {
Vector p = player.getLocation().toVector().multiply(new Vector(1, 0, 1));
Vector spawn = player.getWorld().getSpawnLocation().toVector().multiply(new Vector(1, 0, 1));
if (spawn.distanceSquared(p) < (Settings.netherSpawnRadius * Settings.netherSpawnRadius)) {
return false;
} else {
return true;
}
}
/**
* Prevents blocks from being broken
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW)
public void onBlockBreak(final BlockBreakEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
// plugin.getLogger().info("Block break");
if ((e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether") && !Settings.islandNether)
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
if (DEBUG)
plugin.getLogger().info("Block break in island nether");
if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("nether.spawnisprotected"));
e.setCancelled(true);
}
}
}
/**
* Prevents placing of blocks
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW)
public void onPlayerBlockPlace(final BlockPlaceEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.islandNether) {
if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
e.setCancelled(true);
}
}
}
}
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.islandNether) {
if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
e.setCancelled(true);
}
}
}
}
/**
* Prevent the Nether spawn from being blown up
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onExplosion(final EntityExplodeEvent e) {
if (Settings.islandNether) {
// Not used in the new nether
return;
}
// Find out what is exploding
Entity expl = e.getEntity();
if (expl == null) {
return;
}
// Check world
if (!e.getEntity().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
|| e.getEntity().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
return;
}
Location spawn = e.getLocation().getWorld().getSpawnLocation();
Location loc = e.getLocation();
if (spawn.distance(loc) < Settings.netherSpawnRadius) {
e.blockList().clear();
}
}
/**
* Converts trees to gravel and glowstone
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.netherTrees) {
return;
}
if (!Settings.createNether || IslandWorld.getNetherWorld() == null) {
return;
}
// Check world
if (!e.getLocation().getWorld().equals(IslandWorld.getNetherWorld())) {
return;
}
for (BlockState b : e.getBlocks()) {
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
b.setType(Material.GRAVEL);
} else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
b.setType(Material.GLOWSTONE);
}
}
}
}

View File

@ -0,0 +1,272 @@
/*******************************************************************************
* This file is part of BSkyBlock.
*
* BSkyBlock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BSkyBlock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BSkyBlock. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package us.tastybento.bskyblock.listeners;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.config.Settings;
import us.tastybento.bskyblock.database.managers.IslandsManager;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.database.objects.Island.SettingsFlag;
import us.tastybento.bskyblock.generators.IslandWorld;
import us.tastybento.bskyblock.schematics.Schematic;
import us.tastybento.bskyblock.schematics.Schematic.PasteReason;
import us.tastybento.bskyblock.util.SafeSpotTeleport;
import us.tastybento.bskyblock.util.Util;
import us.tastybento.bskyblock.util.VaultHelper;
public class NetherPortals implements Listener {
private final BSkyBlock plugin;
private final static boolean DEBUG = false;
public NetherPortals(BSkyBlock plugin) {
this.plugin = plugin;
}
/**
* This handles non-player portal use
* Currently disables portal use by entities
*
* @param event
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityPortal(EntityPortalEvent event) {
if (DEBUG)
plugin.getLogger().info("DEBUG: nether portal entity " + event.getFrom().getBlock().getType());
// If the nether is disabled then quit immediately
if (!Settings.createNether || IslandWorld.getNetherWorld() == null) {
return;
}
if (event.getEntity() == null) {
return;
}
if (event.getFrom() != null && event.getFrom().getBlock().getType().equals(Material.ENDER_PORTAL)) {
event.setCancelled(true);
// Same action for all worlds except the end itself
if (!event.getFrom().getWorld().getEnvironment().equals(Environment.THE_END)) {
if (plugin.getServer().getWorld(Settings.worldName + "_the_end") != null) {
// The end exists
Location end_place = plugin.getServer().getWorld(Settings.worldName + "_the_end").getSpawnLocation();
event.getEntity().teleport(end_place);
if (DEBUG)
plugin.getLogger().info("DEBUG: Result teleported " + event.getEntityType() + " to " + end_place);
return;
}
}
return;
}
Location currentLocation = event.getFrom().clone();
String currentWorld = currentLocation.getWorld().getName();
// Only operate if this is Island territory
if (!currentWorld.equalsIgnoreCase(Settings.worldName) && !currentWorld.equalsIgnoreCase(Settings.worldName + "_nether")) {
return;
}
// No entities may pass with the old nether
if (!Settings.islandNether) {
event.setCancelled(true);
return;
}
// New nether
// Entities can pass only if there are adjoining portals
Location dest = event.getFrom().toVector().toLocation(IslandWorld.getIslandWorld());
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
dest = event.getFrom().toVector().toLocation(IslandWorld.getNetherWorld());
}
// Vehicles
if (event.getEntity() instanceof Vehicle) {
Vehicle vehicle = (Vehicle)event.getEntity();
vehicle.eject();
}
new SafeSpotTeleport(plugin, event.getEntity(), dest);
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerPortal(PlayerPortalEvent event) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Player portal event - reason =" + event.getCause());
UUID playerUUID = event.getPlayer().getUniqueId();
// If the nether is disabled then quit immediately
if (!Settings.createNether || IslandWorld.getNetherWorld() == null) {
return;
}
Location currentLocation = event.getFrom().clone();
String currentWorld = currentLocation.getWorld().getName();
if (!currentWorld.equalsIgnoreCase(Settings.worldName) && !currentWorld.equalsIgnoreCase(Settings.worldName + "_nether")
&& !currentWorld.equalsIgnoreCase(Settings.worldName + "_the_end")) {
if (DEBUG)
plugin.getLogger().info("DEBUG: not right world");
return;
}
// Check if player has permission
Island island = plugin.getIslands().getIslandAt(currentLocation);
// TODO: if ((island == null && !Settings.defaultWorldSettings.get(SettingsFlag.PORTAL))
if (island == null
|| (island != null && !(island.getFlag(SettingsFlag.PORTAL) || island.getMembers().contains(event.getPlayer().getUniqueId())))) {
// Portals use is not allowed
if (DEBUG)
plugin.getLogger().info("DEBUG: Portal use not allowed");
if (!event.getPlayer().isOp() && !VaultHelper.hasPerm(event.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
Util.sendMessage(event.getPlayer(), ChatColor.RED + plugin.getLocale(event.getPlayer().getUniqueId()).get("island.protected"));
event.setCancelled(true);
return;
}
}
// Determine what portal it is
switch (event.getCause()) {
case END_PORTAL:
if (DEBUG)
plugin.getLogger().info("DEBUG: End portal");
// Same action for all worlds except the end itself
if (!event.getFrom().getWorld().getEnvironment().equals(Environment.THE_END)) {
if (plugin.getServer().getWorld(Settings.worldName + "_the_end") != null) {
// The end exists
event.setCancelled(true);
Location end_place = plugin.getServer().getWorld(Settings.worldName + "_the_end").getSpawnLocation();
if (IslandsManager.isSafeLocation(end_place)) {
event.getPlayer().teleport(end_place);
// event.getPlayer().sendBlockChange(end_place,
// end_place.getBlock().getType(),end_place.getBlock().getData());
return;
} else {
Util.sendMessage(event.getPlayer(), ChatColor.RED + plugin.getLocale(event.getPlayer().getUniqueId()).get("warps.error.NotSafe"));
plugin.getIslands().homeTeleport(event.getPlayer());
return;
}
}
} else {
event.setCancelled(true);
plugin.getIslands().homeTeleport(event.getPlayer());
}
break;
case NETHER_PORTAL:
if (DEBUG)
plugin.getLogger().info("DEBUG: nether portal");
// Get the home world of this player
World homeWorld = IslandWorld.getIslandWorld();
Location home = plugin.getPlayers().getHomeLocation(event.getPlayer().getUniqueId());
if (home != null) {
homeWorld = home.getWorld();
}
if (!Settings.islandNether) {
// Legacy action
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
// Going to Nether
if (homeWorld.getEnvironment().equals(Environment.NORMAL)) {
// Home world is over world
event.setTo(IslandWorld.getNetherWorld().getSpawnLocation());
event.useTravelAgent(true);
} else {
// Home world is nether - going home
event.useTravelAgent(false);
Location dest = plugin.getIslands().getSafeHomeLocation(playerUUID,1);
if (dest != null) {
event.setTo(dest);
} else {
event.setCancelled(true);
new SafeSpotTeleport(plugin, event.getPlayer(), plugin.getIslands().getIslandLocation(playerUUID), 1);
}
}
} else {
// Going to Over world
if (homeWorld.getEnvironment().equals(Environment.NORMAL)) {
// Home world is over world
event.useTravelAgent(false);
Location dest = plugin.getIslands().getSafeHomeLocation(playerUUID,1);
if (dest != null) {
event.setTo(dest);
} else {
event.setCancelled(true);
new SafeSpotTeleport(plugin, event.getPlayer(), plugin.getIslands().getIslandLocation(playerUUID), 1);
}
} else {
// Home world is nether
event.setTo(IslandWorld.getIslandWorld().getSpawnLocation());
event.useTravelAgent(true);
}
}
} else {
// Island Nether
if (DEBUG)
plugin.getLogger().info("DEBUG: Island nether");
// Get location of the island where the player is at
if (island == null) {
if (DEBUG)
plugin.getLogger().info("DEBUG: island is null");
event.setCancelled(true);
return;
}
// Can go both ways now
Location overworldIsland = island.getCenter().toVector().toLocation(IslandWorld.getIslandWorld());
Location netherIsland = island.getCenter().toVector().toLocation(IslandWorld.getNetherWorld());
//Location dest = event.getFrom().toVector().toLocation(IslandWorld.getIslandWorld());
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
// Going to Nether
// Check that there is a nether island there. Due to legacy reasons it may not exist
if (DEBUG)
plugin.getLogger().info("DEBUG: island center = " + island.getCenter());
if (netherIsland.getBlock().getType() != Material.BEDROCK) {
// Check to see if there is anything there
if (plugin.getIslands().bigScan(netherIsland, 20) == null) {
if (DEBUG)
plugin.getLogger().info("DEBUG: big scan is null");
plugin.getLogger().warning("Creating nether island for " + event.getPlayer().getName() + " using default nether schematic");
Schematic nether = plugin.getSchematics().getSchematic("nether");
if (nether != null) {
if (DEBUG)
plugin.getLogger().info("DEBUG: pasting at " + island.getCenter().toVector());
nether.pasteSchematic(netherIsland, event.getPlayer(), false, PasteReason.PARTNER, island);
} else {
plugin.getLogger().severe("Cannot teleport player to nether because there is no nether schematic");
event.setCancelled(true);
Util.sendMessage(event.getPlayer(), ChatColor.RED + plugin.getLocale(event.getPlayer().getUniqueId()).get("warps.error.NotSafe"));
return;
}
}
}
if (DEBUG)
plugin.getLogger().info("DEBUG: Teleporting to " + event.getFrom().toVector().toLocation(IslandWorld.getNetherWorld()));
event.setCancelled(true);
// Teleport using the new safeSpot teleport
new SafeSpotTeleport(plugin, event.getPlayer(), netherIsland);
return;
}
// Going to the over world - if there isn't an island, do nothing
event.setCancelled(true);
// Teleport using the new safeSpot teleport
new SafeSpotTeleport(plugin, event.getPlayer(), overworldIsland);
}
break;
default:
break;
}
}
}

View File

@ -988,16 +988,16 @@ public class Schematic {
Sign sign = (Sign) signState;
if (sign.getLine(0).isEmpty()) {
// TODO Add sign
//sign.setLine(0, plugin.myLocale(player.getUniqueId()).signLine1.replace("[player]", player.getName()));
sign.setLine(0, plugin.getLocale(player.getUniqueId()).get("sign.line1").replace("[player]", player.getName()));
}
if (sign.getLine(1).isEmpty()) {
//sign.setLine(1, plugin.myLocale(player.getUniqueId()).signLine2.replace("[player]", player.getName()));
sign.setLine(1, plugin.getLocale(player.getUniqueId()).get("sign.line2").replace("[player]", player.getName()));
}
if (sign.getLine(2).isEmpty()) {
//sign.setLine(2, plugin.myLocale(player.getUniqueId()).signLine3.replace("[player]", player.getName()));
sign.setLine(2, plugin.getLocale(player.getUniqueId()).get("sign.line3").replace("[player]", player.getName()));
}
if (sign.getLine(3).isEmpty()) {
//sign.setLine(3, plugin.myLocale(player.getUniqueId()).signLine4.replace("[player]", player.getName()));
sign.setLine(3, plugin.getLocale(player.getUniqueId()).get("sign.line4").replace("[player]", player.getName()));
}
// BlockFace direction = ((org.bukkit.material.Sign)
// sign.getData()).getFacing();