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>
</resource>
<resource>
<targetPath>schematics</targetPath>
<targetPath>schems</targetPath>
<filtering>false</filtering>
<directory>${basedir}/schematics</directory>
<directory>${basedir}/schems</directory>
<includes>
<include>*.schematic</include>
<include>*.schem</include>
</includes>
</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.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Sign;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@ -38,6 +40,7 @@ import org.bukkit.material.Lever;
import org.bukkit.material.MaterialData;
import org.bukkit.material.Openable;
import org.bukkit.material.Redstone;
import org.bukkit.material.Stairs;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.localization.TextVariables;
@ -211,7 +214,7 @@ public class Clipboard {
return;
}
block.setType(m);
block.setType(m, false);
BlockState bs = block.getState();
@ -228,7 +231,11 @@ public class Clipboard {
if (md instanceof Directional) {
Directional facing = (Directional)md;
facing.setFacingDirection(BlockFace.valueOf(s.getString(FACING)));
if (md instanceof Stairs) {
facing.setFacingDirection(BlockFace.valueOf(s.getString(FACING)).getOppositeFace());
} else {
facing.setFacingDirection(BlockFace.valueOf(s.getString(FACING)));
}
}
if (md instanceof Lever) {
@ -239,6 +246,7 @@ public class Clipboard {
Button r = (Button)md;
r.setPowered(s.getBoolean(POWERED));
}
// Block data
if (bs instanceof Sign) {
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);
@ -271,6 +292,7 @@ public class Clipboard {
inv.getKeys(false).forEach(i -> ih.setItem(Integer.valueOf(i), (ItemStack)inv.get(i)));
}
}
@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;
}

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.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.island.builders.IslandBuilder;
import us.tastybento.bskyblock.island.builders.IslandBuilder.IslandType;
import us.tastybento.bskyblock.island.builders.IslandBuilderNew;
/**
* Create and paste a new island
@ -81,10 +80,10 @@ public class NewIsland {
this.reason2 = reason;
return this;
}
public Builder world(World world) {
this.world2 = world;
return this;
this.world2 = world;
return this;
}
public Island build() throws IOException {
@ -120,16 +119,16 @@ public class NewIsland {
.build();
if (!event.isCancelled()) {
// Create island
IslandBuilder ib = new IslandBuilder(island)
.setPlayer(user.getPlayer())
.setChestItems(plugin.getSettings().getChestItems())
.setType(IslandType.ISLAND);
IslandBuilderNew ib = new IslandBuilderNew(plugin, island)
.setPlayer(user.getPlayer())
.setChestItems(plugin.getSettings().getChestItems())
.setType(IslandBuilderNew.IslandType.ISLAND);
ib.build();
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) {
ib.setType(IslandType.END).build();
ib.setType(IslandBuilderNew.IslandType.END).build();
}
// Teleport player to their island
plugin.getIslands().homeTeleport(world, user.getPlayer(), true);
@ -146,11 +145,11 @@ public class NewIsland {
break;
}
IslandEvent.builder()
.involvedPlayer(user.getUniqueId())
.reason(reasonDone)
.island(island)
.location(island.getCenter())
.build();
.involvedPlayer(user.getUniqueId())
.reason(reasonDone)
.island(island)
.location(island.getCenter())
.build();
}
}