Added island schems

These are pasted as the default islands. I think better ones can be
made!
This commit is contained in:
tastybento 2018-06-25 20:13:39 -07:00
parent 56d63dc9c8
commit 70c6b75992
6 changed files with 53 additions and 21 deletions

View File

@ -26,11 +26,11 @@
</includes> </includes>
</resource> </resource>
<resource> <resource>
<targetPath>schematics</targetPath> <targetPath>schems</targetPath>
<filtering>false</filtering> <filtering>false</filtering>
<directory>${basedir}/schematics</directory> <directory>${basedir}/schems</directory>
<includes> <includes>
<include>*.schematic</include> <include>*.schem</include>
</includes> </includes>
</resource> </resource>
<resource> <resource>

BIN
schems/end-island.schem Normal file

Binary file not shown.

BIN
schems/island.schem Normal file

Binary file not shown.

BIN
schems/nether-island.schem Normal file

Binary file not shown.

View File

@ -21,12 +21,14 @@ import org.bukkit.block.Banner;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.block.banner.Pattern; import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType; import org.bukkit.block.banner.PatternType;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -38,6 +40,7 @@ import org.bukkit.material.Lever;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
import org.bukkit.material.Openable; import org.bukkit.material.Openable;
import org.bukkit.material.Redstone; import org.bukkit.material.Redstone;
import org.bukkit.material.Stairs;
import us.tastybento.bskyblock.BSkyBlock; import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.localization.TextVariables; import us.tastybento.bskyblock.api.localization.TextVariables;
@ -211,7 +214,7 @@ public class Clipboard {
return; return;
} }
block.setType(m); block.setType(m, false);
BlockState bs = block.getState(); BlockState bs = block.getState();
@ -228,8 +231,12 @@ public class Clipboard {
if (md instanceof Directional) { if (md instanceof Directional) {
Directional facing = (Directional)md; Directional facing = (Directional)md;
if (md instanceof Stairs) {
facing.setFacingDirection(BlockFace.valueOf(s.getString(FACING)).getOppositeFace());
} else {
facing.setFacingDirection(BlockFace.valueOf(s.getString(FACING))); facing.setFacingDirection(BlockFace.valueOf(s.getString(FACING)));
} }
}
if (md instanceof Lever) { if (md instanceof Lever) {
Lever r = (Lever)md; Lever r = (Lever)md;
@ -239,6 +246,7 @@ public class Clipboard {
Button r = (Button)md; Button r = (Button)md;
r.setPowered(s.getBoolean(POWERED)); r.setPowered(s.getBoolean(POWERED));
} }
// Block data // Block data
if (bs instanceof Sign) { if (bs instanceof Sign) {
Sign sign = (Sign)bs; Sign sign = (Sign)bs;
@ -262,6 +270,19 @@ public class Clipboard {
} }
} }
} }
if (bs instanceof CreatureSpawner) {
CreatureSpawner spawner = ((CreatureSpawner) bs);
spawner.setSpawnedType(EntityType.valueOf(s.getString("spawnedType", "PIG")));
spawner.setMaxNearbyEntities(s.getInt("maxNearbyEntities", 16));
spawner.setMaxSpawnDelay(s.getInt("maxSpawnDelay", 2*60*20));
spawner.setMinSpawnDelay(s.getInt("minSpawnDelay", 5*20));
spawner.setDelay(s.getInt("delay", -1));
spawner.setRequiredPlayerRange(s.getInt("requiredPlayerRange", 16));
spawner.setSpawnRange(s.getInt("spawnRange", 4));
}
bs.update(true, false); bs.update(true, false);
@ -271,6 +292,7 @@ public class Clipboard {
inv.getKeys(false).forEach(i -> ih.setItem(Integer.valueOf(i), (ItemStack)inv.get(i))); inv.getKeys(false).forEach(i -> ih.setItem(Integer.valueOf(i), (ItemStack)inv.get(i)));
} }
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -343,6 +365,17 @@ public class Clipboard {
} }
} }
} }
if (bs instanceof CreatureSpawner) {
CreatureSpawner spawner = (CreatureSpawner)bs;
s.set("spawnedType",spawner.getSpawnedType().name());
s.set("delay", spawner.getDelay());
s.set("maxNearbyEntities", spawner.getMaxNearbyEntities());
s.set("maxSpawnDelay", spawner.getMaxSpawnDelay());
s.set("minSpawnDelay", spawner.getMinSpawnDelay());
s.set("requiredPlayerRange", spawner.getRequiredPlayerRange());
s.set("spawnRange", spawner.getSpawnRange());
}
return true; return true;
} }

View File

@ -11,8 +11,7 @@ import us.tastybento.bskyblock.api.events.island.IslandEvent;
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason; import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
import us.tastybento.bskyblock.api.user.User; import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island; import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.island.builders.IslandBuilder; import us.tastybento.bskyblock.island.builders.IslandBuilderNew;
import us.tastybento.bskyblock.island.builders.IslandBuilder.IslandType;
/** /**
* Create and paste a new island * Create and paste a new island
@ -120,16 +119,16 @@ public class NewIsland {
.build(); .build();
if (!event.isCancelled()) { if (!event.isCancelled()) {
// Create island // Create island
IslandBuilder ib = new IslandBuilder(island) IslandBuilderNew ib = new IslandBuilderNew(plugin, island)
.setPlayer(user.getPlayer()) .setPlayer(user.getPlayer())
.setChestItems(plugin.getSettings().getChestItems()) .setChestItems(plugin.getSettings().getChestItems())
.setType(IslandType.ISLAND); .setType(IslandBuilderNew.IslandType.ISLAND);
ib.build(); ib.build();
if (plugin.getSettings().isNetherGenerate() && plugin.getSettings().isNetherIslands() && plugin.getIWM().getNetherWorld() != null) { if (plugin.getSettings().isNetherGenerate() && plugin.getSettings().isNetherIslands() && plugin.getIWM().getNetherWorld() != null) {
ib.setType(IslandType.NETHER).build(); ib.setType(IslandBuilderNew.IslandType.NETHER).build();
} }
if (plugin.getSettings().isEndGenerate() && plugin.getSettings().isEndIslands() && plugin.getIWM().getEndWorld() != null) { if (plugin.getSettings().isEndGenerate() && plugin.getSettings().isEndIslands() && plugin.getIWM().getEndWorld() != null) {
ib.setType(IslandType.END).build(); ib.setType(IslandBuilderNew.IslandType.END).build();
} }
// Teleport player to their island // Teleport player to their island
plugin.getIslands().homeTeleport(world, user.getPlayer(), true); plugin.getIslands().homeTeleport(world, user.getPlayer(), true);