mirror of
https://github.com/craftaro/EpicSpawners.git
synced 2025-01-05 10:16:49 +08:00
Merge branch 'development'
This commit is contained in:
commit
2ac99900b7
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.craftaro</groupId>
|
||||
<artifactId>EpicSpawners-Parent</artifactId>
|
||||
<version>8.2.2</version>
|
||||
<version>8.5.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>EpicSpawners-API</artifactId>
|
||||
@ -42,7 +42,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.8.0</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
@ -64,7 +64,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.3.1</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.craftaro.epicspawners.api.boosts.types;
|
||||
|
||||
import com.craftaro.core.database.Data;
|
||||
public interface Boosted {
|
||||
|
||||
public interface Boosted extends Data {
|
||||
int getAmountBoosted();
|
||||
|
||||
long getEndTime();
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface PlacedSpawner extends Data {
|
||||
public interface PlacedSpawner {
|
||||
int spawn(int amountToSpawn, String particle, Set<XMaterial> canSpawnOn, SpawnedEntity spawned, EntityType... types);
|
||||
|
||||
SpawnerStack addSpawnerStack(SpawnerStack spawnerStack);
|
||||
|
@ -42,11 +42,13 @@ public interface SpawnerManager {
|
||||
|
||||
PlacedSpawner removeSpawnerFromWorld(PlacedSpawner spawner);
|
||||
|
||||
void removeSpawnersFromWorld(List<PlacedSpawner> spawners);
|
||||
|
||||
Collection<PlacedSpawner> getSpawners();
|
||||
|
||||
void addSpawners(Map<Location, PlacedSpawner> spawners);
|
||||
|
||||
void addSpawners(List<PlacedSpawner> spawners);
|
||||
<T extends PlacedSpawner> void addSpawners(List<T> spawners);
|
||||
|
||||
void addCooldown(PlacedSpawner spawner);
|
||||
|
||||
|
@ -1,105 +0,0 @@
|
||||
package com.craftaro.epicspawners.api.utils;
|
||||
|
||||
public enum HeadType {
|
||||
BAT("978862a56119227aaad4b7c246c8b2256db985db0951f55b0a1f8616c191f"),
|
||||
BLAZE("b78ef2e4cf2c41a2d14bfde9caff10219f5b1bf5b35a49eb51c6467882cb5f0"),
|
||||
CHICKEN("1638469a599ceef7207537603248a9ab11ff591fd378bea4735b346a7fae893"),
|
||||
COW("5d6c6eda942f7f5f71c3161c7306f4aed307d82895f9d2b07ab4525718edc5"),
|
||||
CREEPER("295ef836389af993158aba27ff37b6567185f7a721ca90fdfeb937a7cb5747"),
|
||||
CAVE_SPIDER("eccc4a32d45d74e8b14ef1ffd55cd5f381a06d4999081d52eaea12e13293e209"),
|
||||
DONKEY("9ffca9f0859834da81af524c2865fa3186b5bf58bd1c4e3742837c4fd6853887"),
|
||||
ELDER_GUARDIAN("dbb9491b7a1768e3291959796232eb6f61b9c39aa2f81e13d287a3ab5d16dec"),
|
||||
ENDERMAN("7a59bb0a7a32965b3d90d8eafa899d1835f424509eadd4e6b709ada50b9cf"),
|
||||
ENDERMITE("e8c6cb8ceaad5a2ad5cc9a67bce6d5bdbf5cbb7e312955ccf9f162509355b1"),
|
||||
ENDER_DRAGON("74ecc040785e54663e855ef0486da72154d69bb4b7424b7381ccf95b095a"),
|
||||
EVOKER("d954135dc82213978db478778ae1213591b93d228d36dd54f1ea1da48e7cba6"),
|
||||
GHAST("8b6a72138d69fbbd2fea3fa251cabd87152e4f1c97e5f986bf685571db3cc0"),
|
||||
GIANT("56fc854bb84cf4b7697297973e02b79bc10698460b51a639c60e5e417734e11"),
|
||||
GUARDIAN("932c24524c82ab3b3e57c2052c533f13dd8c0beb8bdd06369bb2554da86c123"),
|
||||
HORSE("61902898308730c4747299cb5a5da9c25838b1d059fe46fc36896fee662729"),
|
||||
HUSK("6ae3a5bfcaa943d126988ed17ce8e4a7fb4231b05a5c5c947e5cc9752a199962"),
|
||||
ILLUSIONER("c269a9dabe4f9fd6b4d74b7cd9c7ee6b24d87549b5acabbeb36cd756cc373"),
|
||||
IRON_GOLEM("e13f34227283796bc017244cb46557d64bd562fa9dab0e12af5d23ad699cf697"),
|
||||
LLAMA("6bc438fc1fbbaea2289aabecedd3fdf269ddc979bf8b5c6a8fc4bb8dcd4e1fe"),
|
||||
MAGMA_CUBE("38957d5023c937c4c41aa2412d43410bda23cf79a9f6ab36b76fef2d7c429"),
|
||||
MULE("46dcda265e57e4f51b145aacbf5b59bdc6099ffd3cce0a661b2c0065d80930d8"),
|
||||
MUSHROOM_COW("d0bc61b9757a7b83e03cd2507a2157913c2cf016e7c096a4d6cf1fe1b8db"),
|
||||
OCELOT("d03a2e37418e0cffaa2b513910c5282b9bb06c35a1d47039a5cc51b234a542f3"),
|
||||
OMNI("afe097f7f7a6568884198b562cb58cfb84a3936fbf72828954aaa1f58cba32"),
|
||||
PARROT("fd7cca30a1dc2fb25d3b7fb16318330ac79742d97deeeabe5393fb8a2cb878"),
|
||||
PIG("621668ef7cb79dd9c22ce3d1f3f4cb6e2559893b6df4a469514e667c16aa4"),
|
||||
PIG_ZOMBIE("74e9c6e98582ffd8ff8feb3322cd1849c43fb16b158abb11ca7b42eda7743eb"),
|
||||
POLAR_BEAR("d46d23f04846369fa2a3702c10f759101af7bfe8419966429533cd81a11d2b"),
|
||||
RABBIT("dc7a317ec5c1ed7788f89e7f1a6af3d2eeb92d1e9879c05343c57f9d863de130"),
|
||||
SHEEP("f31f9ccc6b3e32ecf13b8a11ac29cd33d18c95fc73db8a66c5d657ccb8be70"),
|
||||
SHULKER("1433a4b73273a64c8ab2830b0fff777a61a488c92f60f83bfb3e421f428a44"),
|
||||
SILVERFISH("453a6aedbc9e4a22266cd70d2d4a2850a7e4b5864fbcbddf952b748fbabdb2"),
|
||||
SKELETON("2e5be6a3c0159d2c1f3b1e4e1d8384b6f7ebac993d58b10b9f8989c78a232"),
|
||||
SKELETON_HORSE("39be68887f5cf8c8044ebcdc5e768a172b2ef3e99545acd75b5ff74a263a"),
|
||||
SLIME("16ad20fc2d579be250d3db659c832da2b478a73a698b7ea10d18c9162e4d9b5"),
|
||||
SNOWMAN("a528df1653962e4e995dfd064a72b2cbff9b7197912880143f941a37db46c"),
|
||||
SPIDER("cd541541daaff50896cd258bdbdd4cf80c3ba816735726078bfe393927e57f1"),
|
||||
SQUID("01433be242366af126da434b8735df1eb5b3cb2cede39145974e9c483607bac"),
|
||||
STRAY("96e58aeeaf75e9695813aeaabd3973c83d5ff8c285fe6b944550bc41b953"),
|
||||
VEX("6dc4b59be077f7f2f6b488666afb85e45d96cc57b57934ae11ba9734bb4811"),
|
||||
VILLAGER("126ec1ca185b47aad39f931db8b0a8500ded86a127a204886ed4b3783ad1775c"),
|
||||
VINDICATOR("7a5b31aeab7f728cd7e90f81e2ffad4cd198c1907574f57be2b7c42f49ddd"),
|
||||
WITCH("2e139130d7efd41fbad53735f64f8aff265bd7c54977189c02babbec4b0d07b"),
|
||||
WITHER("cdf74e323ed41436965f5c57ddf2815d5332fe999e68fbb9d6cf5c8bd4139f"),
|
||||
WITHER_SKELETON("233b41fa79cd53a230e2db942863843183a70404533bbc01fab744769bcb"),
|
||||
WOLF("e95cbb4f75ea87617f2f713c6d49dac3209ba1bd4b9369654b1459ea15317"),
|
||||
ZOMBIE("56fc854bb84cf4b7697297973e02b79bc10698460b51a639c60e5e417734e11"),
|
||||
ZOMBIE_HORSE("d898e3eacff9949a9de9777ddfada8a7f62a4102de47b54db35f9f843e1ce4"),
|
||||
ZOMBIE_VILLAGER("1a207a2b872fe8dd22ce5e27fc3263622621635efd8ea6abbdf317f99c5843"),
|
||||
TURTLE("8df85c60a2e6061a5b4100e224422d19373badae2c0a1ca13e4d94897f7cbcf3"),
|
||||
PHANTOM("fc060c4c1565f337a1b399ccf247cf300d3c3843efaaa610e5d894a79d9957fe"),
|
||||
DOLPHIN("546fd34b06c61f68e94f357f38e62d334e339edf2b930d26951971921bbb5268"),
|
||||
PUFFERFISH("13bc144030373790ca5a03bf111ca4127d31729bf0788d1e05a019206e62da92"),
|
||||
SALMON("c1102e3a82c44ad4180e5be1cedda386158f5b8b20a52a8bd941104f7b695b9f"),
|
||||
COD("a5eef52a468f681fab6a56bf5cc9986c1868ff0795d115c6ab0009d8faf972a4"),
|
||||
TROPICAL_FISH("b80f5955825e822eff416182925c7d650a7e0947ec9f855a75450e03175e8338"),
|
||||
DROWNED("71f2469f9b4bd92aa6a8ba3415f1ab76fd746041400062dc40fe13b646c0cc5d"),
|
||||
DROPPED_ITEM("452fe4ce1f1d53a12ed443eeba7297e81da581e0c7a39954d9d7bba7de59c46"),
|
||||
WANDERING_TRADER("4e8882cb316875e867b8d90c197f3ab57ff809fe8dd4a88368354afada48cdb4"),
|
||||
PANDA("3cddc208575aadfdc47c1c707f8230b4775f70cec7531a9a355774f59e6bffa7"),
|
||||
CAT("ff1b549341ad53b2bcd851b224ec56dbadb54887eaa0f771ba8eb39f58cf1d59"),
|
||||
FOX("add8cd97dc3b34402b6d5e12f991ebaef246254c931803eb8dcb45fa4b4fba53"),
|
||||
PILLAGER("63550f89aea88665804c2fd1b6682930c23233184fdc060991305718ed660597"),
|
||||
RAVAGER("d91a9d864e36fbec19b584bcb71292530755b10c4e60784fec92b51f8189363c"),
|
||||
TRADER_LLAMA("6bc438fc1fbbaea2289aabecedd3fdf269ddc979bf8b5c6a8fc4bb8dcd4e1fe"),
|
||||
BEE("5162dd0b9f65b58a1e70f81d8e03e8ff6c53e4e985bdbe0186558d8a69a81189"),
|
||||
PIGLIN("8ed4c6c5e8ba2c3ab05cb47258a4fe95bd3b92ba0a68db6d6e961d830baa0179"),
|
||||
HOGLIN("6c8c7fb74e69885f294ca6652553dd5938dac1164f652d4843abe0e891453da4"),
|
||||
STRIDER("16a9186a317e31e77b85a625f9d0b1cf1809f9d46a4aa153e639b60d30743fcf"),
|
||||
ZOMBIFIED_PIGLIN("f05e06b1d1357a3574268a5189615983ceffc185993047da47ac947f3b7507f3"),
|
||||
ZOGLIN("f05e06b1d1357a3574268a5189615983ceffc185993047da47ac947f3b7507f3"),
|
||||
PIGLIN_BRUTE("7543ec4797511285efeb76d909d124dcecb255e048c7d65ae66b6ee2bae152e7"),
|
||||
AXOLOTL("fd792cd16e006d6e3e6303186d0498ea189e0c59389296a8e612a6db67af22cf"),
|
||||
GLOW_SQUID("72356ab9fc794c4b3e494aa26238a4156a1f2ec8571b198d5687a42b7f5581f1"),
|
||||
GOAT("5cc9fd5d95bbd035e2f6dc91e34670d67f89151b6d45ab106424e26101b94814"),
|
||||
ALLAY("df5de940bfe499c59ee8dac9f9c3919e7535eff3a9acb16f4842bf290f4c679f"),
|
||||
FROG("2ca4a8e494582c62aaa2c92474b16d69cd63baa3d3f50a4b631d6559ca0f33f5"),
|
||||
TADPOLE("b23ebf26b7a441e10a86fb5c2a5f3b519258a5c5dddd6a1a75549f517332815b"),
|
||||
WARDEN("bc9c84349742164a22971ee54516fff91d868da72cdcce62069db128c42154b2"),
|
||||
CAMEL("3642c9f71131b5df4a8c21c8c6f10684f22abafb8cd68a1d55ac4bf263a53a31"),
|
||||
SNIFFER("87ad920a66e38cc3426a5bff084667e8772116915e298098567c139f222e2c42"),
|
||||
BREEZE("80843a94f925b5598924ff9b52b7999c8d29d1b790ad487dd54e27956e540d20");
|
||||
|
||||
private final String urlHash;
|
||||
|
||||
HeadType(String urlHash) {
|
||||
this.urlHash = urlHash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getUrlHash()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getUrl() {
|
||||
return this.urlHash;
|
||||
}
|
||||
|
||||
public String getUrlHash() {
|
||||
return this.urlHash;
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
package com.craftaro.epicspawners.api.utils;
|
||||
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.utils.HeadType;
|
||||
import com.craftaro.core.utils.SkullItemCreator;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerData;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerTier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
@ -32,14 +31,8 @@ public class HeadUtils {
|
||||
return createSkullForSkinHash(headType.getUrlHash());
|
||||
}
|
||||
|
||||
private static ItemStack createSkullForSkinHash(String textureHash) {
|
||||
ItemStack head = XMaterial.PLAYER_HEAD.parseItem();
|
||||
|
||||
SkullMeta meta = (SkullMeta) head.getItemMeta();
|
||||
SkullUtils.applySkin(meta, textureHash);
|
||||
head.setItemMeta(meta);
|
||||
|
||||
return head;
|
||||
private static ItemStack createSkullForSkinHash(String textureUrlHash) {
|
||||
return SkullItemCreator.byTextureUrlHash(textureUrlHash);
|
||||
}
|
||||
|
||||
private static HeadType getHeadTypeOrDefault(String name) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.craftaro</groupId>
|
||||
<artifactId>EpicSpawners-Parent</artifactId>
|
||||
<version>8.2.2</version>
|
||||
<version>8.5.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>EpicSpawners-Plugin</artifactId>
|
||||
@ -17,7 +17,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.5.2</version>
|
||||
<version>3.6.0</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
@ -56,10 +56,10 @@
|
||||
<excludeDefaults>false</excludeDefaults>
|
||||
<includes>
|
||||
<include>**/nms/v*/**</include>
|
||||
<include>**/third_party/net/kyori/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/third_party/org/apache/**</exclude>
|
||||
<exclude>**/third_party/net/kyori/**</exclude>
|
||||
<exclude>**/third_party/com/zaxxer/**</exclude>
|
||||
<exclude>**/third_party/org/jooq/**</exclude>
|
||||
<exclude>**/third_party/org/mariadb/**</exclude>
|
||||
|
@ -127,7 +127,7 @@ public class EpicSpawners extends SongodaPlugin {
|
||||
|
||||
// Set Economy & Hologram preference
|
||||
EconomyManager.getManager().setPreferredHook(Settings.ECONOMY_PLUGIN.getString());
|
||||
EconomyManager.setCurrencySymbol(getLocale().getMessage("general.nametag.currency").getMessage());
|
||||
EconomyManager.setCurrencySymbol(getLocale().getMessage("general.nametag.currency").toText());
|
||||
HologramManager.getManager().setPreferredHook(Settings.HOLOGRAM_PLUGIN.getString());
|
||||
|
||||
// Register commands
|
||||
|
@ -1,11 +1,19 @@
|
||||
package com.craftaro.epicspawners.boost.types;
|
||||
|
||||
import com.craftaro.core.database.Data;
|
||||
import com.craftaro.epicspawners.api.boosts.types.Boosted;
|
||||
|
||||
public abstract class BoostedImpl implements Boosted {
|
||||
|
||||
public abstract class BoostedImpl implements Boosted, Data {
|
||||
private final int amountBoosted;
|
||||
private final long endTime;
|
||||
|
||||
//Default constructor for database use
|
||||
public BoostedImpl() {
|
||||
this.amountBoosted = 0;
|
||||
this.endTime = 0;
|
||||
}
|
||||
|
||||
public BoostedImpl(int amountBoosted, long endTime) {
|
||||
this.amountBoosted = amountBoosted;
|
||||
this.endTime = endTime;
|
||||
|
@ -14,7 +14,9 @@ public class _2_AddTiers extends DataMigration {
|
||||
@Override
|
||||
public void migrate(Connection connection, String tablePrefix) throws SQLException {
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "spawner_stacks ADD COLUMN IF NOT EXISTS tier VARCHAR(100) DEFAULT 'Tier_1' NOT NULL");
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "spawner_stacks ADD COLUMN tier VARCHAR(100) DEFAULT 'Tier_1' NOT NULL");
|
||||
} catch (Exception ignored) {
|
||||
//Column already exists
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,16 +18,38 @@ public class _3_AddUniqueIndex extends DataMigration {
|
||||
//Delete duplicate entries from previous versions
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
//Delete duplicate data before adding unique index
|
||||
//MariaDB and H2
|
||||
statement.execute("DELETE FROM " + tablePrefix + "entity_kills WHERE count < (SELECT MAX(count) FROM " + tablePrefix + "entity_kills AS t2 WHERE t2.player = " + tablePrefix + "entity_kills.player AND t2.entity_type = " + tablePrefix + "entity_kills.entity_type)");
|
||||
} catch (Exception e) {
|
||||
//MySQL
|
||||
try (PreparedStatement statement = connection.prepareStatement("CREATE TEMPORARY TABLE temp_table AS SELECT player, entity_type, MAX(count) as max_count FROM " + tablePrefix + "entity_kills GROUP BY player, entity_type")) {
|
||||
statement.execute();
|
||||
} catch (Exception ignored) {
|
||||
//Table already exists
|
||||
}
|
||||
|
||||
try (PreparedStatement statement = connection.prepareStatement("DELETE e FROM " + tablePrefix + "entity_kills e INNER JOIN temp_table t ON e.player = t.player AND e.entity_type = t.entity_type WHERE e.count < t.max_count")) {
|
||||
statement.execute();
|
||||
} catch (Exception ignored) {
|
||||
//Table already exists
|
||||
}
|
||||
|
||||
try (PreparedStatement statement = connection.prepareStatement("DROP TEMPORARY TABLE temp_table")) {
|
||||
statement.execute();
|
||||
} catch (Exception ignored) {
|
||||
//Table already exists
|
||||
}
|
||||
}
|
||||
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
//MySQL and MariaDB
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "entity_kills ADD UNIQUE INDEX IF NOT EXISTS player_uuid_entity_type (player, entity_type))");
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "entity_kills ADD UNIQUE INDEX player_uuid_entity_type (player, entity_type)");
|
||||
} catch (Exception ignored) {
|
||||
//H2
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "entity_kills ADD CONSTRAINT IF NOT EXISTS player_uuid_entity_type UNIQUE (player, entity_type)");
|
||||
} catch (Exception ignored2) {
|
||||
//Index already exists in the MySQL or MariaDB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class EditorDropsGui extends Gui {
|
||||
setTitle(spawnerTier.getGuiTitle());
|
||||
|
||||
setButton(8, GuiUtils.createButtonItem(XMaterial.ARROW,
|
||||
plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
plugin.getLocale().getMessage("general.nametag.back")),
|
||||
(event) -> this.guiManager.showGUI(event.player, back));
|
||||
|
||||
paint();
|
||||
|
@ -134,7 +134,7 @@ public class EditorEditGui extends Gui {
|
||||
}, 1L);
|
||||
|
||||
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
|
||||
TextUtils.formatText(this.plugin.getLocale().getMessage("general.nametag.back").getMessage())),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back")),
|
||||
(event) -> this.guiManager.showGUI(event.player, this.back));
|
||||
|
||||
if (this.editType != EditType.ITEM && this.editType != EditType.BLOCK) {
|
||||
|
@ -48,7 +48,7 @@ public class EditorGeneralGui extends Gui {
|
||||
mirrorFill(0, 1, true, true, glass2);
|
||||
|
||||
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back")),
|
||||
(event) -> this.guiManager.showGUI(event.player, this.back));
|
||||
|
||||
setButton(22, GuiUtils.createButtonItem(XMaterial.FIRE_CHARGE, TextUtils.formatText("&c&lSpawn On Fire",
|
||||
|
@ -4,12 +4,12 @@ import com.craftaro.core.gui.AnvilGui;
|
||||
import com.craftaro.core.gui.Gui;
|
||||
import com.craftaro.core.gui.GuiUtils;
|
||||
import com.craftaro.core.input.ChatPrompt;
|
||||
import com.craftaro.core.utils.HeadType;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerData;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerTier;
|
||||
import com.craftaro.epicspawners.api.utils.HeadType;
|
||||
import com.craftaro.epicspawners.api.utils.HeadUtils;
|
||||
import com.craftaro.epicspawners.settings.Settings;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -82,7 +82,7 @@ public class EditorOverviewGui extends Gui {
|
||||
setItem(53, glass3);
|
||||
|
||||
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back")),
|
||||
(event) -> EditorTiersGui.openTiersInReverse(this.plugin, this.player, this.spawnerTier));
|
||||
|
||||
ItemStack item = HeadUtils.getTexturedSkull(this.spawnerTier);
|
||||
|
@ -59,7 +59,7 @@ public class EditorParticleGui extends Gui {
|
||||
setItem(44, glass2);
|
||||
|
||||
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back")),
|
||||
(event) -> this.guiManager.showGUI(event.player, this.back));
|
||||
|
||||
setButton(20, GuiUtils.createButtonItem(XMaterial.ENDER_PEARL, TextUtils.formatText("&5&lParticle Types",
|
||||
|
@ -51,8 +51,8 @@ public class EditorSelectorGui extends Gui {
|
||||
this.pages = (int) Math.max(1, Math.ceil(this.entities.size() / ((double) 28)));
|
||||
|
||||
// enable page event
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").getMessage()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").getMessage()));
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next")));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back")));
|
||||
setOnPage((event) -> showPage());
|
||||
|
||||
List<SpawnerData> data = this.entities.stream()
|
||||
@ -61,7 +61,7 @@ public class EditorSelectorGui extends Gui {
|
||||
|| this.shownType == Type.CUSTOM && s.isCustom()).skip((this.page - 1) * 28).limit(28).collect(Collectors.toList());
|
||||
|
||||
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit").getMessage()), (event) -> close());
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit")), (event) -> close());
|
||||
|
||||
int num = 10;
|
||||
for (int i = 0; i < 28; i++) {
|
||||
|
@ -45,7 +45,7 @@ public class EditorTierGeneralGui extends Gui {
|
||||
mirrorFill(1, 1, false, true, glass3);
|
||||
|
||||
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back")),
|
||||
(event) -> this.guiManager.showGUI(event.player, this.back));
|
||||
|
||||
setButton(10, GuiUtils.createButtonItem(XMaterial.SUNFLOWER, TextUtils.formatText("&6&lIn Shop",
|
||||
|
@ -3,6 +3,7 @@ package com.craftaro.epicspawners.gui;
|
||||
import com.craftaro.core.gui.Gui;
|
||||
import com.craftaro.core.gui.GuiUtils;
|
||||
import com.craftaro.core.input.ChatPrompt;
|
||||
import com.craftaro.epicspawners.spawners.spawner.PlacedSpawnerImpl;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
@ -64,8 +65,8 @@ public class EditorTiersGui extends Gui {
|
||||
this.pages = (int) Math.max(1, Math.ceil(tiersSource.size() / ((double) 28)));
|
||||
|
||||
// enable page event
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").getMessage()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").getMessage()));
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next")));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back")));
|
||||
setOnPage((event) -> showPage());
|
||||
|
||||
List<SpawnerTier> tiers = tiersSource.stream().skip((this.page - 1) * 28).limit(28).collect(Collectors.toList());
|
||||
@ -157,7 +158,7 @@ public class EditorTiersGui extends Gui {
|
||||
}
|
||||
if (modified) {
|
||||
this.plugin.updateHologram(spawner);
|
||||
this.plugin.getDataManager().save(spawner);
|
||||
this.plugin.getDataManager().save((PlacedSpawnerImpl)spawner);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,16 @@
|
||||
package com.craftaro.epicspawners.gui;
|
||||
|
||||
import com.craftaro.core.chat.AdventureUtils;
|
||||
import com.craftaro.core.database.DataManager;
|
||||
import com.craftaro.core.gui.CustomizableGui;
|
||||
import com.craftaro.core.gui.GuiUtils;
|
||||
import com.craftaro.core.hooks.EconomyManager;
|
||||
import com.craftaro.core.utils.SkullItemCreator;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.PlacedSpawner;
|
||||
import com.craftaro.epicspawners.boost.types.BoostedSpawnerImpl;
|
||||
import com.craftaro.epicspawners.settings.Settings;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
|
||||
import com.craftaro.third_party.org.apache.commons.lang3.math.NumberUtils;
|
||||
@ -11,12 +18,6 @@ import com.craftaro.third_party.org.apache.commons.text.WordUtils;
|
||||
import com.craftaro.third_party.org.jooq.Record;
|
||||
import com.craftaro.third_party.org.jooq.Result;
|
||||
import com.craftaro.third_party.org.jooq.impl.DSL;
|
||||
import com.craftaro.core.utils.ItemUtils;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.PlacedSpawner;
|
||||
import com.craftaro.epicspawners.boost.types.BoostedSpawnerImpl;
|
||||
import com.craftaro.epicspawners.settings.Settings;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -68,32 +69,34 @@ public class SpawnerBoostGui extends CustomizableGui {
|
||||
mirrorFill("mirrorfill_4", 1, 0, false, true, glass2);
|
||||
mirrorFill("mirrorfill_5", 1, 1, false, true, glass3);
|
||||
|
||||
setButton("boost5", 10, GuiUtils.createButtonItem(XMaterial.COAL, this.plugin.getLocale().getMessage("interface.boost.boostfor")
|
||||
.processPlaceholder("amount", "5").getMessage(),
|
||||
setButton("boost5", 10, GuiUtils.createButtonItem(XMaterial.COAL,
|
||||
this.plugin.getLocale().getMessage("interface.boost.boostfor")
|
||||
.processPlaceholder("amount", "5"),
|
||||
this.plugin.getLocale().getMessage("interface.boost.cost")
|
||||
.processPlaceholder("cost", getBoostCost(5, this.amount)).getMessage()),
|
||||
.processPlaceholder("cost", getBoostCost(5, this.amount))
|
||||
),
|
||||
event -> purchaseBoost(this.player, 5, this.amount));
|
||||
|
||||
setButton("boost15", 12, GuiUtils.createButtonItem(XMaterial.IRON_INGOT, this.plugin.getLocale().getMessage("interface.boost.boostfor")
|
||||
.processPlaceholder("amount", "15").getMessage(),
|
||||
.processPlaceholder("amount", "15"),
|
||||
this.plugin.getLocale().getMessage("interface.boost.cost")
|
||||
.processPlaceholder("cost", getBoostCost(15, this.amount)).getMessage()),
|
||||
.processPlaceholder("cost", getBoostCost(15, this.amount))),
|
||||
event -> purchaseBoost(this.player, 15, this.amount));
|
||||
|
||||
setButton("boost30", 14, GuiUtils.createButtonItem(XMaterial.DIAMOND, this.plugin.getLocale().getMessage("interface.boost.boostfor")
|
||||
.processPlaceholder("amount", "30").getMessage(),
|
||||
.processPlaceholder("amount", "30"),
|
||||
this.plugin.getLocale().getMessage("interface.boost.cost")
|
||||
.processPlaceholder("cost", getBoostCost(30, this.amount)).getMessage()),
|
||||
.processPlaceholder("cost", getBoostCost(30, this.amount))),
|
||||
event -> purchaseBoost(this.player, 30, this.amount));
|
||||
|
||||
setButton("boost60", 16, GuiUtils.createButtonItem(XMaterial.EMERALD, this.plugin.getLocale().getMessage("interface.boost.boostfor")
|
||||
.processPlaceholder("amount", "60").getMessage(),
|
||||
.processPlaceholder("amount", "60"),
|
||||
this.plugin.getLocale().getMessage("interface.boost.cost")
|
||||
.processPlaceholder("cost", getBoostCost(60, this.amount)).getMessage()),
|
||||
.processPlaceholder("cost", getBoostCost(60, this.amount))),
|
||||
event -> purchaseBoost(this.player, 60, this.amount));
|
||||
|
||||
setButton("back", 4, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back")),
|
||||
event -> this.spawner.overview(this.player));
|
||||
|
||||
if (this.amount != 1)
|
||||
@ -104,13 +107,16 @@ public class SpawnerBoostGui extends CustomizableGui {
|
||||
paint();
|
||||
});
|
||||
|
||||
if (this.amount < Settings.MAX_PLAYER_BOOST.getInt())
|
||||
setButton("plus1", 8, GuiUtils.createButtonItem(ItemUtils.getCustomHead("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"),
|
||||
TextUtils.formatText("&6&l+1")), event -> {
|
||||
if (this.amount < Settings.MAX_PLAYER_BOOST.getInt()) {
|
||||
ItemStack head = SkullItemCreator.byTextureUrlHash("19bf3292e126a105b54eba713aa1b152d541a1d8938829c56364d178ed22bf");
|
||||
AdventureUtils.formatItemName(head, "&6&l+1");
|
||||
|
||||
setButton("plus1", 8, head, event -> {
|
||||
this.amount++;
|
||||
setUp();
|
||||
paint();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void purchaseBoost(Player player, int time, int amt) {
|
||||
@ -194,7 +200,7 @@ public class SpawnerBoostGui extends CustomizableGui {
|
||||
}
|
||||
|
||||
public String getBoostCost(int time, int amount) {
|
||||
StringBuilder cost = new StringBuilder("&6&l");
|
||||
StringBuilder cost = new StringBuilder();
|
||||
String[] parts = Settings.BOOST_COST.getString().split(":");
|
||||
|
||||
String type = parts[0];
|
||||
@ -203,7 +209,7 @@ public class SpawnerBoostGui extends CustomizableGui {
|
||||
int co = boostCost(multi, time, amount);
|
||||
|
||||
if (type.equals("ECO")) {
|
||||
cost.append('$').append(EconomyManager.formatEconomy(co));
|
||||
cost.append(EconomyManager.formatEconomy(co));
|
||||
} else if (type.equals("XP")) {
|
||||
cost.append(co).append(" &7Levels");
|
||||
} else {
|
||||
|
@ -41,7 +41,7 @@ public class SpawnerConvertGui extends CustomizableGui {
|
||||
this.entities.add(spawnerData);
|
||||
}
|
||||
|
||||
setTitle(plugin.getLocale().getMessage("interface.convert.title").getMessage());
|
||||
setTitle(plugin.getLocale().getMessage("interface.convert.title").toString());
|
||||
showPage();
|
||||
}
|
||||
|
||||
@ -64,8 +64,8 @@ public class SpawnerConvertGui extends CustomizableGui {
|
||||
this.pages = (int) Math.max(1, Math.ceil(this.entities.size() / ((double) 28)));
|
||||
|
||||
// enable page event
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").getMessage()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").getMessage()));
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").toString()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").toString()));
|
||||
setOnPage((event) -> showPage());
|
||||
|
||||
// Sort entities by their shopOrder val
|
||||
@ -93,8 +93,8 @@ public class SpawnerConvertGui extends CustomizableGui {
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
double price = spawnerData.getConvertPrice();
|
||||
|
||||
lore.add(this.plugin.getLocale().getMessage("interface.shop.buyprice").processPlaceholder("cost", EconomyManager.formatEconomy(price)).getMessage());
|
||||
String loreString = this.plugin.getLocale().getMessage("interface.convert.lore").getMessage();
|
||||
lore.add(this.plugin.getLocale().getMessage("interface.shop.buyprice").processPlaceholder("cost", EconomyManager.formatEconomy(price)).toText());
|
||||
String loreString = this.plugin.getLocale().getMessage("interface.convert.lore").toText();
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
loreString = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(this.player, loreString.replace(" ", "_")).replace("_", " ");
|
||||
}
|
||||
@ -108,7 +108,7 @@ public class SpawnerConvertGui extends CustomizableGui {
|
||||
}
|
||||
|
||||
setButton("back", 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").toString()),
|
||||
event -> this.guiManager.showGUI(this.player, new SpawnerOverviewGui(this.plugin, this.stack, this.player)));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.craftaro.epicspawners.gui;
|
||||
|
||||
import com.craftaro.core.chat.AdventureUtils;
|
||||
import com.craftaro.core.gui.CustomizableGui;
|
||||
import com.craftaro.core.hooks.EconomyManager;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
@ -80,7 +81,7 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
|
||||
if (this.spawner.getSpawnerStacks().size() != 1) {
|
||||
setButton("back", 0, com.craftaro.core.gui.GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back")),
|
||||
(event) -> this.guiManager.showGUI(event.player, new SpawnerTiersGui(this.plugin, this.player, this.spawner)));
|
||||
}
|
||||
|
||||
@ -105,8 +106,7 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
}
|
||||
}
|
||||
|
||||
ItemMeta itemmeta = spawnerItem.getItemMeta();
|
||||
itemmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.statstitle").getMessage());
|
||||
AdventureUtils.formatItemName(spawnerItem, this.plugin.getLocale().getMessage("interface.spawner.statstitle").getMessage());
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
|
||||
List<XMaterial> blocks = this.tier.getSpawnBlocksList();
|
||||
@ -126,7 +126,7 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
}
|
||||
|
||||
String onlyStr = this.plugin.getLocale().getMessage("interface.spawner.onlyspawnson")
|
||||
.processPlaceholder("block", only.toString()).getMessage();
|
||||
.processPlaceholder("block", only.toString()).toString();
|
||||
|
||||
lore.addAll(TextUtils.wrap("7", onlyStr));
|
||||
|
||||
@ -136,7 +136,7 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
if (met) {
|
||||
met = false;
|
||||
lore.add("");
|
||||
lore.add(this.plugin.getLocale().getMessage("interface.spawner.paused").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("interface.spawner.paused").toString());
|
||||
}
|
||||
lore.addAll(TextUtils.wrap("7", " » " + condition.getDescription()));
|
||||
}
|
||||
@ -145,37 +145,36 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
if (this.spawner.getSpawnerStacks().size() == 1) {
|
||||
lore.add("");
|
||||
lore.add(this.plugin.getLocale().getMessage("interface.spawner.stats")
|
||||
.processPlaceholder("amount", NumberUtils.formatNumber(this.spawner.getSpawnCount())).getMessage());
|
||||
.processPlaceholder("amount", NumberUtils.formatNumber(this.spawner.getSpawnCount())).toString());
|
||||
}
|
||||
|
||||
itemmeta.setLore(lore);
|
||||
spawnerItem.setItemMeta(itemmeta);
|
||||
AdventureUtils.formatItemLore(spawnerItem, lore);
|
||||
|
||||
double levelsCost = this.nextTier == null ? -1 : this.nextTier.getUpgradeCost(CostType.LEVELS) * this.spawner.getStackSize();
|
||||
double economyCost = this.nextTier == null ? -1 : this.nextTier.getUpgradeCost(CostType.ECONOMY) * this.spawner.getStackSize();
|
||||
|
||||
ItemStack itemLevels = Settings.XP_ICON.getMaterial().parseItem();
|
||||
ItemMeta itemmetaXP = itemLevels.getItemMeta();
|
||||
itemmetaXP.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.upgradewithlevels").getMessage());
|
||||
itemmetaXP.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.upgradewithlevels").toString());
|
||||
ArrayList<String> loreXP = new ArrayList<>();
|
||||
if (this.nextTier != null) {
|
||||
loreXP.add(this.plugin.getLocale().getMessage("interface.spawner.upgradewithlevelslore")
|
||||
.processPlaceholder("cost", Double.toString(levelsCost)).getMessage());
|
||||
.processPlaceholder("cost", Double.toString(levelsCost)).toString());
|
||||
} else {
|
||||
loreXP.add(this.plugin.getLocale().getMessage("event.upgrade.maxed").getMessage());
|
||||
loreXP.add(this.plugin.getLocale().getMessage("event.upgrade.maxed").toString());
|
||||
}
|
||||
itemmetaXP.setLore(loreXP);
|
||||
itemLevels.setItemMeta(itemmetaXP);
|
||||
|
||||
ItemStack itemECO = Settings.ECO_ICON.getMaterial().parseItem();
|
||||
ItemMeta itemmetaECO = itemECO.getItemMeta();
|
||||
itemmetaECO.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.upgradewitheconomy").getMessage());
|
||||
itemmetaECO.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.upgradewitheconomy").toString());
|
||||
ArrayList<String> loreECO = new ArrayList<>();
|
||||
if (this.nextTier != null) {
|
||||
loreECO.add(this.plugin.getLocale().getMessage("interface.spawner.upgradewitheconomylore")
|
||||
.processPlaceholder("cost", EconomyManager.formatEconomy(economyCost)).getMessage());
|
||||
.processPlaceholder("cost", EconomyManager.formatEconomy(economyCost)).toString());
|
||||
} else {
|
||||
loreECO.add(this.plugin.getLocale().getMessage("event.upgrade.maxed").getMessage());
|
||||
loreECO.add(this.plugin.getLocale().getMessage("event.upgrade.maxed").toString());
|
||||
}
|
||||
itemmetaECO.setLore(loreECO);
|
||||
itemECO.setItemMeta(itemmetaECO);
|
||||
@ -184,7 +183,7 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
|
||||
if (this.player.hasPermission("epicspawners.convert") && this.data.isConvertible()) {
|
||||
setButton("convert", 4, GuiUtils.createButtonItem(Settings.CONVERT_ICON.getMaterial(),
|
||||
this.plugin.getLocale().getMessage("interface.spawner.convert").getMessage()),
|
||||
this.plugin.getLocale().getMessage("interface.spawner.convert").toString()),
|
||||
(event) -> this.guiManager.showGUI(this.player, new SpawnerConvertGui(this.plugin, this.stack, this.player)));
|
||||
}
|
||||
|
||||
@ -195,9 +194,9 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
if (Settings.DISPLAY_HELP_BUTTON.getBoolean()) {
|
||||
ItemStack itemO = new ItemStack(Material.PAPER, 1);
|
||||
ItemMeta itemmetaO = itemO.getItemMeta();
|
||||
itemmetaO.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.tutorialtitle").getMessage());
|
||||
itemmetaO.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.tutorialtitle").toString());
|
||||
ArrayList<String> loreO = new ArrayList<>();
|
||||
String text = this.plugin.getLocale().getMessage("interface.spawner.tutorial").getMessage();
|
||||
String text = this.plugin.getLocale().getMessage("interface.spawner.tutorial").toString();
|
||||
|
||||
int start = (14 * this.infoPage) - 14;
|
||||
int li = 1; // 12
|
||||
@ -232,9 +231,9 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
}
|
||||
|
||||
if (max) {
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtonext").getMessage());
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtonext").toString());
|
||||
} else {
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtoback").getMessage());
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtoback").toString());
|
||||
}
|
||||
|
||||
itemmetaO.setLore(loreO);
|
||||
@ -272,9 +271,9 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
private void addInfo() {
|
||||
ItemStack itemO = new ItemStack(Material.PAPER, 1);
|
||||
ItemMeta itemmetaO = itemO.getItemMeta();
|
||||
itemmetaO.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.tutorialtitle").getMessage());
|
||||
itemmetaO.setDisplayName(this.plugin.getLocale().getMessage("interface.spawner.tutorialtitle").toString());
|
||||
List<String> loreO = new ArrayList<>();
|
||||
String text = this.plugin.getLocale().getMessage("interface.spawner.tutorial").getMessage();
|
||||
String text = this.plugin.getLocale().getMessage("interface.spawner.tutorial").toString();
|
||||
|
||||
int start = (14 * this.infoPage) - 14;
|
||||
int li = 1; // 12
|
||||
@ -309,9 +308,9 @@ public class SpawnerOverviewGui extends CustomizableGui {
|
||||
}
|
||||
|
||||
if (max) {
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtonext").getMessage());
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtonext").toString());
|
||||
} else {
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtoback").getMessage());
|
||||
loreO.add(this.plugin.getLocale().getMessage("interface.spawner.howtoback").toString());
|
||||
}
|
||||
|
||||
itemmetaO.setLore(loreO);
|
||||
|
@ -39,7 +39,7 @@ public class SpawnerShopGui extends CustomizableGui {
|
||||
this.entities.add(spawnerData);
|
||||
}
|
||||
|
||||
setTitle(plugin.getLocale().getMessage("interface.shop.title").getMessage());
|
||||
setTitle(plugin.getLocale().getMessage("interface.shop.title").toString());
|
||||
showPage();
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@ public class SpawnerShopGui extends CustomizableGui {
|
||||
this.pages = (int) Math.max(1, Math.ceil(this.entities.size() / ((double) 28)));
|
||||
|
||||
// enable page event
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").getMessage()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").getMessage()));
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").toString()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").toString()));
|
||||
setOnPage((event) -> showPage());
|
||||
|
||||
// Sort entities by their shopOrder val
|
||||
@ -91,8 +91,8 @@ public class SpawnerShopGui extends CustomizableGui {
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
double price = spawnerData.getShopPrice();
|
||||
lore.add(TextUtils.formatText(this.plugin.getLocale().getMessage("interface.shop.buyprice")
|
||||
.processPlaceholder("cost", EconomyManager.formatEconomy(price)).getMessage()));
|
||||
String loreString = this.plugin.getLocale().getMessage("interface.shop.lore").getMessage();
|
||||
.processPlaceholder("cost", EconomyManager.formatEconomy(price)).toString()));
|
||||
String loreString = this.plugin.getLocale().getMessage("interface.shop.lore").toString();
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
loreString = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(this.player, loreString.replace(" ", "_")).replace("_", " ");
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class SpawnerShopGui extends CustomizableGui {
|
||||
}
|
||||
|
||||
setButton("exit", 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(),
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit").toString()),
|
||||
event -> this.player.closeInventory());
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
|
||||
setTitle(plugin.getLocale().getMessage("interface.shop.spawnershoptitle")
|
||||
.processPlaceholder("type", spawnerTier.getCompiledDisplayName())
|
||||
.getMessage());
|
||||
.toString());
|
||||
|
||||
paint();
|
||||
}
|
||||
@ -72,14 +72,14 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
itemmeta.setDisplayName(name);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(this.plugin.getLocale().getMessage("interface.shop.buyprice")
|
||||
.processPlaceholder("cost", EconomyManager.formatEconomy(price)).getMessage());
|
||||
.processPlaceholder("cost", EconomyManager.formatEconomy(price)).toString());
|
||||
itemmeta.setLore(lore);
|
||||
item.setItemMeta(itemmeta);
|
||||
setItem("spawner", 22, item);
|
||||
|
||||
ItemStack plus = XMaterial.LIME_STAINED_GLASS_PANE.parseItem();
|
||||
ItemMeta plusmeta = plus.getItemMeta();
|
||||
plusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.add1").getMessage());
|
||||
plusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.add1").toString());
|
||||
plus.setItemMeta(plusmeta);
|
||||
if (item.getAmount() + 1 <= 64) {
|
||||
setButton("add1", 15, plus, event -> {
|
||||
@ -90,7 +90,7 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
|
||||
plus = XMaterial.LIME_STAINED_GLASS_PANE.parseItem();
|
||||
plus.setAmount(10);
|
||||
plusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.add10").getMessage());
|
||||
plusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.add10").toString());
|
||||
plus.setItemMeta(plusmeta);
|
||||
if (item.getAmount() + 10 <= 64) {
|
||||
setButton("add10", 33, plus, event -> {
|
||||
@ -101,7 +101,7 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
|
||||
plus = XMaterial.LIME_STAINED_GLASS_PANE.parseItem();
|
||||
plus.setAmount(64);
|
||||
plusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.set64").getMessage());
|
||||
plusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.set64").toString());
|
||||
plus.setItemMeta(plusmeta);
|
||||
if (item.getAmount() != 64) {
|
||||
setButton("set64", 25, plus, event -> {
|
||||
@ -113,7 +113,7 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
ItemStack minus = XMaterial.RED_STAINED_GLASS_PANE.parseItem();
|
||||
minus.setAmount(1);
|
||||
ItemMeta minusmeta = minus.getItemMeta();
|
||||
minusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.remove1").getMessage());
|
||||
minusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.remove1").toString());
|
||||
minus.setItemMeta(minusmeta);
|
||||
if (item.getAmount() != 1) {
|
||||
setButton("remove1", 11, minus, event -> {
|
||||
@ -124,7 +124,7 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
|
||||
minus = XMaterial.RED_STAINED_GLASS_PANE.parseItem();
|
||||
minus.setAmount(10);
|
||||
minusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.remove10").getMessage());
|
||||
minusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.remove10").toString());
|
||||
minus.setItemMeta(minusmeta);
|
||||
if (item.getAmount() - 10 >= 0) {
|
||||
setButton("remove10", 29, minus, event -> {
|
||||
@ -135,7 +135,7 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
|
||||
minus = XMaterial.RED_STAINED_GLASS_PANE.parseItem();
|
||||
minus.setAmount(1);
|
||||
minusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.set1").getMessage());
|
||||
minusmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.shop.set1").toString());
|
||||
minus.setItemMeta(minusmeta);
|
||||
if (item.getAmount() != 1) {
|
||||
setButton("set1", 19, minus, event -> {
|
||||
@ -145,14 +145,14 @@ public class SpawnerShopItemGui extends CustomizableGui {
|
||||
}
|
||||
|
||||
setButton("exit", 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(),
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit").getMessage()), event -> event.player.closeInventory());
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit").toString()), event -> event.player.closeInventory());
|
||||
|
||||
setButton("back", 0, GuiUtils.createButtonItem(XMaterial.ARROW,
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
|
||||
this.plugin.getLocale().getMessage("general.nametag.back").toString()),
|
||||
event -> this.guiManager.showGUI(event.player, this.back));
|
||||
|
||||
setButton("buy", 40, GuiUtils.createButtonItem(Settings.BUY_ICON.getMaterial(),
|
||||
this.plugin.getLocale().getMessage("general.nametag.confirm").getMessage()), event -> {
|
||||
this.plugin.getLocale().getMessage("general.nametag.confirm").toString()), event -> {
|
||||
Player player = event.player;
|
||||
confirm(player, this.amount);
|
||||
player.closeInventory();
|
||||
|
@ -37,7 +37,7 @@ public class SpawnerStatsGui extends CustomizableGui {
|
||||
}
|
||||
}
|
||||
|
||||
setTitle(plugin.getLocale().getMessage("interface.spawnerstats.title").getMessage());
|
||||
setTitle(plugin.getLocale().getMessage("interface.spawnerstats.title").toString());
|
||||
showPage();
|
||||
}
|
||||
|
||||
@ -60,12 +60,12 @@ public class SpawnerStatsGui extends CustomizableGui {
|
||||
this.pages = (int) Math.max(1, Math.ceil(this.entities.size() / ((double) 28)));
|
||||
|
||||
// enable page event
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").getMessage()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").getMessage()));
|
||||
setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").toString()));
|
||||
setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").toString()));
|
||||
setOnPage((event) -> showPage());
|
||||
|
||||
setButton("exit", 8, GuiUtils.createButtonItem(XMaterial.valueOf(this.plugin.getConfig().getString("Interfaces.Exit Icon")),
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit").getMessage()), (event) -> this.player.closeInventory());
|
||||
this.plugin.getLocale().getMessage("general.nametag.exit").toString()), (event) -> this.player.closeInventory());
|
||||
|
||||
Set<Map.Entry<SpawnerData, Integer>> entries = this.entities.entrySet().stream().skip((this.page - 1) * 28).limit(28)
|
||||
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
|
@ -32,7 +32,7 @@ public class SpawnerTiersGui extends CustomizableGui {
|
||||
this.player = player;
|
||||
this.spawner = spawner;
|
||||
|
||||
setTitle(plugin.getLocale().getMessage("interface.tiers.title").getMessage());
|
||||
setTitle(plugin.getLocale().getMessage("interface.tiers.title").toString());
|
||||
setOnClose(event -> {
|
||||
Bukkit.getScheduler().cancelTask(this.task);
|
||||
plugin.getSpawnerManager().saveSpawnerDataToFile();
|
||||
@ -87,9 +87,9 @@ public class SpawnerTiersGui extends CustomizableGui {
|
||||
|
||||
GuiUtils.applyBoosted(5, this, this.plugin, this.player, this.spawner);
|
||||
|
||||
setItem("stats", 3, GuiUtils.createButtonItem(XMaterial.PAPER, this.plugin.getLocale().getMessage("interface.spawner.statstitle").getMessage(),
|
||||
setItem("stats", 3, GuiUtils.createButtonItem(XMaterial.PAPER, this.plugin.getLocale().getMessage("interface.spawner.statstitle").toString(),
|
||||
this.plugin.getLocale().getMessage("interface.spawner.stats")
|
||||
.processPlaceholder("amount", NumberUtils.formatNumber(this.spawner.getSpawnCount())).getMessage()));
|
||||
.processPlaceholder("amount", NumberUtils.formatNumber(this.spawner.getSpawnCount())).toString()));
|
||||
}
|
||||
|
||||
private void runTask() {
|
||||
|
@ -176,7 +176,7 @@ public class BlockListeners implements Listener {
|
||||
|
||||
if (maxSpawners != -1 && amountPlaced > maxSpawners) {
|
||||
player.sendMessage(this.plugin.getLocale().getMessage("event.spawner.toomany")
|
||||
.processPlaceholder("amount", maxSpawners).getMessage());
|
||||
.processPlaceholder("amount", maxSpawners).toString());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -208,7 +208,7 @@ public class BlockListeners implements Listener {
|
||||
try {
|
||||
creatureSpawner.setSpawnedType(spawnerTier.getEntities().get(0));
|
||||
} catch (Exception ex) {
|
||||
creatureSpawner.setSpawnedType(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
creatureSpawner.setSpawnedType(ServerVersion.isServerVersionBelow(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
}
|
||||
|
||||
spawner.updateDelay();
|
||||
|
@ -173,11 +173,11 @@ public class EntityListeners implements Listener {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(this.plugin.getLocale().getMessage("event.goal.alert")
|
||||
.processPlaceholder("goal", goal - amt)
|
||||
.processPlaceholder("type", spawnerTier.getDisplayName()).getMessage()));
|
||||
.processPlaceholder("type", spawnerTier.getDisplayName()).toString()));
|
||||
} else {
|
||||
player.sendTitle("", this.plugin.getLocale().getMessage("event.goal.alert")
|
||||
.processPlaceholder("goal", goal - amt)
|
||||
.processPlaceholder("type", spawnerTier.getDisplayName()).getMessage());
|
||||
.processPlaceholder("type", spawnerTier.getDisplayName()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ public class EntityListeners implements Listener {
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(this.plugin.getLocale().getMessage("event.goal.reached")
|
||||
.processPlaceholder("type", spawnerTier.getIdentifyingName()).getMessage()));
|
||||
.processPlaceholder("type", spawnerTier.getIdentifyingName()).toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class InteractListeners implements Listener {
|
||||
}
|
||||
|
||||
if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && !ProtectionManager.canInteract(player, block.getLocation())) {
|
||||
player.sendMessage(this.plugin.getLocale().getMessage("event.general.protected").getPrefixedMessage());
|
||||
this.plugin.getLocale().getMessage("event.general.protected").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ public class InteractListeners implements Listener {
|
||||
|
||||
if (!player.isSneaking()) {
|
||||
if (!spawner.getPlacedBy().getUniqueId().equals(event.getPlayer().getUniqueId())) {
|
||||
player.sendMessage(this.plugin.getLocale().getMessage("event.general.protected").getPrefixedMessage());
|
||||
this.plugin.getLocale().getMessage("event.general.protected").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
SpawnerTier spawnerTier = this.plugin.getSpawnerManager().getSpawnerTier(item);
|
||||
@ -225,7 +225,7 @@ public class InteractListeners implements Listener {
|
||||
}
|
||||
if (player.hasPermission("epicspawners.stack." + spawnerTier.getIdentifyingName()) || player.hasPermission("epicspawners.stack.*")) {
|
||||
if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && !ProtectionManager.canInteract(player, block.getLocation())) {
|
||||
player.sendMessage(this.plugin.getLocale().getMessage("event.general.protected").getPrefixedMessage());
|
||||
this.plugin.getLocale().getMessage("event.general.protected").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ public class InteractListeners implements Listener {
|
||||
}
|
||||
|
||||
if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && !ProtectionManager.canInteract(player, block.getLocation())) {
|
||||
player.sendMessage(this.plugin.getLocale().getMessage("event.general.protected").getPrefixedMessage());
|
||||
this.plugin.getLocale().getMessage("event.general.protected").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WorldListeners implements Listener {
|
||||
private final EpicSpawners plugin;
|
||||
|
||||
@ -16,10 +19,12 @@ public class WorldListeners implements Listener {
|
||||
@EventHandler
|
||||
public void onWorldLoad(WorldLoadEvent e) {
|
||||
// Unload previous spawners belonging to this world.
|
||||
List<PlacedSpawner> remove = new ArrayList<>();
|
||||
for (PlacedSpawner ps : this.plugin.getSpawnerManager().getSpawners()) {
|
||||
if (e.getWorld().getName().equals(ps.getWorld().getName())) {
|
||||
this.plugin.getSpawnerManager().removeSpawnerFromWorld(ps);
|
||||
if (ps.getWorld() == null || e.getWorld().getName().equals(ps.getWorld().getName())) {
|
||||
remove.add(ps);
|
||||
}
|
||||
}
|
||||
this.plugin.getSpawnerManager().removeSpawnersFromWorld(remove);
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ public class SpawnConditionBiome implements SpawnCondition {
|
||||
public String getDescription() {
|
||||
return (this.biomes.size() == 1)
|
||||
? EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionBiome1")
|
||||
.processPlaceholder("biome", getFriendlyBiomeName()).getMessage()
|
||||
.processPlaceholder("biome", getFriendlyBiomeName()).toString()
|
||||
: EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionBiome2")
|
||||
.getMessage();
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ public class SpawnConditionHeight implements SpawnCondition {
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionHeight")
|
||||
.processPlaceholder("min", this.min)
|
||||
.processPlaceholder("max", this.max)
|
||||
.getMessage();
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,9 +21,9 @@ public class SpawnConditionLightDark implements SpawnCondition {
|
||||
public String getDescription() {
|
||||
switch (this.lightDark) {
|
||||
case LIGHT:
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionLight").getMessage();
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionLight").toString();
|
||||
case DARK:
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionDark").getMessage();
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionDark").toString();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ public class SpawnConditionNearbyEntities implements SpawnCondition {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionNearbyEntities")
|
||||
.processPlaceholder("max", this.max).getMessage();
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionNearbyEntities").processPlaceholder("max", this.max).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,7 @@ public class SpawnConditionNearbyPlayers implements SpawnCondition {
|
||||
return EpicSpawners.getInstance().getLocale().getMessage("interface.spawner.conditionNearbyPlayers")
|
||||
.processPlaceholder("amount", this.amount)
|
||||
.processPlaceholder("distance", this.distance)
|
||||
.getMessage();
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +49,7 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlacedSpawnerImpl implements PlacedSpawner {
|
||||
public class PlacedSpawnerImpl implements PlacedSpawner, Data {
|
||||
// This is the unique identifier for this hologram.
|
||||
// It is reset on every plugin load.
|
||||
// Used for holograms.
|
||||
@ -497,24 +497,25 @@ public class PlacedSpawnerImpl implements PlacedSpawner {
|
||||
if (boost instanceof BoostedPlayerImpl && this.placedBy == null) {
|
||||
continue;
|
||||
}
|
||||
BoostedSpawnerImpl boostedSpawner = (BoostedSpawnerImpl) boost;
|
||||
if (System.currentTimeMillis() >= boost.getEndTime()) {
|
||||
instance.getBoostManager().removeBoost(boost);
|
||||
instance.getDataManager().getAsyncPool().execute(() -> {
|
||||
instance.getDataManager().getDatabaseConnector().connectDSL(dslContext -> {
|
||||
dslContext.deleteFrom(DSL.table(instance.getDataManager().getTablePrefix() + "boosted_spawners"))
|
||||
.where(DSL.field("world").eq(boostedSpawner.getLocation().getWorld().getName()))
|
||||
.and(DSL.field("x").eq(boostedSpawner.getLocation().getBlockX()))
|
||||
.and(DSL.field("y").eq(boostedSpawner.getLocation().getBlockY()))
|
||||
.and(DSL.field("z").eq(boostedSpawner.getLocation().getBlockZ()))
|
||||
.execute();
|
||||
});
|
||||
});
|
||||
continue;
|
||||
}
|
||||
Boosted boosted = boost;
|
||||
|
||||
if (boost instanceof BoostedSpawnerImpl) {
|
||||
if (!this.location.equals(((BoostedSpawnerImpl) boost).getLocation())) {
|
||||
BoostedSpawnerImpl boostedSpawner = (BoostedSpawnerImpl) boost;
|
||||
if (System.currentTimeMillis() >= boost.getEndTime()) {
|
||||
instance.getBoostManager().removeBoost(boost);
|
||||
instance.getDataManager().getAsyncPool().execute(() -> {
|
||||
instance.getDataManager().getDatabaseConnector().connectDSL(dslContext -> {
|
||||
dslContext.deleteFrom(DSL.table(instance.getDataManager().getTablePrefix() + "boosted_spawners"))
|
||||
.where(DSL.field("world").eq(boostedSpawner.getLocation().getWorld().getName()))
|
||||
.and(DSL.field("x").eq(boostedSpawner.getLocation().getBlockX()))
|
||||
.and(DSL.field("y").eq(boostedSpawner.getLocation().getBlockY()))
|
||||
.and(DSL.field("z").eq(boostedSpawner.getLocation().getBlockZ()))
|
||||
.execute();
|
||||
});
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (!this.location.equals(boostedSpawner.getLocation())) {
|
||||
continue;
|
||||
}
|
||||
} else if (boost instanceof BoostedPlayerImpl) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner;
|
||||
|
||||
import com.craftaro.core.compatibility.ServerVersion;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerData;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerTier;
|
||||
@ -238,7 +239,11 @@ public class SpawnerDataImpl implements SpawnerData {
|
||||
public void addDefaultTier() {
|
||||
SpawnerTier tier = new SpawnerTierImpl(this);
|
||||
tier.addCondition(new SpawnConditionNearbyPlayers(16, 1));
|
||||
tier.addCondition(new SpawnConditionHeight(0, 265));
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_17)) {
|
||||
tier.addCondition(new SpawnConditionHeight(0, 265));
|
||||
} else {
|
||||
tier.addCondition(new SpawnConditionHeight(-64, 320));
|
||||
}
|
||||
tier.addCondition(new SpawnConditionBiome(Biome.values()));
|
||||
tier.addCondition(new SpawnConditionLightDark(SpawnConditionLightDark.Type.BOTH));
|
||||
tier.addCondition(new SpawnConditionStorm(false));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner;
|
||||
|
||||
import com.craftaro.core.compatibility.CompatibleBiome;
|
||||
import com.craftaro.core.compatibility.ServerVersion;
|
||||
import com.craftaro.core.configuration.Config;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
||||
@ -173,6 +174,11 @@ public class SpawnerManagerImpl implements SpawnerManager {
|
||||
return this.spawnersInWorld.remove(spawner.getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSpawnersFromWorld(List<PlacedSpawner> spawners) {
|
||||
spawners.forEach(spawner -> this.spawnersInWorld.remove(spawner.getLocation()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PlacedSpawner> getSpawners() {
|
||||
return Collections.unmodifiableCollection(this.spawnersInWorld.values());
|
||||
@ -184,7 +190,7 @@ public class SpawnerManagerImpl implements SpawnerManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpawners(List<PlacedSpawner> spawners) {
|
||||
public <T extends PlacedSpawner> void addSpawners(List<T> spawners) {
|
||||
spawners.forEach(spawner -> this.spawnersInWorld.put(spawner.getLocation(), (PlacedSpawnerImpl) spawner));
|
||||
}
|
||||
|
||||
@ -262,7 +268,11 @@ public class SpawnerManagerImpl implements SpawnerManager {
|
||||
} else {
|
||||
tier.addCondition(new SpawnConditionBiome(Biome.values()));
|
||||
// TODO: These values should probably be *world* dependent as even in older versions, the max build height could be higher (vanilla spawners probably work up there too?)
|
||||
tier.addCondition(new SpawnConditionHeight(-64, 320));
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_17)) {
|
||||
tier.addCondition(new SpawnConditionHeight(0, 265));
|
||||
} else {
|
||||
tier.addCondition(new SpawnConditionHeight(-64, 320));
|
||||
}
|
||||
}
|
||||
if (Monster.class.isAssignableFrom(type.getEntityClass())) {
|
||||
tier.addCondition(new SpawnConditionLightDark(SpawnConditionLightDark.Type.DARK));
|
||||
|
@ -229,7 +229,7 @@ public class SpawnerTierImpl implements SpawnerTier {
|
||||
String displayName = getDisplayName();
|
||||
|
||||
nameFormat = nameFormat.replace("{TYPE}", omni ?
|
||||
EpicSpawners.getInstance().getLocale().getMessage("general.nametag.omni").getMessage() : displayName);
|
||||
EpicSpawners.getInstance().getLocale().getMessage("general.nametag.omni").toText() : displayName);
|
||||
|
||||
if (stackSize > 1 || Settings.DISPLAY_TIER_ONE.getBoolean() && stackSize >= 0) {
|
||||
nameFormat = nameFormat.replace("{AMT}", Integer.toString(stackSize))
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner.option;
|
||||
|
||||
import com.craftaro.epicspawners.spawners.spawner.PlacedSpawnerImpl;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XBlock;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
@ -68,7 +69,7 @@ public class SpawnOptionBlock implements SpawnOption {
|
||||
}
|
||||
}
|
||||
|
||||
EpicSpawners.getInstance().getDataManager().save(spawner);
|
||||
EpicSpawners.getInstance().getDataManager().save((PlacedSpawnerImpl)spawner);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner.option;
|
||||
|
||||
import com.craftaro.epicspawners.spawners.spawner.PlacedSpawnerImpl;
|
||||
import com.craftaro.third_party.org.apache.commons.lang3.math.NumberUtils;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
import com.craftaro.epicspawners.api.boosts.types.Boosted;
|
||||
@ -91,7 +92,7 @@ public class SpawnOptionCommand implements SpawnOption {
|
||||
}
|
||||
}
|
||||
|
||||
EpicSpawners.getInstance().getDataManager().save(spawner);
|
||||
EpicSpawners.getInstance().getDataManager().save((PlacedSpawnerImpl)spawner);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner.option;
|
||||
|
||||
import com.craftaro.core.math.MathUtils;
|
||||
import com.craftaro.core.utils.EntityUtils;
|
||||
import com.craftaro.core.nms.Nms;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
import com.craftaro.epicspawners.api.boosts.types.Boosted;
|
||||
import com.craftaro.epicspawners.api.events.SpawnerSpawnEvent;
|
||||
@ -14,6 +14,7 @@ import com.craftaro.epicspawners.api.spawners.spawner.option.SpawnOption;
|
||||
import com.craftaro.epicspawners.api.spawners.spawner.option.SpawnOptionType;
|
||||
import com.craftaro.epicspawners.settings.Settings;
|
||||
import com.craftaro.epicspawners.spawners.condition.SpawnConditionNearbyEntities;
|
||||
import com.craftaro.epicspawners.spawners.spawner.PlacedSpawnerImpl;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -62,7 +63,7 @@ public class SpawnOptionEntity implements SpawnOption {
|
||||
equation = equation.replace("{RAND}", Integer.toString(randomAmt));
|
||||
equation = equation.replace("{STACK_SIZE}", Integer.toString(stack.getStackSize()));
|
||||
|
||||
spawnCount += MathUtils.eval(equation, "EpicSpawners (Mobs Spawned Per Single Spawn) Equation");
|
||||
spawnCount += (int) MathUtils.eval(equation, "EpicSpawners (Mobs Spawned Per Single Spawn) Equation");
|
||||
}
|
||||
|
||||
// Get the max entities allowed around a spawner.
|
||||
@ -107,7 +108,7 @@ public class SpawnOptionEntity implements SpawnOption {
|
||||
}
|
||||
|
||||
if (Settings.NO_AI.getBoolean()) {
|
||||
EntityUtils.setUnaware(entity);
|
||||
Nms.getImplementations().getEntity().setMobAware(entity,false);
|
||||
}
|
||||
|
||||
this.plugin.getSpawnManager().addUnnaturalSpawn(entity.getUniqueId());
|
||||
@ -115,7 +116,7 @@ public class SpawnOptionEntity implements SpawnOption {
|
||||
}, this.types);
|
||||
|
||||
spawner.setSpawnCount(spawner.getSpawnCount() + amountSpawned);
|
||||
EpicSpawners.getInstance().getDataManager().save(spawner);
|
||||
EpicSpawners.getInstance().getDataManager().save((PlacedSpawnerImpl)spawner);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.craftaro.epicspawners.spawners.spawner.option;
|
||||
|
||||
import com.craftaro.core.compatibility.ServerVersion;
|
||||
import com.craftaro.epicspawners.spawners.spawner.PlacedSpawnerImpl;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
|
||||
import com.craftaro.epicspawners.EpicSpawners;
|
||||
import com.craftaro.epicspawners.api.boosts.types.Boosted;
|
||||
@ -66,7 +67,7 @@ public class SpawnOptionItem implements SpawnOption {
|
||||
}
|
||||
}
|
||||
|
||||
EpicSpawners.getInstance().getDataManager().save(spawner);
|
||||
EpicSpawners.getInstance().getDataManager().save((PlacedSpawnerImpl)spawner);
|
||||
}
|
||||
|
||||
public SpawnOptionType getType() {
|
||||
|
@ -120,7 +120,7 @@ public class AppearanceTask extends BukkitRunnable {
|
||||
EntityType next = spawnerTier.getEntities().get(0);
|
||||
spawner.getCreatureSpawner().setSpawnedType(next);
|
||||
} catch (Exception failure) {
|
||||
spawner.getCreatureSpawner().setSpawnedType(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
spawner.getCreatureSpawner().setSpawnedType(ServerVersion.isServerVersionBelow(ServerVersion.V1_9) ? EntityType.EGG : EntityType.DROPPED_ITEM);
|
||||
if (itemStack.getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
|
@ -35,9 +35,9 @@ public class GuiUtils extends com.craftaro.core.gui.GuiUtils {
|
||||
String[] parts = plugin.getLocale().getMessage("interface.spawner.boostedstats")
|
||||
.processPlaceholder("amount", Integer.toString(boostTotal))
|
||||
.processPlaceholder("time", boostEnd == Long.MAX_VALUE
|
||||
? plugin.getLocale().getMessage("interface.spawner.boostednever")
|
||||
? plugin.getLocale().getMessage("interface.spawner.boostednever").toString()
|
||||
: TimeUtils.makeReadable(boostEnd - System.currentTimeMillis()))
|
||||
.getMessage().split("\\|");
|
||||
.toString().split("\\|");
|
||||
|
||||
lore.addAll(TextUtils.formatText(parts));
|
||||
|
||||
@ -45,8 +45,8 @@ public class GuiUtils extends com.craftaro.core.gui.GuiUtils {
|
||||
} else {
|
||||
gui.setButton("boost", slot, createButtonItem(Settings.BOOST_ICON.getMaterial(),
|
||||
spawner.getBoosts().stream().mapToInt(Boosted::getAmountBoosted).sum() == 0
|
||||
? plugin.getLocale().getMessage("interface.spawner.boost").getMessage()
|
||||
: plugin.getLocale().getMessage("interface.spawner.cantboost").getMessage(), lore), event ->
|
||||
? plugin.getLocale().getMessage("interface.spawner.boost").toString()
|
||||
: plugin.getLocale().getMessage("interface.spawner.cantboost").toString(), lore), event ->
|
||||
plugin.getGuiManager().showGUI(player, new SpawnerBoostGui(plugin, spawner, player)));
|
||||
}
|
||||
}
|
||||
|
4
pom.xml
4
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>com.craftaro</groupId>
|
||||
<artifactId>EpicSpawners-Parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>8.2.2</version>
|
||||
<version>8.5.0</version>
|
||||
|
||||
<modules>
|
||||
<module>EpicSpawners-API</module>
|
||||
@ -19,7 +19,7 @@
|
||||
<url>https://craftaro.com/marketplace/product/13</url>
|
||||
|
||||
<properties>
|
||||
<craftaro.coreVersion>3.0.0-SNAPSHOT</craftaro.coreVersion>
|
||||
<craftaro.coreVersion>3.5.0-SNAPSHOT</craftaro.coreVersion>
|
||||
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
Loading…
Reference in New Issue
Block a user