diff --git a/README.md b/README.md index 2f73460..095c01a 100644 --- a/README.md +++ b/README.md @@ -112,4 +112,185 @@ Database: Password: password # End of configuration -``` \ No newline at end of file +``` + +## Arena setup + +* Create an arena + * Use the **/bp create \** + * Replace \ with the name of your arena +* Set the lobby spawn + * Place yourself where you want to have your lobby spawn. Use **/bp setspawn \ lobby** + * Players get teleported to this position when they enter the lobby +* Set the boundaries of the arena floor + * Use **/bp pos <1|2>** to set the positions to your current positions. OR: + * Use **/bp wand** to get a stick to set the positions via left and right click + * Finally use **/bp setfloor \** to set the floor boundaries for you arena +* Set the game spawn + * Place yourself where you want to have your game spawn. Use **/bp setspawn \ game** + * Players get teleported to this position when the game starts +* Enable your arena + * To be able to play in an arena you need to enable it first. Use **/bp enable \** + +Thats it for the arena setup. To customize your arena, use ingame commands or head to the **\.yml** located in your `plugins/BlockParty/Arenas/` folder. Here you can find an example arena config: +
+Example arena config + +```yaml +Settings: + DistanceToOutArea: 5 + TimeToSearch: 8 + LevelAmount: 15 + MinPlayers: 2 + MaxPlayers: 20 + LobbyCountdown: 30 + TimeReductionPerLevel: 0.5 + TimeModifier: 0.1 + Enabled: true + EnableParticles: true + EnableLightnings: true + AutoRestart: false + AutoKick: false + EnableBoosts: true + EnableFallingBlocks: false + UseAutoGeneratedFloors: true + UsePatternFloors: true + EnableActionbarInfo: true + UseNoteBlockSongs: false + UseWebSongs: true + EnableFireworksOnWin: true + TimerResetOnPlayerJoin: false + AllowJoinDuringGame: true + EnableScoreboard: false + Name: example + SongManager: + - examplesong.mp3 + Signs: [] + LobbySpawn: + World: world1.13 + X: 119.96556415260845 + Y: 64.0 + Z: 26.73431969945681 + Yaw: -57.567917 + Pitch: 35.83339 + GameSpawn: + World: world1.13 + X: 126.06898491630506 + Y: 63.0 + Z: 30.055373974750374 + Yaw: -57.567917 + Pitch: 35.83339 + Floor: + A: + World: world1.13 + X: 124.0 + Y: 62.0 + Z: 28.0 + Yaw: 0.0 + Pitch: 0.0 + B: + World: world1.13 + X: 127.0 + Y: 62.0 + Z: 31.0 + Yaw: 0.0 + Pitch: 0.0 + Patterns: + - exampleFloor + Width: 4.0 + Length: 4.0 +``` + +
+ +## Floor setup + +In BlockParty we are using our own format to save block data. We are making use of the Run-length encoding to keep the file as small as possible. You can create your own floors, save and use them. + +#### Creating your own floor + +* Build a two dimensional pattern using terracotta, wool and/or glass (all blocks supported in > 1.13) +* Set the boundaries of pattern + * Use **/bp pos <1|2>** to set the positions to your current positions. OR: + * Use **/bp wand** to get a stick to set the positions via left and right click +* Save your pattern + * Finally use **/bp save \** to save your pattern to the `/plugins/BlockParty/Floors/` folder + +#### Add a floor to your arena + +* Test your pattern + * This is optional but you may want to test your floor + * Use **/bp placepattern \** to test it +* Activate UsePatternFloors + * Make sure you set `UsePatternFloors: true` in your arena config + * You can also add patterns in your arena config + * Reload with **/bp reload** if you have just changed a value +* Selecting an initial pattern + * If you name a pattern start it will load first +* Selecting the game over pattern + * If you name a pattern end it will load when the game is over + +#### Remove a pattern + +* List the active patterns + * Use **/bp listpatterns \** to list all active patterns for this arena +* Remove a paattern + * Use **/bp removepattern \ \** to list all active patterns for this arena + +## Web player setup + +This is a basic tutorial on how to set up the build in web player. + +* Enable the web player + * Head over to the config.yml located in you `plugins/BlockParty/` folder + * Make sure to enable your enable the MusicServer + * Make sure to use jetty, other librarys are in development, and a non-blocked port + * Your section should look like this now: +```yaml +MusicServer: + # When "True", music playback in browser will be activated. You will need a web server for this + Enabled: True + + # Available libraries: "websocket", "jetty", "tcp/ip", "mcjukebox" + WebSocketLibrary: jetty + + # Web server port (Not Minecraft server port!) + Port: 8080 +``` +#### Adding songs + +* Add songs to your web player songs folder + * Head over to `plugins/BlockParty/web/songs/` + * Place any songs here (e.g. example.mp3) +* Add songs to your arena + * Add them ingame by typing **/bp addsong \ \** + * **Important:** Make sure to also include the file type. You command should look something like this: /bp addsong exampleArena example.mp3 + * Add them to your arena config. The config section should look something like this: +```yaml + SongManager: + - examplesong.mp3 +``` +* Enable the use of web player songs + * Make sure `UseWebSongs: true` is set to true in your arena config + +## Sign setup + +You can also use signs to let players join to the arena. Your sign should look something like this: + +| Line | Text | +|:----:|:------------:| +| 1 | [BlockParty] | +| 2 | \ | +| 3 | | +| 4 | | + +#### Customize your sign messages + +Head over to your config.yml in the `plugins/BlockParty/` folder. You can edit the used text that is displayed on the sign right there. + +## Permissions + +* **blockparty.admin** + * This provides access to all BlockParty commands (/bp admin) +* **blockparty.user** + * This provides access to basic BlockParty commands (/bp help) \ No newline at end of file diff --git a/api/pom.xml b/api/pom.xml index 2ce1a17..d25832a 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -5,7 +5,7 @@ blockparty-parent de.leonkoth - 2.0.3.1-RELEASE + 2.0.3.2-RELEASE 4.0.0 diff --git a/core/pom.xml b/core/pom.xml index 8a99b76..910cd86 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ blockparty-parent de.leonkoth - 2.0.3.1-RELEASE + 2.0.3.2-RELEASE 4.0.0 @@ -35,21 +35,10 @@ TimoCloud-API https://maven.timo.cloud/repository/TimoCloud-API/ - - placeholderapi - http://repo.extendedclip.com/content/repositories/placeholderapi/ - - - - me.clip - placeholderapi - 2.10.3 - provided - - + org.spigotmc diff --git a/core/src/main/java/de/leonkoth/blockparty/BlockParty.java b/core/src/main/java/de/leonkoth/blockparty/BlockParty.java index abcfadf..9d2f083 100644 --- a/core/src/main/java/de/leonkoth/blockparty/BlockParty.java +++ b/core/src/main/java/de/leonkoth/blockparty/BlockParty.java @@ -11,7 +11,6 @@ import de.leonkoth.blockparty.listener.*; import de.leonkoth.blockparty.locale.BlockPartyLocale; import de.leonkoth.blockparty.player.PlayerInfo; -import de.leonkoth.blockparty.util.BlockPartyExpansion; import de.leonkoth.blockparty.util.DefaultManager; import de.leonkoth.blockparty.version.BlockInfo; import de.leonkoth.blockparty.version.IBlockPlacer; @@ -176,12 +175,6 @@ public void start() { // Init commands new BlockPartyCommand(this); - - if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { - if(new BlockPartyExpansion(this).register()){ - Bukkit.getConsoleSender().sendMessage("[BlockParty] Successfully loaded BlockPartyExpansion for the PlaceholderAPI"); - } - } } public void stop() { diff --git a/core/src/main/java/de/leonkoth/blockparty/util/BlockPartyExpansion.java b/core/src/main/java/de/leonkoth/blockparty/util/BlockPartyExpansion.java deleted file mode 100644 index 3eeb221..0000000 --- a/core/src/main/java/de/leonkoth/blockparty/util/BlockPartyExpansion.java +++ /dev/null @@ -1,133 +0,0 @@ -package de.leonkoth.blockparty.util; - -import de.leonkoth.blockparty.BlockParty; -import de.leonkoth.blockparty.player.PlayerInfo; -import me.clip.placeholderapi.expansion.PlaceholderExpansion; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -/** - * Package de.leonkoth.blockparty.util - * - * @author Leon Koth - * © 2019 - */ -public class BlockPartyExpansion extends PlaceholderExpansion { - - private JavaPlugin plugin; - - /** - * Since we register the expansion inside our own plugin, we - * can simply use this method here to get an instance of our - * plugin. - * - * @param plugin - * The instance of our plugin. - */ - public BlockPartyExpansion(BlockParty plugin){ - this.plugin = plugin.getPlugin(); - } - - /** - * Because this is an internal class, - * you must override this method to let PlaceholderAPI know to not unregister your expansion class when - * PlaceholderAPI is reloaded - * - * @return true to persist through reloads - */ - @Override - public boolean persist(){ - return true; - } - - /** - * Because this is a internal class, this check is not needed - * and we can simply return {@code true} - * - * @return Always true since it's an internal class. - */ - @Override - public boolean canRegister(){ - return true; - } - - /** - * The name of the person who created this expansion should go here. - *
For convienience do we return the author from the plugin.yml - * - * @return The name of the author as a String. - */ - @Override - public String getAuthor(){ - return plugin.getDescription().getAuthors().toString(); - } - - /** - * The placeholder identifier should go here. - *
This is what tells PlaceholderAPI to call our onRequest - * method to obtain a value if a placeholder starts with our - * identifier. - *
This must be unique and can not contain % or _ - * - * @return The identifier in {@code %_%} as String. - */ - @Override - public String getIdentifier(){ - return "blockparty"; - } - - /** - * This is the version of the expansion. - *
You don't have to use numbers, since it is set as a String. - * - * For convienience do we return the version from the plugin.yml - * - * @return The version as a String. - */ - @Override - public String getVersion(){ - return plugin.getDescription().getVersion(); - } - - /** - * This is the method called when a placeholder with our identifier - * is found and needs a value. - *
We specify the value identifier in this method. - *
Since version 2.9.1 can you use OfflinePlayers in your requests. - * - * @param player - * A {@link org.bukkit.entity.Player Player}. - * @param identifier - * A String containing the identifier/value. - * - * @return possibly-null String of the requested identifier. - */ - @Override - public String onPlaceholderRequest(Player player, String identifier){ - - if(player == null){ - return ""; - } - - // %blockparty_wins% - if(identifier.equals("wins")){ - PlayerInfo playerInfo = PlayerInfo.getFromPlayer(player); - return playerInfo == null ? "0" : "" + playerInfo.getWins(); - } - - // %someplugin_gamesplayed% - if(identifier.equals("gamesplayed")){ - PlayerInfo playerInfo = PlayerInfo.getFromPlayer(player); - return playerInfo == null ? "0" : "" + playerInfo.getGamesPlayed(); - } - - // %someplugin_points% - if(identifier.equals("points")){ - PlayerInfo playerInfo = PlayerInfo.getFromPlayer(player); - return playerInfo == null ? "0" : "" + playerInfo.getPoints(); - } - - return null; - } - -} diff --git a/core/src/main/java/de/leonkoth/blockparty/util/DefaultManager.java b/core/src/main/java/de/leonkoth/blockparty/util/DefaultManager.java index 02b1ef5..5a3d9a1 100644 --- a/core/src/main/java/de/leonkoth/blockparty/util/DefaultManager.java +++ b/core/src/main/java/de/leonkoth/blockparty/util/DefaultManager.java @@ -11,12 +11,10 @@ public class DefaultManager { public static void copyAll() { - copy("Songs/LetItGo.nbs"); - copy("Songs/ZeldaTheme.nbs"); + copy("Songs/readme.md"); copy("Floors/start.floor"); copy("Floors/example.floor"); copy("web/index.html"); - //copy("web/songs/Vincent_Augustus_-_woah.mp3"); copy("web/songs/readme.md"); copy("web/bootstrap/css/bootstrap.css"); copy("web/bootstrap/js/bootstrap.js"); diff --git a/core/src/main/resources/Songs/LetItGo.nbs b/core/src/main/resources/Songs/LetItGo.nbs deleted file mode 100644 index 5f44520..0000000 Binary files a/core/src/main/resources/Songs/LetItGo.nbs and /dev/null differ diff --git a/core/src/main/resources/Songs/ZeldaTheme.nbs b/core/src/main/resources/Songs/ZeldaTheme.nbs deleted file mode 100644 index e7fe72a..0000000 Binary files a/core/src/main/resources/Songs/ZeldaTheme.nbs and /dev/null differ diff --git a/core/src/main/resources/Songs/readme.md b/core/src/main/resources/Songs/readme.md new file mode 100644 index 0000000..94e7a5c --- /dev/null +++ b/core/src/main/resources/Songs/readme.md @@ -0,0 +1,16 @@ +# Noteblock songs + +Songs in this folder can be accessed by the noteblock api. +Copy the songs (.nbs file) to this folder. + +## Setup + +To use noteblock songs for an arena, you have to edit your .yml file. + +```yaml +UseNoteBlockSongs: true +UseWebSongs: false +SongManager: + - song1 + - song2 +``` diff --git a/core/src/main/resources/plugin.yml b/core/src/main/resources/plugin.yml index 93cfffd..6073bf7 100644 --- a/core/src/main/resources/plugin.yml +++ b/core/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ description: Official BlockParty Plugin main: de.leonkoth.blockparty.Main authors: [Leon167, pauhull] website: https://github.com/Leon167/BlockParty-2.0/ -softdepend: [Multiverse-Core, MCJukebox, NoteBlockAPI, TimoCloud, PlaceholderAPI] +softdepend: [Multiverse-Core, MCJukebox, NoteBlockAPI, TimoCloud] commands: blockparty: diff --git a/core/src/main/resources/web/songs/Vincent_Augustus_-_woah.mp3 b/core/src/main/resources/web/songs/Vincent_Augustus_-_woah.mp3 deleted file mode 100644 index 0e4f88c..0000000 Binary files a/core/src/main/resources/web/songs/Vincent_Augustus_-_woah.mp3 and /dev/null differ diff --git a/dist/pom.xml b/dist/pom.xml index ee68f91..4bcf299 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -5,7 +5,7 @@ blockparty-parent de.leonkoth - 2.0.3.1-RELEASE + 2.0.3.2-RELEASE 4.0.0 @@ -39,6 +39,12 @@ blockparty-api ${project.parent.version}
+ + de.leonkoth + blockparty-expansion + 1.0.1 + provided +
diff --git a/expansion/pom.xml b/expansion/pom.xml new file mode 100644 index 0000000..f43d90f --- /dev/null +++ b/expansion/pom.xml @@ -0,0 +1,56 @@ + + + + blockparty-parent + de.leonkoth + 2.0.3.2-RELEASE + + 4.0.0 + + blockparty-expansion + 1.0.1 + jar + + + + placeholderapi + http://repo.extendedclip.com/content/repositories/placeholderapi/ + + + + + + de.leonkoth + blockparty-core + ${project.parent.version} + provided + + + me.clip + placeholderapi + 2.10.3 + + + org.spigotmc + spigot-api + 1.13.2-R0.1-SNAPSHOT + + + + + + + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + true + + + + + + \ No newline at end of file diff --git a/expansion/src/main/java/de/leonkoth/blockparty/expansion/papi/BlockPartyExpansion.java b/expansion/src/main/java/de/leonkoth/blockparty/expansion/papi/BlockPartyExpansion.java new file mode 100644 index 0000000..b8ff406 --- /dev/null +++ b/expansion/src/main/java/de/leonkoth/blockparty/expansion/papi/BlockPartyExpansion.java @@ -0,0 +1,110 @@ +package de.leonkoth.blockparty.expansion.papi; + +/** + * Package de.leonkoth.blockparty.expansion + * + * @author Leon Koth + * © 2019 + */ + +import me.clip.placeholderapi.expansion.PlaceholderExpansion; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +/** + * This class will automatically register as a placeholder expansion + * when a jar including this class is added to the directory + * {@code /plugins/PlaceholderAPI/expansions} on your server. + */ +public class BlockPartyExpansion extends PlaceholderExpansion { + + private JavaPlugin plugin; + + /** + * @return true or false depending on if the required plugin is installed. + */ + @Override + public boolean canRegister(){ + return Bukkit.getPluginManager().getPlugin(this.getRequiredPlugin()) != null; + } + + /** + * @return true or false depending on if it can register. + */ + @Override + public boolean register(){ + + if(!canRegister()){ + return false; + } + plugin = (JavaPlugin) Bukkit.getPluginManager().getPlugin(getRequiredPlugin()); + + if(plugin == null){ + return false; + } + + return super.register(); + } + + /** + * @return The name of the author as a String. + */ + @Override + public String getAuthor(){ + return "Leon167"; + } + + /** + * @return The identifier in {@code %_%} as String. + */ + @Override + public String getIdentifier(){ + return "blockparty"; + } + + /** + * @return The name of our dependency. + */ + @Override + public String getRequiredPlugin(){ + return "BlockParty"; + } + + /** + * @return The version as a String. + */ + @Override + public String getVersion(){ + return "1.0.1"; + } + + /** + * This is the method called when a placeholder with our identifier + * is found and needs a value. + *
We specify the value identifier in this method. + *
Since version 2.9.1 can you use OfflinePlayers in your requests. + * + * @param player + * A {@link org.bukkit.entity.Player Player}. + * @param identifier + * A String containing the identifier/value. + * + * @return possibly-null String of the requested identifier. + */ + @Override + public String onPlaceholderRequest(Player player, String identifier){ + + if(player == null){ + return ""; + } + + for (Placeholder placeholder : Placeholder.values()) + { + if (identifier.equalsIgnoreCase(placeholder.getIdentifier())) + return placeholder.onRequest(player); + } + + return null; + } +} \ No newline at end of file diff --git a/expansion/src/main/java/de/leonkoth/blockparty/expansion/papi/Placeholder.java b/expansion/src/main/java/de/leonkoth/blockparty/expansion/papi/Placeholder.java new file mode 100644 index 0000000..28ee865 --- /dev/null +++ b/expansion/src/main/java/de/leonkoth/blockparty/expansion/papi/Placeholder.java @@ -0,0 +1,59 @@ +package de.leonkoth.blockparty.expansion.papi; + +import de.leonkoth.blockparty.player.PlayerInfo; +import org.bukkit.entity.Player; + +/** + * Package de.leonkoth.blockparty.expansion + * + * @author Leon Koth + * © 2019 + */ +public enum Placeholder { + + // TODO: Implement Arena stats and values that are not dependent on players + + PLAYER_WINS("wins", true, false) { + @Override + protected String onRequest(Player player) + { + PlayerInfo playerInfo = PlayerInfo.getFromPlayer(player); + return playerInfo == null ? "0" : "" + playerInfo.getWins(); + } + }, + PLAYER_POINTS("points", true, false) { + @Override + protected String onRequest(Player player) + { + PlayerInfo playerInfo = PlayerInfo.getFromPlayer(player); + return playerInfo == null ? "0" : "" + playerInfo.getPoints(); + } + }, + PLAYER_GAMES_PLAYED("gamesplayed", true, false) { + @Override + protected String onRequest(Player player) + { + PlayerInfo playerInfo = PlayerInfo.getFromPlayer(player); + return playerInfo == null ? "0" : "" + playerInfo.getGamesPlayed(); + } + }; + + private String identifier; + private boolean needPlayer; + private boolean needArena; + + private Placeholder(String identifier, boolean needPlayer, boolean needArena) + { + this.identifier = identifier; + this.needPlayer = needPlayer; + this.needArena = needArena; + } + + protected abstract String onRequest(Player player); + + public String getIdentifier() + { + return this.identifier; + } + +} diff --git a/pom.xml b/pom.xml index 350458d..63c226a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.leonkoth blockparty-parent - 2.0.3.1-RELEASE + 2.0.3.2-RELEASE core dist @@ -14,6 +14,7 @@ spigot_v1_13_R1 utils api + expansion pom BlockParty @@ -23,7 +24,7 @@ org.projectlombok lombok - 1.18.6 + 1.18.8 provided diff --git a/spigot_v1_13_R1/pom.xml b/spigot_v1_13_R1/pom.xml index d12b4c0..bbcd787 100644 --- a/spigot_v1_13_R1/pom.xml +++ b/spigot_v1_13_R1/pom.xml @@ -5,7 +5,7 @@ blockparty-parent de.leonkoth - 2.0.3.1-RELEASE + 2.0.3.2-RELEASE 4.0.0 diff --git a/spigot_v1_8_R3/pom.xml b/spigot_v1_8_R3/pom.xml index fc7bca5..cf7ad7c 100644 --- a/spigot_v1_8_R3/pom.xml +++ b/spigot_v1_8_R3/pom.xml @@ -5,7 +5,7 @@ blockparty-parent de.leonkoth - 2.0.3.1-RELEASE + 2.0.3.2-RELEASE 4.0.0 diff --git a/utils/pom.xml b/utils/pom.xml index 6383341..1b0195f 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -5,7 +5,7 @@ blockparty-parent de.leonkoth - 2.0.3.1-RELEASE + 2.0.3.2-RELEASE 4.0.0