Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22d9b5a6ec | ||
|
|
e24ef5edd3
|
||
|
|
372633030f
|
||
|
|
5dcf38f995
|
||
|
|
dae014ed04
|
||
|
|
c7d013813b
|
||
|
|
a737f3c872 | ||
|
|
fa96da3bb2 | ||
|
|
83c16f9a0d | ||
|
|
c812be3475 | ||
|
|
ed44dcf601 | ||
|
|
a4d1d20690 | ||
|
|
ee6dfaaa8f | ||
|
|
b713835f21 | ||
|
|
1ecf17dfab | ||
|
|
477e85aab6 | ||
|
|
a035539475 | ||
|
|
a2ac0ddf23 | ||
|
|
16be8878f7 | ||
|
|
1d568fb8af | ||
|
|
a0d849bcc0 | ||
|
|
f021b541a6 | ||
|
|
cf5df93928 | ||
|
|
99152f387c | ||
|
|
1a98750dc7 | ||
|
|
4d1018a991 | ||
|
|
954330c889 | ||
|
|
db862b1717 | ||
|
|
1bf101e168 | ||
|
|
f894145c8b | ||
|
|
25d06428b8 | ||
|
|
ab59522876 | ||
|
|
d4c4b02865 | ||
|
|
b2720c449e | ||
|
|
f5208d35b0 | ||
|
|
f345e5163a | ||
|
|
9020f85e3d | ||
|
|
0e188de320 | ||
|
|
0c1bceeb3c | ||
|
|
ee3bf7b9ac | ||
|
|
d2eb71c74e | ||
|
|
1f580609f0 | ||
|
|
52b9e1ac24 | ||
|
|
712e2a79c8 | ||
|
|
303ff7c2e1 | ||
|
|
2f80cd6886 | ||
|
|
2ba0ccaffa | ||
|
|
acb5dae6a7 | ||
|
|
9425f74967 | ||
|
|
f8f4c4af6d | ||
|
|
ee30eb0569 | ||
|
|
f9d93a6bd4 | ||
|
|
3eb333310e | ||
|
|
979a9ec7fa | ||
|
|
e611976cd6 | ||
|
|
88428cb88f | ||
|
|
24e26a6896 | ||
|
|
149163a360 | ||
|
|
4d4057cd7a | ||
|
|
4533d9b441 | ||
|
|
26c961bb88 | ||
|
|
7ade50fd23 | ||
|
|
bd12269dc9 | ||
|
|
3142f28258 | ||
|
|
616cb5f35c | ||
|
|
d021381dc2 | ||
|
|
2dc3e6a554 | ||
|
|
2cdb2229ad |
No files matched your search
@@ -1,256 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ BuildBattle - Ultimate building competition minigame
|
||||
~ Copyright (C) 2022 Plugily Projects - maintained by Tigerpanzer_02 and contributors
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<!--
|
||||
Checkstyle configuration that checks the Google coding conventions from Google Java Style
|
||||
that can be found at https://google.github.io/styleguide/javaguide.html.
|
||||
|
||||
Checkstyle is very configurable. Be sure to read the documentation at
|
||||
http://checkstyle.sf.net (or in your downloaded distribution).
|
||||
|
||||
To completely disable a check, just comment it out or delete it from the file.
|
||||
|
||||
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
|
||||
-->
|
||||
|
||||
<module name="Checker">
|
||||
<property name="charset" value="UTF-8"/>
|
||||
|
||||
<property name="severity" value="warning"/>
|
||||
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
<!-- Checks for whitespace -->
|
||||
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="IllegalTokenText">
|
||||
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
||||
<property name="format"
|
||||
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||
<property name="message"
|
||||
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
|
||||
</module>
|
||||
<module name="AvoidEscapedUnicodeCharacters">
|
||||
<property name="allowEscapesForControlCharacters" value="true"/>
|
||||
<property name="allowByTailComment" value="true"/>
|
||||
<property name="allowNonPrintableEscapes" value="true"/>
|
||||
</module>
|
||||
<module name="LineLength">
|
||||
<property name="max" value="250"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="NoLineWrap"/>
|
||||
<module name="EmptyBlock">
|
||||
<property name="option" value="TEXT"/>
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
||||
</module>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlySame"/>
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
|
||||
LITERAL_DO"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
|
||||
INSTANCE_INIT"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors" value="true"/>
|
||||
<property name="allowEmptyMethods" value="true"/>
|
||||
<property name="allowEmptyTypes" value="true"/>
|
||||
<property name="allowEmptyLoops" value="true"/>
|
||||
<message key="ws.notFollowed"
|
||||
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
|
||||
<message key="ws.notPreceded"
|
||||
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="OneStatementPerLine"/>
|
||||
<module name="MultipleVariableDeclarations"/>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="FallThrough"/>
|
||||
<module name="UpperEll"/>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="EmptyLineSeparator">
|
||||
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapDot"/>
|
||||
<property name="tokens" value="DOT"/>
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapComma"/>
|
||||
<property name="tokens" value="COMMA"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
|
||||
<property name="id" value="SeparatorWrapEllipsis"/>
|
||||
<property name="tokens" value="ELLIPSIS"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
|
||||
<property name="id" value="SeparatorWrapArrayDeclarator"/>
|
||||
<property name="tokens" value="ARRAY_DECLARATOR"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapMethodRef"/>
|
||||
<property name="tokens" value="METHOD_REF"/>
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="TypeName">
|
||||
<message key="name.invalidPattern"
|
||||
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LambdaParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="CatchParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LocalVariableName">
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MethodTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="InterfaceTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="NoFinalizer"/>
|
||||
<module name="GenericWhitespace">
|
||||
<message key="ws.followed"
|
||||
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
|
||||
<message key="ws.preceded"
|
||||
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
|
||||
<message key="ws.illegalFollow"
|
||||
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
|
||||
<message key="ws.notPreceded"
|
||||
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="Indentation">
|
||||
<property name="basicOffset" value="2"/>
|
||||
<property name="braceAdjustment" value="0"/>
|
||||
<property name="caseIndent" value="2"/>
|
||||
<property name="throwsIndent" value="4"/>
|
||||
<property name="lineWrappingIndentation" value="4"/>
|
||||
<property name="arrayInitIndent" value="2"/>
|
||||
</module>
|
||||
<module name="AbbreviationAsWordInName">
|
||||
<property name="ignoreFinal" value="false"/>
|
||||
<property name="allowedAbbreviationLength" value="1"/>
|
||||
</module>
|
||||
<module name="OverloadMethodsDeclarationOrder"/>
|
||||
<module name="VariableDeclarationUsageDistance"/>
|
||||
<module name="CustomImportOrder">
|
||||
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
||||
<property name="separateLineBetweenGroups" value="true"/>
|
||||
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
|
||||
</module>
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="NoWhitespaceBefore">
|
||||
<property name="tokens"
|
||||
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
|
||||
<property name="allowLineBreaks" value="true"/>
|
||||
</module>
|
||||
<module name="ParenPad"/>
|
||||
<module name="OperatorWrap">
|
||||
<property name="option" value="NL"/>
|
||||
<property name="tokens"
|
||||
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
|
||||
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationMostCases"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationVariables"/>
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
</module>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<module name="AtclauseOrder">
|
||||
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
|
||||
<property name="target"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="SingleLineJavadoc">
|
||||
<property name="ignoreInlineTags" value="false"/>
|
||||
</module>
|
||||
<module name="EmptyCatchBlock">
|
||||
<property name="exceptionVariableName" value="expected"/>
|
||||
</module>
|
||||
<module name="CommentsIndentation"/>
|
||||
</module>
|
||||
</module>
|
||||
@@ -0,0 +1 @@
|
||||
.gitea/CODEOWNERS linguist-detectable=false
|
||||
@@ -0,0 +1,3 @@
|
||||
# Pull requests request review from the eligible staff team(s).
|
||||
# One approval from either an Admin or Developer satisfies branch protection.
|
||||
* @trueog/Admins @trueog/Developers
|
||||
@@ -1,684 +0,0 @@
|
||||
## Build Battle Changelog
|
||||
|
||||
Changelog is followed by special scheme which is required in order to allow automatic discord
|
||||
deploy webhooks to print changelog successfully
|
||||
|
||||
## Log scheme
|
||||
|
||||
`### <current version from pom.xml> <anything else here>`
|
||||
`<update log line>`
|
||||
|
||||
That's all, matcher will stop when detects next line started with `###` match
|
||||
|
||||
## 5.0.15 Release (03.05.2025)
|
||||
* Allowing by default 20 places placeholder for summary list
|
||||
* Check if OPTIONS_MENU item is still in builders inventory and readd it if necessary
|
||||
* Fixed IllegalArgumentException on PlotSelector, also switched to PaginatedInventory to support all Plots
|
||||
* Added filter to maxplayers/random join team / solo so that only the correct arenas are selected
|
||||
* Updated Minigamesbox to 1.4.1
|
||||
|
||||
### 5.0.14 Release (13.03.2025)
|
||||
* Changed plot distribution on team mode tries to create only full plots now
|
||||
* Fixed plot distribution in same cases lets spectators into the plot as member
|
||||
* Fixed game ending due to not enough players counted spectators
|
||||
* Updated to minigamesbox 1.4.0
|
||||
|
||||
### 5.0.13 Release (18.02.2025)
|
||||
* Fixed Progress must be between 0 and 1
|
||||
|
||||
### 5.0.12 Release (17.02.2025)
|
||||
* Fixed ItemSpawn on Plotarea also for dropped items by not player related drops
|
||||
* Fixed gtb plot reset
|
||||
* Fixed gtb Arena CleanUp which results in first round issues at selection of theme etc.
|
||||
* Fixed gtb options menu is not showing up for every builder
|
||||
* Fixed block destroy drops
|
||||
* Fixed a bug on gtb where players were getting points for guess even when they wrote the theme on chat when it was already shown by the plugin
|
||||
* Fixed spectator counts on gtb guess
|
||||
* Fixed bba settheme command
|
||||
* Fixed PlayerHeads on 1.20+
|
||||
* Fixed clearing of dropped items on 1.21+
|
||||
* Fixed Biomes on 1.21
|
||||
* Fixed Banner Building on 1.20+
|
||||
* Fixed Creature Spawning outside plots in same world
|
||||
* Fixed players are collidable on normal mode
|
||||
* Changed stained glass pane naming to ???
|
||||
* Updated to minigamesbox 1.3.16
|
||||
|
||||
|
||||
### 5.0.9 Release (09.07.2024)
|
||||
* Updated to minigamesbox 1.3.11
|
||||
* Fixed ChunkManager.sendMapChunk
|
||||
* Fixed error in time change menu
|
||||
* Fixed issue with %player% placeholder (should be lowercase)
|
||||
* Fixed problem in place rewards
|
||||
* Fixed small error if non-player threw projectile.
|
||||
* Added Cancel of BlockExplodeEvent to prevent blocks such as Respawn Anchor explode and damage the arena
|
||||
* Added Disabled enderpearl throwing while in arena because it allows to teleport to other players plots or outside the arena map, even during voting stage.
|
||||
|
||||
### 5.0.8 Release (25.06.2024)
|
||||
* Updated to minigamesbox 1.3.9
|
||||
|
||||
### 5.0.7 Release (18.06.2024)
|
||||
* API update
|
||||
|
||||
### 5.0.6 Release (24.04.2024)
|
||||
* Updated to minigamesbox 1.3.8
|
||||
|
||||
### 5.0.5 Release (15.01.2024)
|
||||
* Updated to minigamesbox 1.3.7
|
||||
|
||||
### 5.0.4 Release (13.01.2024)
|
||||
* Updated to minigamesbox 1.3.6
|
||||
|
||||
### 5.0.3 Release (03.01.2024)
|
||||
* Added new command /bba locale <locale> to set your locale
|
||||
* Fixed GameProfile API 1.20 change
|
||||
* Fixed none kits related plugins issues
|
||||
|
||||
### 5.0.2 Release (31.12.2023)
|
||||
* Fixed gtb round reset on player leave
|
||||
* Fixed gtb "could not pass event AsyncPlayerChatEvent" if spectators ingame
|
||||
* Fixed bouncing and mouse pointer reset on themevoting
|
||||
* Added 1.20.3 & 1.20.4 support
|
||||
* Updated to minigamesbox 1.3.4
|
||||
|
||||
### 5.0.1 Release (21.08.2023)
|
||||
* Fixed rewards enabling
|
||||
* Fixed bossbar disabling
|
||||
* Fixed locale registration if service unavailable
|
||||
|
||||
### 5.0.0 Release (09.08.2023)
|
||||
* Added up to 1.20 compatibility
|
||||
* Changed arena solo and team to classic, with different team sizes
|
||||
* Changed supported languages [https://translate.plugily.xyz]
|
||||
* Changed plugin base is based on MinigamesCore [https://github.com/Plugily-Projects/MiniGamesBox]
|
||||
* Changed native java building to java17, java 8 downloadable on our discord [https://discord.plugily.xyz]
|
||||
* Fixed gtb mode issues
|
||||
* Fixed all known bugs
|
||||
|
||||
### 4.5.3 Release (04.08.2021 - xx.xx.2021)
|
||||
|
||||
* Fixed when players didn't got rewards after plot reset
|
||||
* Now you can configure the notification of the remaining build time
|
||||
* Fixed issue when player's inventories did not get cleared before teleport
|
||||
* An attempt to fix executing console reward commands multiple times
|
||||
* Fixed mysql create table statement
|
||||
* Added %ARENATYPE% as placeholder for messages
|
||||
* Fixed NPE when player's plot was invalid after NPC click
|
||||
* Added option for the third first guessers to receive more points
|
||||
* Fixed IndexOutOfBoundsException when retrieving currentBuilder at next round
|
||||
|
||||
### 4.5.2 Release (02.08.2021 - 03.08.2021)
|
||||
|
||||
* Fixed issues with spectators get added multiple times to the players list
|
||||
* Fixed Cannot invoke because "userPlot" is null
|
||||
|
||||
### 4.5.1 Release (15.04.2021 - 02.08.2021)
|
||||
|
||||
* Added 1.17 support
|
||||
* Added adjustable team mode plot size
|
||||
* Added placeholder total_points_earned and highest_points
|
||||
* Added plot selector for team mode
|
||||
* Added greek as language (Thanks to poeditor contributors)
|
||||
* Renamed class paths from commonsbox
|
||||
* Reuse XMaterial for specialitems
|
||||
* Fixed teamarena does not stop when only two players are left from the same team
|
||||
* Fixed spectatormode does not display summary and players
|
||||
|
||||
> > > b1
|
||||
|
||||
* Added forcestart item
|
||||
* Added new message In-Game.Floor-Item-Blacklisted
|
||||
* Added /bb guess <word> argument (useful for servers with bungee handled chat)
|
||||
* Added placeholder arena_players_online
|
||||
* Added /bb join maxplayers type which tries to get the baseArena with the highest amount of players
|
||||
* Added special_items.yml
|
||||
* Added changeable options menu item
|
||||
* Changed randomjoin mechanics -> Searches for starting -> random join -> Searches for waiting -> random join
|
||||
* Changed Now builders will also get points if the building is guessed
|
||||
* Changed gtb word hints are now randomly chosen
|
||||
* Changed gtb word hints will stop if there are only 2 chars left to show
|
||||
* Changed empty message is no longer sent
|
||||
* Fixed gtb guessers got options menu on there inventory
|
||||
* Fixed on gtb the time and weather is not synced with all players
|
||||
* Fixed minecarts can go outside of plot
|
||||
* Fixed item frames can be rotated outside plot
|
||||
* Fixed some bugs on particle menu
|
||||
* Fixed when plugins scoreboards not re-appeared after game end
|
||||
* Fixed players can report more than one time
|
||||
* Fixed spectator mode does not work correctly
|
||||
* Fixed gtb guesser players can teleport to all players on the server
|
||||
* Removed lobbyitems.yml
|
||||
* Removed temp added scoreboard rewards
|
||||
|
||||
### 4.5.0 Release (21.03.2021 - 13.04.2021)
|
||||
|
||||
* Automatically disable bossbar support on 1.8 to prevent issue if bossbar is enabled on config.yml
|
||||
* Fix when baseArena selector GUI does not opened
|
||||
* Fixed HolidayManager that crashes themes on Teams and GTB mode
|
||||
* Fixed NPE on ArrowEvents and other version improvements
|
||||
|
||||
### 4.4.9 Release (19.03.2021)
|
||||
|
||||
* Added configurable baseArena selector items (per state)
|
||||
* Fixed particle issues on some versions
|
||||
|
||||
### 4.4.8 Release (08.02.2021 - 17.03.2021)
|
||||
|
||||
* Added option to perform command after specific amount of reports
|
||||
* Added list of restricted entities that can't be spawned in game
|
||||
* Added legacy support
|
||||
* Added super_votes papi placeholder
|
||||
* Added TeleportArgument (/bba tp)
|
||||
* Added new RewardType scoreboard_remove
|
||||
* Added modifiable baseArena state names to language
|
||||
* Fix when sign instances section is null in some cases
|
||||
* Fix when some inventory can't be opened in game
|
||||
* Moved statistic save method inside onDisable
|
||||
* Changed prevent interaction with enderchest
|
||||
|
||||
### 4.4.7 Release (24.01.2021 - 28.01.2021)
|
||||
|
||||
* Fixed Join SubTitle not being sent
|
||||
* Fixed stack trace array length is 0 when trying to send exception to service
|
||||
* Fix NPE related to citizens NPCRegistry method return value
|
||||
* Fixed spectators can not see each other after joining game while being ingame
|
||||
* Added 2 new Plot times - Noon, MidNight
|
||||
|
||||
### 4.4.6 Release (18.01.2021 - 22.01.2021)
|
||||
|
||||
* Fixed bb items are not removed if inventory manager is enabled and the server is stopping
|
||||
* Fixed particle refresh scheduler not worked on game start
|
||||
|
||||
### 4.4.5 Release (31.12.2020 - 18.01.2021)
|
||||
|
||||
* ArgumentsRegistry now accessible from outside
|
||||
* Fixed some reported NPEs about setup inventory
|
||||
* Added start game reward action
|
||||
* Added join title and subtitle
|
||||
* Added customizable item name in baseArena selector gui (by ajgeiss0702)
|
||||
* Fixed asynchronous issue when performing commands from async chat
|
||||
* Optimized plot particle refresh scheduler, now it only runs when a game is running
|
||||
* Only add points to plot that do not have points already
|
||||
|
||||
### 4.4.4 Release (18.12.2020 - 29.12.2020)
|
||||
|
||||
* Rewritten scoreboardlib (fixed flickering and color matching) -> 122 chars for 1.14 up and 48 for lower versions
|
||||
* Fix async catch exception in old versions when teleporting players to their plots
|
||||
* Fixed setup menu on "normal" spigot servers
|
||||
|
||||
### 4.4.3 Release (30.11.2020 - 13.12.2020)
|
||||
|
||||
* Fixed joining through a sign while hotbar slot for leave-item is active
|
||||
* Fixed cast exception when banner meta is not item
|
||||
* Fixed NoSuchMethodError when CommandSender#spigot does not exists on 1.11
|
||||
* Fixed BiomeChange specially on 1.15 (PacketPlayOutMapChunk)
|
||||
* Fixed Command-Instead-Of-Head-Menu is not executed on the first menu
|
||||
* Fixed lore is not updating on setup inventory
|
||||
* Fixed ANNOUNCE_PLOTOWNER_LATER did not show both owners on team mode
|
||||
|
||||
### 4.4.2 Release (02.10.2020 - 12.11.2020)
|
||||
|
||||
* Fixed spectators are able to damage entities
|
||||
* Fixed NPE related to baseArenas config not loaded correctly
|
||||
* Fixed for 1.11 player heads
|
||||
* Fixed particles can't activate again after they got removed
|
||||
* Fixed spectators can't fly after changing world
|
||||
* Signs performance improvement
|
||||
* Fixed (some related) script NPE on rewards.yml
|
||||
* Now you can disable spectators from joining into game
|
||||
* Now walk and fly speed will reset on join and leave
|
||||
* Fixed particle remover does not auto update
|
||||
* Fixed particle remover locations are multiply times listed
|
||||
* Fixed debug messages to console are not colored
|
||||
* Fixed NPE related to vote menu updating
|
||||
|
||||
### 4.4.1 Release (15.08.2020 - 20.09.2020)
|
||||
|
||||
* (Developer Alert - Class rename)
|
||||
* Added spectator mode
|
||||
* Added GTB to the SetUp inventory
|
||||
* Added baseArena selector
|
||||
* Added support for 1.16 hex colors
|
||||
* Fixed NPE when teleporting players to plots
|
||||
* Fixed IllegalArgumentException when some particles have "custom class data"
|
||||
* Fixed voting plot owners is empty
|
||||
* Fixed NoSuchMethodException for player chunk map
|
||||
* Fixed NPE during giving rewards to players
|
||||
* Fixed LanguageMigrator breaking language.yml
|
||||
* Fixed NoClassDefFoundError on pre 1.16 servers
|
||||
* Fixed NPE during vote event
|
||||
* Fixed votes command
|
||||
* Fixed for new 1.16 wall signs
|
||||
* Fixed NPE regarding giving rewards to players and resetting the plot areas
|
||||
* Fixed when blacklisted items & floor material is not exists and throws errors
|
||||
* Fixed async catch from bukkit when performing commands
|
||||
* Fixed IllegalPluginAccessException on plugin disable
|
||||
* Fixed NPE on Plotreset (GTB)
|
||||
* Fixed player being kicked when trying to join an in-game baseArena
|
||||
* Fixed NPE when trying to teleport players to lobby location
|
||||
* Fixed PlaceholderAPI placeholders not works on scoreboard in guessTheBuild mode
|
||||
* Fixed problems with materials
|
||||
* Reworked version checker
|
||||
* Improved the tab complete handling
|
||||
* Updated PlaceholderAPI dependency
|
||||
* Updated locales to latest version
|
||||
* Added the possibility to change messages of locales on language.yml
|
||||
|
||||
### 4.4.0 Release (01.07.2020 - 29.07.2020)
|
||||
|
||||
* GuessTheBuild release
|
||||
* Reworked whole Rewards
|
||||
* New file rewards.yml
|
||||
* Added short commands such as start and leave
|
||||
* Added option to disable separate chat
|
||||
* Added possibility to change table name of mysql database
|
||||
* Added possibility to run command for report item
|
||||
* Added the new particles from 1.13 and up
|
||||
* Added an option to disable party features
|
||||
* Added missing 1.14 & 1.15 & 1.16 Materials/Biomes
|
||||
* Added 1.16.x compatibility
|
||||
* Added adjustable floor blacklist
|
||||
* Added bungeemode Arena shuffler
|
||||
* Added players will get kicked on bungeemode when baseArena is full and has no rights
|
||||
* Added an event to cancel fire spread on the plot
|
||||
* Added option to announce plot owner after voting
|
||||
* Fixed force start command when setting forced theme didn't set build time properly
|
||||
* Fixed bungeemanager enable null text error
|
||||
* Fixed biomes on 1.16 (nosuchmethoderror)
|
||||
* Fixed last plot on teammode can get double points
|
||||
* Fixed rewards are ignoring the place
|
||||
* Fixed HandlerList Error
|
||||
* Fixed water and lava as floor material
|
||||
* Fixed team member leave plot reset
|
||||
* Fixed water/lava flow and piston outside of plot in worst cases
|
||||
* Fixed nether star (options menu) duplication
|
||||
* Tried to fix Server crash on 1.15
|
||||
* Migrator for new config file as there are some more changes
|
||||
* Update setup tips Feedback page link
|
||||
* Randomjoin command will now longer send proper message when no baseArena is available
|
||||
* Changed mysql updates to do only one instead of more than 10 (should improve performance)
|
||||
* Updated particles.yml (Thanks Fabian Adrian #6234)
|
||||
* Changed increased npc finder to radius of 5 to the plot
|
||||
* Optimized floor change to get all materials
|
||||
|
||||
### 4.3.2 Release
|
||||
|
||||
* Added per particle disabler
|
||||
* Fixed Already-Playing message on randomjoin command
|
||||
* Fixed Type-Arena-Name language
|
||||
|
||||
### 4.3.1 Release (31.03.2020)
|
||||
|
||||
* Fixed Heads in lower version than 1.15.X
|
||||
* Fixed bungee value Shutdown-When-Game-Ends
|
||||
* Fixed automatic bungee baseArena restart (Now scoreboard and Bossbar applies)
|
||||
* Tried to fix parties compatibility
|
||||
* Fixed broken language migrator
|
||||
|
||||
### 4.3.0 Release (17.03.2020)
|
||||
|
||||
* PlaceholderAPI placeholders are no longer case sensitive
|
||||
* Added baseArena state placeholders for PlaceholderAPI:
|
||||
* %buildbattle_{baseArena id}:{data}% where data types are:
|
||||
* players - amount of players in baseArena
|
||||
* max_players - max players in baseArena
|
||||
* state - current state raw enum name eg. STARTING
|
||||
* state_pretty - prettified name of enum eg. Waiting (instead WAITING_FOR_PLAYERS)
|
||||
* mapname - name of baseArena map
|
||||
* arenatype - raw enum name of baseArena (SOLO, TEAM etc)
|
||||
* arenatype_pretty - prettified name of enum eg. Classic (instead SOLO)
|
||||
* Fixed VoteMenu NullPointerException
|
||||
* Added Parties support for PAF and Parties
|
||||
* Now if user don´t vote the plot will get 3 points of this player to prevent unfair game behaviors
|
||||
* FIXED 1.15.X Head issues
|
||||
* Added Connect-To-Hub boolean to bungee.yml
|
||||
* Added End-Location-Hub boolean to bungee.yml
|
||||
* Fixed mysql database - Create a new one and your stats should be saved correctly
|
||||
|
||||
### 4.2.0 Release (16.11.2019 - 13.12.2019) (by Tigerpanzer)
|
||||
|
||||
* Fixed baseArena deletion
|
||||
* Added a item to go to main options page
|
||||
* Fixed Holiday themes
|
||||
* Added a new MOTD Manager in the bungee.yml (Now you can define the message on your self)
|
||||
* Now the values in bungee.yml will work
|
||||
* Now the biomes permissions will work
|
||||
* Added new check for setup validation (now registered plots amount will be checked)
|
||||
* Added 1.15 compatibility
|
||||
|
||||
### 4.1.0 Release (13.07.2019 - 18.10.2019) (by Tigerpanzer and Plajer)
|
||||
|
||||
* Added new permission to join full games "buildbattle.fullgames"
|
||||
* Added the option to join when a game is full (you will kick a player without perm)
|
||||
* Fixed issue that you could join full games before they started now proper full game
|
||||
permission check will occur and do the thing to allow or disallow you to join
|
||||
* Fixed file creating for bungee.yml
|
||||
* /bb randomjoin will now really join random baseArena not first one it find good to join
|
||||
* Added a new option to block commands ingame
|
||||
* Fixed the NoSuchMethodException on baseArena sign load when the sign isn´t a wallsign
|
||||
* Added Chinese (Traditional) locale (zh_tw prefix)
|
||||
* Changed Chinese (Simplified) locale prefix from zh to cn
|
||||
* Added 1.14 support
|
||||
* Added sounds when using vote items (reset voteItems.yml to see changes)
|
||||
* Added banner builder in GUI
|
||||
* Entities can't be damaged anymore in voting stage
|
||||
* Players hiding feature is now fully removed, it was buggy
|
||||
|
||||
### 4.0.2 Release (15.06.2019 - 13.07.2019)
|
||||
|
||||
* Join permission message outputs required permission node now
|
||||
* Biome menu won't throw errors when using it now
|
||||
* Fixed firework spawn after the game if they were disabled in config
|
||||
* Fixed odd game behaviour when game couldn't start because there were some lacking plots
|
||||
when player left game before he was removed from the plot
|
||||
* Locales with special characters like Russian or Korean will now work properly and won't be seen as `?` characters
|
||||
* Fixed locales might not work in fresh install of plugin
|
||||
* Added 6 new locales: Portuguese (BR), Slovenian, Dutch, Lithuanian, Japanese and Italian (thanks a lot to our POEditor
|
||||
contributors!)
|
||||
* Fixed Russian locale didn't work
|
||||
|
||||
### 4.0.1 Release (11.06.2019)
|
||||
|
||||
* Fixed game wouldn't start if there were 2 players or more, sorry
|
||||
* Fixed error occurred when you didn't look at sign while adding sign via setup GUI
|
||||
|
||||
### 4.0.0 Release (10.06.2019)
|
||||
|
||||
* Fixed typo in message accessor for guess the build game mode message
|
||||
* Now players aren't saved async in onDisable method which led to exceptions in disable stage
|
||||
* Fixed bad logic of assigning players to teams in teams game mode
|
||||
* Teams game mode require now to have at least 3 minimum players to play, it will set it to 3 if
|
||||
it's set lower
|
||||
* Improved faster and more efficient scoreboard library (thanks to TigerHix)
|
||||
* Reload and baseArena delete commands now require confirmation to execute, you must type the command twice to confirm
|
||||
the action
|
||||
* Implemented faster Hikari database connection pool library instead of BoneCP, jar is now 3 times smaller
|
||||
* First time database creation is now made async not in main server thread
|
||||
* Apache Commons-io library is shaded into the jar now, 1.14 removed it
|
||||
* You cannot set non occluding blocks as a floor block
|
||||
* **CRITICAL** Players received packets that would break their chunks nearby them due to wrong baseArena plot reset
|
||||
check, now it's fixed
|
||||
* Debug in config is no longer visible by default, no one need it
|
||||
* Removed hiding/showing players in-game and outside game thing, it was bugged and better to avoid problems with it
|
||||
* Fixed game ending message was never showed when using any of the locales (accessor was broken)
|
||||
* /bba reload command was undeprecated and it's usage is no longer discouraged
|
||||
* Made /bb help and /bba help commands actually working
|
||||
* Added not playing message node to language.yml, locales already had it somehow
|
||||
|
||||
### 4.0.0 Beta Pre Releases 3-15 (03.10.2018 - 06.06.2019)
|
||||
|
||||
> RC 2
|
||||
|
||||
* Fixed plugin couldn't start if Cloudflare was blocked in your country (or services were offline)
|
||||
* Removed locale suggester, it will no longer spam console when English (default) locale is used
|
||||
* Fixed issue with plot adding via setup menu
|
||||
|
||||
> RC 1
|
||||
|
||||
* Fixed animals couldn't spawn and breed outside baseArenas
|
||||
* Fixed spawning animals on baseArena even if option for disable-spawning was false
|
||||
* Fixed /bba addnpc didn't work
|
||||
* Fixed setup GUI didn't work properly
|
||||
* Fixed [#612 exception when registering baseArenas](https://www.plajer.xyz/errorservice/viewer.php?id=612) when
|
||||
baseArenas.yml file was empty
|
||||
*
|
||||
Fixed [#610 exception when special item didn't have material-name section set](https://www.plajer.xyz/errorservice/viewer.php?id=610)
|
||||
now by default
|
||||
it will have BEDROCK value if absent
|
||||
* Added pro tips about user voice and /bba votes executable from console too
|
||||
|
||||
> Pre 15
|
||||
|
||||
* Fixed [#595 /bb randomjoin command exception](https://www.plajer.xyz/errorservice/viewer.php?id=595) when no baseArena
|
||||
type
|
||||
args were specified
|
||||
* Fixed [#592 /bba addplot command exception](https://www.plajer.xyz/errorservice/viewer.php?id=592) when no baseArena
|
||||
name
|
||||
was typed
|
||||
* Fixed [#589 options menu click exceptions](https://plajer.xyz/errorservice/viewer.php?id=589) when click was on
|
||||
air or outside inventoryView slots
|
||||
* Fixed Signs weren't updating if Signs-Block-States-Enabled option was false
|
||||
* Abandoned the direct try-catch exception handling in most of methods and event listeners in favour of
|
||||
logger listening, code looks better now
|
||||
* Implemented Holiday Events for April Fools, Christmas and Halloween, special themes
|
||||
for solo and teams will be applied if enabled
|
||||
|
||||
> Pre 14
|
||||
|
||||
* Fixed time couldn't be set for plots because we were checking raw slot click instead of normal slot
|
||||
* Made particles.yml particle items more user friendly (lores and names looks now better)
|
||||
* Fixed bba addplot command didn't work properly
|
||||
* Added fully configurable biomes in biomes.yml
|
||||
* Fixed biomes are now properly reset in plot reset option and after baseArena reset
|
||||
* Added "Go Back" button in particles remove menu
|
||||
|
||||
> Pre 13
|
||||
|
||||
* Added GuessTheBuild game mode (alpha)
|
||||
* When using super vote you won't see two game prefixes now
|
||||
* Merged /bba addvotes and /bba setvotes into /bba votes add/set command
|
||||
* Added message sent to player when receives super votes
|
||||
|
||||
> Pre 12
|
||||
|
||||
* Added BBPlayersPlotReceiveEvent to API
|
||||
* Fixed /bba forcestart wasn't working properly
|
||||
* Added BBPlotResetEvent to API
|
||||
* Particles speed is now 1, they may behave better for builders now
|
||||
* Now you can properly execute all /bb and /bba commands in-game while being non op player
|
||||
* Somehow plugin was lacking lobby events and you could lose food and health in lobby
|
||||
* Added chat events so in-game chat is no separated from server chat (I thought it's obvious)
|
||||
* Now after selection of head in heads inventoryView won't be closed, user will close it when he wants
|
||||
* Now language manager will use cached language.yml file so plugin will perform bit better
|
||||
* Theme vote GUI is now properly listening for click events, you don't need to click few times to make it vote
|
||||
* Added useSSL=false argument in mysql.yml address to avoid mysql warnings in console (not harmful)
|
||||
* Whole plugin runs now definitely faster and code execution time and plugin load decreases in timings
|
||||
* Setup GUI option for setting min/max players amount now runs smoothly
|
||||
|
||||
> Pre 11
|
||||
|
||||
* Added biomes in Options menu
|
||||
* Added time in Options menu
|
||||
* Code improvements and changes
|
||||
* Fixed baseArena signs were incorrectly saved via setup menu (4.0.0 pre issue)
|
||||
|
||||
> Pre 10
|
||||
|
||||
* Added setup tutorial link to setup menu
|
||||
* Added tip about downloadable maps when no baseArenas are set up while typing /bba list
|
||||
* Fixed exp not saving properly with InventoryManager
|
||||
|
||||
> Pre 9
|
||||
|
||||
* Fixed NPE when player was null (https://plajer.xyz/errorservice/viewer.php?id=347)
|
||||
* Code must be changed to avoid those NPE's in the future
|
||||
|
||||
> Pre 8
|
||||
|
||||
* Fixed NPE because of wrong string access in code
|
||||
* Locales will be now automatically disabled in this version - ppl don't read warnings about locales so I force them
|
||||
to disable
|
||||
* Now /bba reload /bba addvotes/setvotes and /bba list can be now properly executed from console
|
||||
|
||||
> Pre 7
|
||||
|
||||
* Updates are now checked async without freezing the main thread which caused TPS to drop a bit
|
||||
|
||||
> Pre 6
|
||||
|
||||
* Particles in menu are now incrementing automatically
|
||||
* Particle redstone requires DustOptions and causes errors so it was removed from menu
|
||||
* Fixed possible NPEs in block spread event (https://plajer.xyz/errorservice/viewer.php?id=282)
|
||||
* Fixed NPE when teleporting to plot, now players will be teleported 1 x and z block away from center if
|
||||
height reach Y plot limit (https://plajer.xyz/errorservice/viewer.php?id=283)
|
||||
|
||||
> Pre 5
|
||||
|
||||
* You cannot join game now infinitely through command (lol????)
|
||||
* Now players that will leave game will be visible by other players outside game
|
||||
|
||||
> Pre 4
|
||||
|
||||
* API change - now you can access BuildBattle API via pl.plajer.buildbattle.api
|
||||
* Maybe a fix for https://plajer.xyz/errorservice/viewer.php?id=244
|
||||
|
||||
> Pre 3
|
||||
|
||||
* Removed annoying "Please enable bStats" message
|
||||
* Code improvements
|
||||
* Added PR0 TIPS when editing baseArena
|
||||
|
||||
### 4.0.0 Release (20.08.2018 - 28.09.2018)
|
||||
|
||||
* Fixed NullPointerException for users who where no longer online
|
||||
* Now using default values when they not exist in config to avoid NullPointerException from ConfigPreferences
|
||||
* Fixed IllegalArgumentException when you add invalid item name to the in-game items blacklist - now it will notify you
|
||||
in console
|
||||
* Fixed %player% placeholder wasn't parsed in /bb stats <player>
|
||||
* Added PlaceholderAPI placeholders in scoreboard
|
||||
* Added Russian, Czech, Romanian and Estonian locales (thanks to POEditor contributors!)
|
||||
* Added dynamic locale manager system - you can now get latest locales on demand from our repository
|
||||
* Fixed scoreboard color bugs (see https://i.imgur.com/kaZy5s2.png)
|
||||
* Fixed update checker bugs while using my other minigames
|
||||
* /bba help command is now executable via players only
|
||||
* Temporarily merged PLCore to prevent issues with other plugins
|
||||
* Added blacklisted themes
|
||||
* Dropped 1.9-1.10 support
|
||||
* Fixed bug where plot floor wasn't reset while using Citizens
|
||||
* Fixed message You became 1th/2th/3th was displayed - it shouldn't and it wasn't grammatically okay
|
||||
* Added extra permission "buildbattle.command.bypass"
|
||||
* Added solo and team themes
|
||||
* Added cancel lobbystart when there are not enough players
|
||||
* Fixed bedrock was displayed in plot floor change option menu
|
||||
* Head blocks textures are now loading instantly and do not cause server to freeze at the start now
|
||||
* Fixed /bb top was reversed while MySQL was enabled
|
||||
* Disabled game end rewards by default because they were confusing for users
|
||||
* Fixed server was stopped using Shutdown-When-Game-Ends option but player just left not started baseArena
|
||||
* Player will be given now survival gamemode on server stop
|
||||
* Removed unused code for entities
|
||||
|
||||
### 3.5.1 Release (17.08.2018)
|
||||
|
||||
* Fixed NumberFormatException for language.yml migrator - this error is very rare to occur in normal environment but it
|
||||
was reported so I fixed it
|
||||
* Fixed NullPointerException for plot adding via selector wand due to lack of code stop when message with not full
|
||||
selection was sent
|
||||
* Fixed Can't fly outside plot message but you were in plot
|
||||
* Fixed scoreboard contents were always in Waiting state
|
||||
* Fixed IndexOutOfBoundsException in join event while bungee is enabled
|
||||
* Fixed NullPointerException in scoreboard formatting while player was null
|
||||
* Fixed NoDefClassFoundException in 1.13 while using sign game states
|
||||
|
||||
### 3.5.0 Release (08/16.08.2018)
|
||||
|
||||
* Built against PLCore API
|
||||
* Hooked code with Error reporter service
|
||||
* Fixed MySQL error
|
||||
* Removed WorldEdit from baseArena usages
|
||||
* Added ability to edit floor in game (requires baseArenas.yml edit or new setup!)
|
||||
* Added joints when users have same points in voting time
|
||||
* Fixed small problem when game was started and voting for theme started, timer was set for build time instead of voting
|
||||
time and it
|
||||
could be seen in scoreboard for a second
|
||||
* Plot reset now include weather reset
|
||||
* Added Turkish and Indonesian locales (thanks to POEditor contributors)
|
||||
* Added /bba removeplot command
|
||||
* Added new command /bba plotwand
|
||||
|
||||
### 3.4.1 Release (30.07/03.08.2018)
|
||||
|
||||
* Added public access to MySQL executeUpdate method
|
||||
* Added BBPlayerStatisticChangeEvent event
|
||||
* Updated Spanish and Korean locales
|
||||
* Added French locale (thanks to POEditor contributors!)
|
||||
* Removed scoreboard saving in InventoryManager due to errors
|
||||
|
||||
### 3.4.0 Release (25/29.07.2018)
|
||||
|
||||
* Added super votes
|
||||
* Added /bb top command
|
||||
* Fixed locales and updated them
|
||||
* Added Korean language (thanks to POEditor contributors!)
|
||||
* Added /bba forcestart <theme> to start with predefined theme (suggested by ColaIan)
|
||||
|
||||
### 3.3.0 Release (24.07.2018)
|
||||
|
||||
* Now while teleporting to the plot you won't fall down
|
||||
* Fixed xp was given wrong using inventoryView manager
|
||||
* Removed unnecessary listeners from spectator code
|
||||
* Use-Name-Instead-Of-UUID-In-Database option was removed, it's no longer supported
|
||||
* Removed Particle-Offset option, was useless, default offset should stay same for every server
|
||||
* Removed Disable-Scoreboard-Ingame option as scoreboard is integral part of the game
|
||||
* Removed Hook-Into-Vault option as plugin automatically hooks with Vault if found
|
||||
(this hook really doesn't add anything except an extra placeholder on the scoreboard which is anyway medium useful in
|
||||
this game)
|
||||
* Using item flags instead of empty custom enchant which didn't work in 1.13
|
||||
* **Added 1.13 support**
|
||||
(still lots of code uses deprecated code which shouldn't be used in 1.13 but because 1.13 has got backwards
|
||||
compatibility
|
||||
we will keep that for a while as an temporary workaround)
|
||||
**Keep in mind that 1.13 forces me to do changes with ID's in BuildBattle and those changes will be done soon**
|
||||
|
||||
### 3.2.2 Release (20.07.2018)
|
||||
|
||||
* Fixed NoSuchMethod error in 1.9.4 for title
|
||||
* Added support for Vietnamese, Hungarian and Chinese simplified locales
|
||||
* Added ability to change weather in plot
|
||||
|
||||
### 3.2.1 Release (14.07.2018)
|
||||
|
||||
* Fixed NPE when clicking not named Villager
|
||||
* Fixed migration error
|
||||
|
||||
### 3.2.0 Release (06/12.07.2018)
|
||||
|
||||
* Added video tutorial link while creating new baseArena
|
||||
* Added new game mode: TEAM
|
||||
* Fixed error on disabling caused by disabled boss bar feature
|
||||
* Item rewards at the end of the game now will be properly given after clearing in-game inventoryView of players
|
||||
* Vote items now look like Hypixel ones
|
||||
* Worst vote will now count as 1 point not 0 (so every other vote is +1 point now)
|
||||
* Implemented theme voting feature like hypixel, before game starts players will vote for theme
|
||||
* Added localization support via POEditor
|
||||
* Fixed language migration from version 1 (very old)
|
||||
* Added missing plugin prefixes to some command messages
|
||||
* Added Spanish locale (thanks to TheLordDarkYT for POEditor contribution!)
|
||||
* Separate game timer for team mode
|
||||
|
||||
### 3.1.2 Release (05.07.2018)
|
||||
|
||||
* Fixed error when 1st winner UUID was null (somehow)
|
||||
* Added subtitle "x seconds left" in game
|
||||
|
||||
### 3.1.0 Release (08.06.2018)
|
||||
|
||||
* New good looking summary message at the end of the game
|
||||
* Added game sign block states
|
||||
* /bb command is now translatable via language.yml
|
||||
* Admin commands (/bba) are now better with hover and click event (JSON messages)
|
||||
* Default map name when creating new baseArena is baseArena ID not "0" now
|
||||
* Now warning message "can't save language.yml because already exists!" won't occur anymore
|
||||
* Fixed error in console when player left the baseArena and his plot was cleared even if he didn't have it
|
||||
* Now you can't change your floor by NPC during the voting time
|
||||
|
||||
### 3.0.4 Release (04.06.2018)
|
||||
|
||||
* Rewards will be given now only once after the game
|
||||
* Now you can leave started game without spamming infinitely errors in console
|
||||
* Fixed broken heads lores in heads menu and changed some strings there
|
||||
* Fixed wrong displayed winners names at the end in summary
|
||||
* Now sending "You've became xth" message for 4th winners and lower
|
||||
* Voting for player plot title is now displayed longer
|
||||
* Added missing plugin prefix in voting messages
|
||||
* Immediately voting after game timer ends now
|
||||
|
||||
### 3.0.2 Release (03.06.2018)
|
||||
|
||||
* Fixed /bb create command not working
|
||||
* Added /bba settheme command
|
||||
* Fixed game boss bar not removing after plugin force disable
|
||||
|
||||
### 3.0.0 Release (14.05.2018 - 01.06.2018)
|
||||
|
||||
* Add everything here
|
||||
@@ -1,37 +0,0 @@
|
||||
## This file is dedicated to **Build Battle** project's all-time contributors.
|
||||
|
||||
## **very outdated, please nag me if you still see it here**
|
||||
|
||||
**I'm sincerely glad to everyone who supported our project every time!**
|
||||
|
||||
**Contributors are listed in alphabetical order, every contributor is equally important!**
|
||||
|
||||
* Adrian Garay - Spanish translator
|
||||
* [Dianox](https://www.spigotmc.org/members/dianox.74931/) - French translator
|
||||
* Fatih Resul Göker - Turkish translator
|
||||
* Haoting - Chinese (Simplified) translator
|
||||
* [HomieDion](https://www.spigotmc.org/members/homiedion.118743/) - code snippets
|
||||
* HStreamGamer - Vietnamese translator
|
||||
* [human0324](https://www.spigotmc.org/members/human0324.532201/) - Korean translator
|
||||
* [inventivetalent](https://www.spigotmc.org/members/inventivetalent.6643/) - code snippets
|
||||
* Ito - Indonesian translator
|
||||
* [Marcely99](https://www.spigotmc.org/members/marcely99.62672/) - code snippets
|
||||
* [MattUGV](https://www.spigotmc.org/members/mattugv.139086/) - code snippets
|
||||
* [montlikadani](https://www.spigotmc.org/members/toldi.251100/) - Hungarian translator and code contributor
|
||||
* Pheonix Harryson - Korean translator
|
||||
* [Tigerkatze](https://www.spigotmc.org/members/tigerkatze.414545/) - Main tester, German translator and staff member of
|
||||
Plajer's Lair discord
|
||||
* [TomTheDeveloper](https://www.spigotmc.org/members/tomthedeveloper.4729/) - former author of Build Battle 1 and 2
|
||||
* [Tristiisch74](https://www.spigotmc.org/members/tristiisch74.149406/) - code snippets
|
||||
|
||||
**Thanks to these companies for providing free licenses for Build Battle open source work:**
|
||||
|
||||
* Code Whale Inc. - POEditor open source project license
|
||||
|
||||
**Also thanks to every bug reporters for reporting us those nasty bugs, and code contributors for making Build Battle
|
||||
better!**
|
||||
|
||||
`Please note that translators are put here only if their contribution to the language is higher than 15% of total strings`
|
||||
|
||||

|
||||
|
||||
@@ -1 +0,0 @@
|
||||
patreon: plugily
|
||||
@@ -1,11 +0,0 @@
|
||||
## Issue name
|
||||
### Sort description of issue
|
||||
|
||||
## Error code
|
||||
```
|
||||
code in ``` tags
|
||||
```
|
||||
|
||||
## Additional info
|
||||
- Spigot version:
|
||||
- Plugin version:
|
||||
@@ -1,42 +0,0 @@
|
||||

|
||||
|
||||
# Build Battle [](https://maven.plugily.xyz/#/releases/plugily/projects/buildbattle) [](https://maven.plugily.xyz/javadoc/releases/plugily/projects/buildbattle/latest) [](https://sonarcloud.io/summary/overall?id=Plugily-Projects_BuildBattle) [](https://discord.plugily.xyz) [](https://patreon.com/plugily)
|
||||
|
||||
BuildBattle is a Minecraft minigame designed for small and big servers. This minigame is unique and very configurable,
|
||||
100% free and open source!
|
||||
|
||||
The goal is to build the best you can! You must compete with other players in this building game. Who will be the best?
|
||||
Have fun using it! Leave a good rating if you really like it.
|
||||
|
||||
## Want to contribute in this project?
|
||||
|
||||
[**💣 Issues Reporting (Discord)**](https://discordapp.com/invite/UXzUdTP)
|
||||
[**❤ Make Donation**](https://www.paypal.me/plugilyprojects)
|
||||
|
||||
# Credits
|
||||
|
||||
## Open Source Libraries
|
||||
|
||||
| Library | Author | License |
|
||||
|-------------------------------------------------------------|-------------------------------------------------------|------------------------------------------------------------------------------------|
|
||||
| [InventoryFramework](https://github.com/stefvanschie/IF/) | [stefvanschie](https://github.com/stefvanschie) | [Unlicense](https://github.com/stefvanschie/IF/blob/master/LICENSE) |
|
||||
| [ScoreboardLib](https://github.com/TigerHix/ScoreboardLib/) | [TigerHix](https://github.com/TigerHix) | [LGPLv3](https://github.com/TigerHix/ScoreboardLib/blob/master/LICENSE) |
|
||||
| [HikariCP](https://github.com/brettwooldridge/HikariCP) | [brettwooldridge](https://github.com/brettwooldridge) | [Apache License 2.0](https://github.com/brettwooldridge/HikariCP/blob/dev/LICENSE) |
|
||||
| [bStats](https://github.com/Bastian/bStats-Metrics) | [Bastian](https://github.com/Bastian) | [LGPLv3](https://github.com/Bastian/bStats-Metrics/blob/master/LICENSE) |
|
||||
| [Commons Box](https://github.com/Plajer/Commons-Box) | [Plajer](https://github.com/Plajer) | [GPLv3](https://github.com/Plajer/Commons-Box/blob/master/LICENSE.md) |
|
||||
|
||||
## Open Source Licenses
|
||||
|
||||
#### Code Whale
|
||||
|
||||
<img src="https://poeditor.com/public/images/logo/logo_head_500_transparent.png" alt="jetbrains logo" width="150"/>
|
||||
|
||||
Thanks to Code Whale for Open Source license for POEditor project.
|
||||
|
||||
## Contributors
|
||||
|
||||
<a href="https://github.com/Plugily-Projects/BuildBattle/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Plugily-Projects/BuildBattle" />
|
||||
</a>
|
||||
|
||||
<img align="right" src="https://i.imgur.com/EmFfDXN.png">
|
||||
@@ -1,109 +0,0 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* BuildBattle - Ultimate building competition minigame
|
||||
* Copyright (C) 2022 Plugily Projects - maintained by Tigerpanzer_02 and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("signing")
|
||||
`maven-publish`
|
||||
id ("com.gradleup.shadow") version "9.0.0-beta5"
|
||||
java
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
||||
maven("https://oss.sonatype.org/content/repositories/central")
|
||||
maven {
|
||||
name = "papermc"
|
||||
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
maven(uri("https://maven.plugily.xyz/releases"))
|
||||
maven(uri("https://maven.plugily.xyz/snapshots"))
|
||||
maven(uri("https://repo.citizensnpcs.co/"))
|
||||
maven(uri("https://repo.maven.apache.org/maven2/"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("plugily.projects:MiniGamesBox-Classic:1.3.17") { isTransitive = false }
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
|
||||
compileOnly("net.citizensnpcs:citizensapi:2.0.31-SNAPSHOT")
|
||||
compileOnly("org.jetbrains:annotations:24.0.1")
|
||||
}
|
||||
|
||||
group = "plugily.projects"
|
||||
version = "5.0.13-SNAPSHOT4"
|
||||
description = "BuildBattle"
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
tasks {
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier.set("")
|
||||
relocate("plugily.projects.minigamesbox", "plugily.projects.buildbattle.minigamesbox")
|
||||
relocate("com.zaxxer.hikari", "plugily.projects.buildbattle.database.hikari")
|
||||
minimize()
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching("**/plugin.yml") {
|
||||
expand(project.properties)
|
||||
}
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Releases"
|
||||
url = uri("https://maven.plugily.xyz/releases")
|
||||
credentials {
|
||||
username = System.getenv("MAVEN_USERNAME")
|
||||
password = System.getenv("MAVEN_PASSWORD")
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "Snapshots"
|
||||
url = uri("https://maven.plugily.xyz/snapshots")
|
||||
credentials {
|
||||
username = System.getenv("MAVEN_USERNAME")
|
||||
password = System.getenv("MAVEN_PASSWORD")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~
|
||||
~ BuildBattle - Ultimate building competition minigame
|
||||
~ Copyright (C) 2021 Plugily Projects - maintained by Tigerpanzer_02, 2Wild4You and contributors
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>buildbattle</artifactId>
|
||||
<version>5.0.14-SNAPSHOT1</version>
|
||||
<name>BuildBattle</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plugilyprojects</id>
|
||||
<url>https://maven.plugily.xyz/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plugilyprojects-snapshots</id>
|
||||
<url>https://maven.plugily.xyz/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citizens-repo</id>
|
||||
<url>https://repo.citizensnpcs.co/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>23.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>MiniGamesBox-Classic</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizensapi</artifactId>
|
||||
<version>2.0.26-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ch.ethz.globis.phtree</groupId>
|
||||
<artifactId>phtree</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.21.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.1.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.9.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<configuration>
|
||||
<windowtitle>BuildBattle API docs for v${project.version}</windowtitle>
|
||||
<description>Minecraft building minigame.
|
||||
The goal is to build the best you can! You must compete with other players in this building game.
|
||||
Who will be the best? Have fun using it! Leave a good rating if you really like it.
|
||||
</description>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.hikari</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.database.hikari</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>plugily.projects.minigamesbox</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.minigamesbox</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- External beta versions discord deployer plugin -->
|
||||
<plugin>
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>betty-maven-plugin</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<configuration>
|
||||
<changelogFile>${project.basedir}/CHANGELOG.md</changelogFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- External beta versions discord deployer plugin -->
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>Release</id>
|
||||
<url>https://maven.plugily.xyz/releases</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>Snapshot</id>
|
||||
<url>https://maven.plugily.xyz/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* BuildBattle - Ultimate building competition minigame
|
||||
* Copyright (C) 2022 Plugily Projects - maintained by Tigerpanzer_02 and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
rootProject.name = "buildbattle"
|
||||
@@ -1,54 +0,0 @@
|
||||
name: Bump and Publish Development Branch
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ development ]
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
bump:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v4.2.2
|
||||
- name: Bump Version
|
||||
id: bump
|
||||
uses: Plugily-Projects/version-bump-action@v10
|
||||
with:
|
||||
github-token: ${{ secrets.github_token }}
|
||||
auto-version-bump: true
|
||||
- name: Print Version
|
||||
run: "echo 'New Version: ${{steps.bump.outputs.version}}'"
|
||||
publish:
|
||||
needs: bump
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
ref: 'development'
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4.6.0
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
java-package: jdk
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v5
|
||||
with:
|
||||
maven-version: 3.8.2
|
||||
- name: Cache
|
||||
uses: actions/cache@v4.2.2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: maven-
|
||||
- name: Publish with Maven
|
||||
uses: s4u/maven-settings-action@v3.1.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
"id": "Snapshot",
|
||||
"username": "${{ secrets.SNAPSHOTSUSERNAME }}",
|
||||
"password": "${{ secrets.SNAPSHOTSPASSWORD }}"
|
||||
}]
|
||||
- run: mvn clean verify compile package site:site javadoc:javadoc javadoc:jar deploy -DaltDeploymentRepository=Snapshot::https://maven.plugily.xyz/snapshots -f pom.xml
|
||||
@@ -1,57 +0,0 @@
|
||||
name: Bump and Publish Master Branch
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
bump:
|
||||
if: github.event.pull_request.merged
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v4.2.2
|
||||
- name: Bump Version
|
||||
id: bump
|
||||
uses: Plugily-Projects/version-bump-action@v10
|
||||
with:
|
||||
github-token: ${{ secrets.github_token }}
|
||||
auto-version-bump: false
|
||||
auto-version-bump-release: true
|
||||
- name: Print Version
|
||||
run: "echo 'New Version: ${{steps.bump.outputs.version}}'"
|
||||
publish:
|
||||
needs: bump
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
ref: 'master'
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4.6.0
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
java-package: jdk
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v5
|
||||
with:
|
||||
maven-version: 3.8.2
|
||||
- name: Cache
|
||||
uses: actions/cache@v4.2.2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: maven-
|
||||
- name: Publish with Maven
|
||||
uses: s4u/maven-settings-action@v3.1.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
"id": "Release",
|
||||
"username": "${{ secrets.RELEASESUSERNAME }}",
|
||||
"password": "${{ secrets.RELEASESPASSWORD }}"
|
||||
}]
|
||||
- run: mvn clean verify compile package site:site javadoc:javadoc javadoc:jar deploy -DaltDeploymentRepository=Release::https://maven.plugily.xyz/releases -f pom.xml
|
||||
+52
-5
@@ -1,6 +1,53 @@
|
||||
/.idea/
|
||||
/out/
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
# ...but the vendored dependency jars and the Gradle wrapper are tracked on purpose. Without these
|
||||
# negations, bumping a vendored jar to a new filename would be silently skipped by `git add`.
|
||||
!libs/*/*.jar
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# macOS system files
|
||||
.DS_Store
|
||||
|
||||
# gradle build output files
|
||||
build/
|
||||
.gradle/
|
||||
|
||||
# eclipse project files
|
||||
.settings/
|
||||
.project
|
||||
.classpath
|
||||
.checkstyle
|
||||
bin/
|
||||
|
||||
# IntelliJ files
|
||||
.idea/
|
||||
.kotlin
|
||||
*.iml
|
||||
/target/
|
||||
/minecraft/
|
||||
/docs/
|
||||
*.ipr
|
||||
*.iws
|
||||
out/
|
||||
|
||||
# Claude Code local settings
|
||||
.claude/
|
||||
@@ -0,0 +1,9 @@
|
||||
[submodule "libs/Utilities-OG"]
|
||||
path = libs/Utilities-OG
|
||||
url = https://git.trueog.net/trueog/Utilities-OG
|
||||
[submodule "libs/MyWorlds"]
|
||||
path = libs/MyWorlds
|
||||
url = https://git.trueog.net/trueog/MyWorlds
|
||||
[submodule "libs/Scoreboard-OG"]
|
||||
path = libs/Scoreboard-OG
|
||||
url = https://git.trueog.net/trueog/Scoreboard-OG
|
||||
+287
@@ -0,0 +1,287 @@
|
||||
# Changelog
|
||||
|
||||
All notable OG-fork changes are documented here. Upstream history is at
|
||||
https://github.com/Plugily-Projects/BuildBattle.
|
||||
|
||||
## 5.1.12 - 2026-09-16
|
||||
|
||||
### Changes
|
||||
|
||||
- Classic and Teams matches are played in rounds. `Time-Manager.<Classic|Teams>.Rounds`
|
||||
(default 3) sets how many builds a match holds; each round announces its own
|
||||
theme, runs `In-Game` seconds of building, then walks every plot for a vote.
|
||||
Plots are wiped between rounds, the votes add up, and the highest total after
|
||||
the last round wins. `Rounds: 1` is the old single-build flow.
|
||||
- `Time-Manager.<Classic|Teams>.Random-Theme` (default on) lets the plugin draw
|
||||
each round's theme at random from `themes.yml` instead of holding the vote, so
|
||||
building starts at once. Off, the vote runs before every round. Either way a
|
||||
theme is never repeated within a match while unused ones remain.
|
||||
- Shipped `In-Game` shortened to 150 seconds for Classic and 180 for Teams to
|
||||
fit three rounds. The config migration only adds the two new keys to an
|
||||
existing `config.yml`; lower `In-Game` there by hand.
|
||||
- The Classic theme list in `themes.yml` grows from 60 to 146 entries, leaning
|
||||
on concrete objects, animals, vehicles and food that fit a short round.
|
||||
- Round announcements are the new `In-Game.Messages.Plot.Round.Start` and
|
||||
`.Title` keys in `language.yml`, added to an existing file by the language
|
||||
migration; `%arena_round%` and `%arena_rounds%` placeholders resolve in
|
||||
Classic, Teams and Guess The Build. The sidebar shows `Round: 1/3` and the
|
||||
boss bar phase reads `Building 1/3` whenever a match has more than one round.
|
||||
- Plot vote shortened from 20 to 15 seconds per plot in the shipped `config.yml`
|
||||
(`Time-Manager.<Classic|Teams>.Voting.Plot`); the migration leaves an
|
||||
existing value alone.
|
||||
- Builders are no longer teleported to the plot spawn for straying five blocks
|
||||
past the plot. Each player now has `Plot.Border.Grace` (default 3) blocks of
|
||||
room outside their plot, and the one-block shell beyond that is drawn for
|
||||
them alone as a rainbow stained-glass wall (`Plot.Border.Block`, also
|
||||
`RAINBOW_WOOL`, `RAINBOW_TERRACOTTA`, `RAINBOW_CONCRETE` or any block) through
|
||||
client-side block changes, within `Plot.Border.Distance` (default 8) blocks of
|
||||
them. Nothing in the world changes and other players never see it. The wall
|
||||
covers all six faces, skips real solid blocks and is only drawn during build
|
||||
time; in Guess The Build it surrounds the plot being built. A move that would
|
||||
still end past the wall is cancelled, and anyone found beyond it by any other
|
||||
route (teleport, vehicle, the three-second sweep) is pulled to the nearest
|
||||
legal spot at their own height, or to the plot spawn if that spot is blocked.
|
||||
`Plot.Border.Enabled: false` hides the wall and keeps the limit;
|
||||
`Plot.Move-Outside: true` still lifts it altogether. Derived from
|
||||
EternalCombat's border module (Apache License 2.0) via Duels-OG, with the
|
||||
notice kept in `PlotBorderManager`; the config migration adds the
|
||||
`Plot.Border` block.
|
||||
- `LanguageMigrator` no longer falls through from the language.yml update into
|
||||
the heads main-menu update.
|
||||
|
||||
## 5.1.11 - 2026-09-14
|
||||
|
||||
### Changes
|
||||
|
||||
- The arena sidebar now follows the Scoreboard-OG network board's look: a
|
||||
`♥ BuildBattle-OG ♥` title, one blank line between labelled blocks and a
|
||||
`true-og.net` footer. The lobby card shows the mode, map, player count and
|
||||
countdown; Classic and Teams show the theme, phase, clock, player count or
|
||||
teammate and the plot being judged; Guess The Build shows the builder, the
|
||||
theme the viewer may know, round, clock, own points and the leader; the end
|
||||
card names the winner. Lines are built in code, so the `Scoreboard.Content`
|
||||
lists in `language.yml` are no longer read, and every line stays within 16
|
||||
legacy characters so 1.8 clients on ViaBackwards see it uncut.
|
||||
- Arena worlds no longer come up as vanilla terrain. The shaded MiniGamesBox
|
||||
deserializes arena locations with `Bukkit.createWorld(new WorldCreator(name))`
|
||||
for any world that is not loaded, so the first boot after 5.1.10 shipped the
|
||||
ready-made `BB1` arena generated plain overworlds named `BB1-map` and
|
||||
`BB1-hub` when the map folders were not in place yet, and MyWorlds recorded
|
||||
them with an empty chunk generator. `ArenaRegistry` now refuses to register
|
||||
an arena whose worlds cannot be loaded from an existing folder, so that path
|
||||
is never reached.
|
||||
- Maps are stored under a cold-storage directory instead of the server root,
|
||||
the way Splegg-OG and TheHerobrine-OG do it: `MyWorlds.Map-Base` (default
|
||||
`maps`, relative to the server root) holds one folder per map. On every
|
||||
enable each world named in `arenas.yml` is resolved to `<Map-Base>/<Name>/`
|
||||
(case-insensitively, ignoring `-` and `_`, and for an arena's game world also
|
||||
by its `mapname`, so `BB1-map` finds `maps/Plaza` and `BB1-hub` finds
|
||||
`maps/BB1_Hub`), any loaded copy is unloaded, the server-root copy is deleted
|
||||
and replaced with a fresh copy, and MyWorlds loads it. A world without a map
|
||||
there is loaded from the server root as before. Set `Map-Base` empty to turn
|
||||
the copy off.
|
||||
- Bundled `BuildBattle-OG:void` chunk generator, pinned onto every arena world
|
||||
the plugin loads unless MyWorlds already has one for it
|
||||
(`MyWorlds.Void-Generator`), so chunks outside the saved map stay void.
|
||||
- README: Quick Setup no longer asks for a manual copy to the server root or
|
||||
`/mw load`; the Bundled maps and Configuration sections describe the map
|
||||
directory and the two new keys.
|
||||
- The boss bar is now a timer for the current phase instead of MiniGamesBox's
|
||||
rotating messages. Its title names the phase (waiting with the player count,
|
||||
starting, theme vote, building, plot vote, builder picking a theme, guess the
|
||||
build, next round, game over, restarting) with a `mm:ss` clock and
|
||||
`true-og.net`, its colour follows the phase and it drains from full to empty
|
||||
as the phase runs out. `BaseArena` records the length of each phase from the
|
||||
timer and state changes, `PhaseBossbarManager` is returned from
|
||||
`getBossbarManager()` so MiniGamesBox's own join and leave hooks drive it,
|
||||
and `Bossbar.Interval` in `config.yml` no longer has an effect.
|
||||
- Every `plugily.xyz` link a player could see in game now reads `true-og.net`:
|
||||
the boss bar, the `Bossbar` and `Scoreboard` lists in `language.yml` and
|
||||
`locales/language_default.yml`.
|
||||
|
||||
## 5.1.10 - 2026-09-14
|
||||
|
||||
### Changes
|
||||
|
||||
- Ship `arenas.yml` configured for the open source TrueOG maps. Arena `BB1`
|
||||
now points at `Plaza` (public domain, twelve 31x31 plots around a central
|
||||
plaza) as `BB1-map` and `BB1_Hub` (Green Leave Lobby, CC BY-SA 3.0) as
|
||||
`BB1-hub`, with all twelve plot cuboids, the plaza centre as start and
|
||||
spectator location, the hub spawn as lobby and end location, and
|
||||
`maximumplayers: 12`. A fresh install needs the two worlds copied in and
|
||||
registered with MyWorlds, nothing else. Both maps live under `maps/` in the
|
||||
true-og repository.
|
||||
- README: Quick Setup follows the bundled-map path first; the manual setup GUI
|
||||
flow is kept for custom arenas and additional lobbies. New "Bundled maps"
|
||||
section documents the worlds, licenses and layout.
|
||||
|
||||
## 5.1.9 - 2026-09-12
|
||||
|
||||
### Changes
|
||||
|
||||
- Claim `/hub`, `/lobby` and `/spawn` inside BuildBattle worlds before any other
|
||||
plugin sees them, the way `/vote` already is. Splegg-OG and TheHerobrine-OG
|
||||
register `/hub` as well, and Bukkit hands the bare label to whichever plugin
|
||||
loads first, so an arena player's `/hub` could run another minigame's command
|
||||
and teleport them out while the arena still counted them; Spawn-OG's `/spawn`
|
||||
did the same. `/lobby` is now an alias of `/hub` everywhere, and the three
|
||||
labels are topped up into `Commands.Whitelist` on startup so MiniGamesBox's
|
||||
in-game command block does not report them.
|
||||
- `/bb join` and `/bbjoin` with no lobby list every arena with its state, fill
|
||||
and a clickable join line, like `/hbjoin`. `/bb join` now also accepts a bare
|
||||
number (`/bb join 1`) and a case-insensitive id, and replaces the bundled
|
||||
MiniGamesBox join argument.
|
||||
|
||||
## 5.1.8 - 2026-09-12
|
||||
|
||||
### Changes
|
||||
|
||||
- Render the arena sidebar through Scoreboard-OG's sidebar API when Scoreboard-OG
|
||||
`1.2.0` or newer is installed, so the network board comes back by itself after a
|
||||
match and `/togglescoreboard` is honoured. Without it the MiniGamesBox board is
|
||||
used as before.
|
||||
- `/hub` now puts MiniGamesBox's inventory snapshot back before the teleport home.
|
||||
The snapshot is taken after the teleport into the arena, so it belongs to the
|
||||
arena world's MyWorlds inventory; restoring it after the teleport overwrote the
|
||||
survival inventory MyWorlds had just swapped back in.
|
||||
- MyWorlds settings are applied at runtime only, the way TheHerobrine-OG and
|
||||
Splegg-OG do it. `MyWorlds/config.yml` is no longer rewritten on startup.
|
||||
- The locale service stub no longer carries the remote fetch code; every fetch
|
||||
answers with an empty stream, so the bundled locale is the only one that loads.
|
||||
- Plot teleport targets are resolved on the main thread instead of a ForkJoin
|
||||
worker reading block state.
|
||||
|
||||
## 5.1.7 - 2026-08-24
|
||||
|
||||
### Changes
|
||||
|
||||
- Register `<bb_score>` and `<bb_rank>` MiniPlaceholders through Utilities-OG.
|
||||
`<bb_score>` is the player's `POINTS_TOTAL`; `<bb_rank>` maps it onto a
|
||||
builder-themed ladder (Apprentice through Master Builder, then Inception's
|
||||
Forger, Dreamer, Extractor and Dom), with Dreamweaver reserved for
|
||||
the top scorer once they also hold Dom.
|
||||
|
||||
- Back both with a plugin-wide score cache seeded from the stats backend on
|
||||
enable and kept live by MiniGamesBox's statistic change event, so values are
|
||||
current the moment a game's points are awarded.
|
||||
|
||||
## 5.1.6 - 2026-08-17
|
||||
|
||||
### Changes
|
||||
|
||||
- Join signs now match TheHerobrine-OG's style: gold map name, black-on-sign
|
||||
player counts, and bold `JOIN` / `STARTING` / `LIVE` / `FULL` / `ENDING` /
|
||||
`RESTARTING` state labels. A language-file migration (version 3) rewrites the
|
||||
sign lines and `Placeholders.Game-States` on existing installs while leaving
|
||||
the MOTD state labels unchanged.
|
||||
|
||||
- Arena chat now renders the standard TrueOG name segment (union bracket tag,
|
||||
display name, LuckPerms suffix) like TheHerobrine-OG, with a caret colored by
|
||||
the sender's Chat-OG message color, while keeping the queue count, `SPEC`,
|
||||
`VOTE` / `JUDGING`, and theme prefixes.
|
||||
|
||||
## 5.1.5 - 2026-08-05
|
||||
|
||||
### Changes
|
||||
|
||||
- Scope creative mode to arena builders. `BuilderCreativeManager` grants a runtime
|
||||
creative exemption only while a player is an active builder inside an arena world,
|
||||
and suppresses GameModeInventories-OG's inventory swap for arena participants so
|
||||
the swap cannot clobber armour and offhand contents.
|
||||
- Remember where a player was before they joined an arena. `PreJoinLocationStore`
|
||||
keeps that location on disk, reloading an unloaded world through MyWorlds when it
|
||||
is needed, and expires entries after `MyWorlds.PreJoin-Location-Expiry-Days`.
|
||||
- Add the `MyWorlds.Protected-Worlds` list so arenas, plots and lobby locations can
|
||||
never be placed in the server's main overworld, nether or end.
|
||||
- Bundle `powerups.yml` and write it out on first start, so the shaded
|
||||
MiniGamesBox-Classic reader stops logging "File powerups.yml does not exist!".
|
||||
- Suppress the shaded library's "Loaded locale" console spam.
|
||||
- Drop a dead clause from the console-noise filter. It tried to hide the
|
||||
"you are using some fork that was not tested by us" warning, but that message is
|
||||
written straight to the console sender rather than through the plugin logger the
|
||||
filter is attached to, so the condition could never fire. That warning is
|
||||
therefore still printed on startup; suppressing it needs a different mechanism
|
||||
and is left for a later release. The "Loaded locale" suppression is unaffected
|
||||
and still works.
|
||||
- **Breaking:** the bundled `arenas.yml` template now names its worlds `BB1-hub` and
|
||||
`BB1-map` instead of `bb_lobby` and `bb_game_1`. Chat-OG resolves a world to a
|
||||
multi-world game by a `<letters><digits>-` prefix and keys the per-game Discord
|
||||
channel off it, so arena worlds have to follow that shape to get scoped chat and
|
||||
the Discord relay. Existing arenas keep the names they already have — changing
|
||||
the template does not migrate them. To adopt the convention, rename the world
|
||||
folders and update both `arenas.yml` and your MyWorlds configuration, then add a
|
||||
matching `BB` entry under `discord.games` in Chat-OG's config.
|
||||
- Render `language.yml` values through Utilities-OG's colorizer when that plugin is
|
||||
installed, so MiniMessage tags, `<#rrggbb>` hex, `<gradient:...>`, named colours
|
||||
and the `&*` rainbow code all work in messages, titles, action bars, scoreboards
|
||||
and signs. Only values that actually contain such a construct are converted;
|
||||
values using plain `&` codes are passed through byte-for-byte, so nothing that
|
||||
ships with the plugin changes appearance. Without Utilities-OG, every value keeps
|
||||
its previous formatting.
|
||||
- Remove seven permission nodes from `plugin.yml` that nothing ever checked:
|
||||
`buildbattle.admin.stopgame`, `.addsign`, `.plotwand`, `.create`,
|
||||
`.forcestart.theme`, `.supervotes.manage` and `buildbattle.command.bypass`. The
|
||||
nodes that actually gate those behaviours are `buildbattle.admin.stop`,
|
||||
`.admin.locwand`, `.admin.setup` and `.command.override`; grant those instead.
|
||||
In particular, bypassing in-game command blocking has always required
|
||||
`buildbattle.command.override`, which was never declared, while the declared
|
||||
`buildbattle.command.bypass` did nothing.
|
||||
- Declare the permission nodes that were checked but never listed, including
|
||||
`buildbattle.admin.setup`, `.stop`, `.locwand`, `.teleport`, `.spychat`,
|
||||
`.statistic`, `.forceplay`, `.theme` and `buildbattle.command.selectplot`, so
|
||||
`buildbattle.admin.*` grants the whole admin surface.
|
||||
- Disable the plugin instead of half-starting it when MyWorlds is missing. The
|
||||
startup check returned early after the base plugin had already enabled, leaving
|
||||
the server with a plugin marked enabled but no arenas, commands or listeners.
|
||||
- Suppress Guess The Build answers through Paper's `AsyncChatEvent` rather than the
|
||||
legacy `AsyncPlayerChatEvent`. Registering a legacy chat listener forced the whole
|
||||
server onto Paper's legacy chat path, and the handler raced Chat-OG for ownership
|
||||
of the event, so a correct guess could reach the world and Discord before it was
|
||||
suppressed.
|
||||
- Stop `/hub` registration from throwing when the command is absent from
|
||||
`plugin.yml`.
|
||||
- Fix a malformed `Core-Version: 1148-` marker in `powerups.yml` that parsed as `0`
|
||||
and would have left a duplicate `Do-Not-Edit` block behind on migration.
|
||||
- Report `1.19` as a supported version in `internal/data.yml`, and bring
|
||||
`locales/locale_data.yml` up to the current release.
|
||||
- Build Utilities-OG from a git submodule, add `bootstrap.sh`, and harvest vendored
|
||||
library licenses into `META-INF/licenses` automatically instead of listing them
|
||||
one by one.
|
||||
|
||||
## 5.1.4 - 2026-05-20
|
||||
|
||||
### Changes
|
||||
|
||||
- Add a `/hub` command that returns players from BuildBattle lobbies or active games
|
||||
to the main world spawn.
|
||||
- Return players to the main world when they reconnect from an arena world, or when
|
||||
they quit mid-game.
|
||||
- Clean up arena membership, plot membership, scoreboards, bossbars, action bars,
|
||||
player visibility and empty-game shutdown when a player leaves via `/hub`.
|
||||
- Whitelist `hub` by default for in-arena command blocking.
|
||||
- Show `&4BuildBattle-OG`, the arena name, its state and the player count on default
|
||||
sign lines.
|
||||
- Remove external telemetry, custom chart registration, the bundled metrics
|
||||
implementation and the metrics plugin id.
|
||||
|
||||
## 5.1.3 - 2026-04-23
|
||||
|
||||
### Changes
|
||||
|
||||
- Remove the Plugily Projects service hooks. Upstream's `ServiceRegistry.registerService()`
|
||||
pinged `https://api.plugily.xyz/ping.php` on enable and constructed `LocaleService`
|
||||
and `MetricsService`. The override skips the ping and leaves `serviceEnabled=false`,
|
||||
which also disables:
|
||||
- remote translation fetching from `api.plugily.xyz/locale/v3/fetch.php`, so the
|
||||
bundled `Default` locale is used instead;
|
||||
- automatic error reporting to `api.plugily.xyz/error/report.php`, since
|
||||
`ReportedException` gates on `isServiceEnabled()`;
|
||||
- Plugily's internal `MetricsService` timer.
|
||||
- Replace upstream's `UpdateChecker` with one that returns `UP_TO_DATE` instead of
|
||||
calling `api.spiget.org`, disabling both the on-enable check and the OP-join
|
||||
notifier.
|
||||
- Exclude the upstream `ServiceRegistry` and `UpdateChecker` classes from the shaded
|
||||
jar so the local overrides win after relocation.
|
||||
- Fix the head cache.
|
||||
- Add MyWorlds fork compatibility and backport to the 1.19.4 API.
|
||||
- Migrate the build from Maven to Gradle and rename the project to BuildBattle-OG.
|
||||
+165
-205
@@ -1,190 +1,202 @@
|
||||
# License
|
||||
|
||||
BuildBattle-OG - Ultimate building competition minigame.
|
||||
Copyright (C) 2022 Plugily Projects - maintained by Tigerpanzer_02 and contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program below. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
@@ -192,9 +204,9 @@ modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
@@ -202,12 +214,12 @@ non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
@@ -232,19 +244,19 @@ terms of section 4, provided that you also meet all of these conditions:
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
@@ -290,75 +302,75 @@ in one of these ways:
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
@@ -385,74 +397,74 @@ that material) supplement the terms of this License with terms:
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
@@ -460,43 +472,43 @@ give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
patent sublicenses in a manner consistent with the requirements of this
|
||||
License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
@@ -510,7 +522,7 @@ covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
@@ -518,10 +530,10 @@ or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
@@ -533,73 +545,73 @@ for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
@@ -609,9 +621,9 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
@@ -620,55 +632,3 @@ copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,370 @@
|
||||
# BuildBattle-OG
|
||||
|
||||
TrueOG Network's fork of [Plugily-Projects/BuildBattle](https://github.com/Plugily-Projects/BuildBattle) — a
|
||||
building competition minigame for Purpur `1.19.4`, using `MyWorlds` for arena world management.
|
||||
|
||||
Current version: `5.1.12` ([changelog](CHANGELOG.md)).
|
||||
|
||||
Two game modes ship in the box. In **classic** mode players build on their own plot against a theme, then vote
|
||||
on each other's builds. In **Guess The Build** one player builds while everyone else races to guess the theme
|
||||
in chat for points.
|
||||
|
||||
## OG fork notes
|
||||
|
||||
This fork makes no outside service calls. Upstream's update checker, remote translation fetching, error
|
||||
reporting and metrics are all stubbed out, so the bundled `Default` locale is always used and nothing phones
|
||||
home. It also adds `/hub`, `/bbjoin`, `/bbforcestart` and reconnect handling so players reliably get back to
|
||||
the main world from an arena, and integrates with the rest of the TrueOG plugin set (see
|
||||
[Integrations](#integrations)).
|
||||
|
||||
Return locations are recorded whenever a player enters an arena world by any route — `/bbjoin`, `/bb join`, a
|
||||
portal, or `/mw tp` — and are kept on disk, so `/hub`, a relog, a respawn or a server restart all put the
|
||||
player back where they started rather than at main world spawn.
|
||||
|
||||
`/v` and `/vote` are claimed inside BuildBattle worlds before any other plugin sees them, so VotingPlugin
|
||||
cannot take the `/vote` label away from theme voting. BuildBattle has no map pool to vote on, so the command
|
||||
drives the theme poll the vote menu already owns rather than adding a second one.
|
||||
|
||||
`/hub`, `/lobby` and `/spawn` are claimed the same way inside BuildBattle worlds. Splegg-OG and
|
||||
TheHerobrine-OG register `/hub` too, and Bukkit gives the bare label to whichever plugin loads first, so
|
||||
without the claim an arena player's `/hub` could run another minigame's command and teleport them out while
|
||||
the arena still counted them; Spawn-OG's `/spawn` did the same. All three now leave the arena properly and
|
||||
return the player to where they came from.
|
||||
|
||||
Every arena is its own lobby with its own hub world (`BB1-hub`, `BB2-hub`, ...). `/bb join` and `/bbjoin`
|
||||
with no lobby list them all with a clickable join line, like `/hbjoin`; `/bb join BB2` or `/bb join 2` joins
|
||||
one directly.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Purpur `1.19.4`
|
||||
- `MyWorlds` (either the `MyWorlds` or the `My_Worlds` fork — both plugin names are accepted)
|
||||
- `BKCommonLib` (MyWorlds' own dependency)
|
||||
|
||||
Optional, integrated when present: `Utilities-OG`, `Chat-OG`, `Scoreboard-OG`, `GameModeInventories-OG`,
|
||||
`Spawn-OG`, `Citizens`, `PlaceholderAPI`, `ViaVersion`.
|
||||
|
||||
## Quick Setup
|
||||
|
||||
The bundled `arenas.yml` ships arena `BB1` fully configured for the open source TrueOG maps, and the
|
||||
bundled `config.yml` already protects `world`, `world_nether` and `world_the_end`. What is left is
|
||||
putting the two worlds in place:
|
||||
|
||||
1. Fetch the maps from the [true-og repository](https://git.trueog.net/trueog/true-og) (`maps/`) and put
|
||||
`Plaza` and `BB1_Hub` under `<server root>/maps/`, the same directory Splegg-OG and TheHerobrine-OG use
|
||||
(`MyWorlds.Map-Base` in `config.yml`). See [Bundled maps](#bundled-maps).
|
||||
2. Drop the jar in `plugins/` and start the server. On every boot the plugin copies each arena world from
|
||||
`maps/` to the server root under its world name (`BB1-map` from `Plaza` via the arena's `mapname`,
|
||||
`BB1-hub` from `BB1_Hub`), pins its void generator and loads it through MyWorlds; nothing has to be
|
||||
registered by hand. Worlds live at the server root only as disposable copies.
|
||||
3. `/bb join BB1` (`/bb join` alone lists the lobbies).
|
||||
|
||||
A world with no map under `maps/` is loaded from the server root as before, but never generated: an arena
|
||||
whose world is missing from both places is skipped with an error in the console instead of being handed
|
||||
a freshly generated vanilla world.
|
||||
|
||||
Only if your main worlds are not named `world`, `world_nether` and `world_the_end`: list them under
|
||||
`MyWorlds.Protected-Worlds` in `config.yml` so arenas can never be created there.
|
||||
|
||||
To build your own arena instead, or to add a second concurrent lobby with its own `BB2-hub` and `BB2-map`
|
||||
worlds: `/bba setup create <arena>` opens the setup inventory for the lobby, start and end locations,
|
||||
`/bba addplot <arena>` marks each build plot with the location wand, `/bba settheme <theme>` overrides the
|
||||
bundled `themes.yml` list, and `/bba setup edit <arena>` reopens the inventory later. Optionally place join
|
||||
signs in the hub so players can join without commands (see [Join Signs](#join-signs)).
|
||||
|
||||
## Bundled maps
|
||||
|
||||
Both maps are maintained in the [true-og repository](https://git.trueog.net/trueog/true-og) under `maps/`,
|
||||
which is also where the server keeps them (`MyWorlds.Map-Base`), and are the canonical worlds for the
|
||||
shipped `BB1` arena:
|
||||
|
||||
| Map | Server world | License | Notes |
|
||||
|---|---|---|---|
|
||||
| `Plaza` | `BB1-map` | Unlicense (public domain) | Twelve 31x31 plots (y 64 to 96) in a ring around a 41x41 plaza, floating in the void. Generated by `Plaza/tools/gen_plaza.py`, so it can be regenerated or resized. |
|
||||
| `BB1_Hub` | `BB1-hub` | CC BY-SA 3.0, Green Leave Lobby by Libers97 | Same lobby build as `SP1_Hub` and `HB1_Hub`; spawn at `-3, 64, 1`. |
|
||||
|
||||
The shipped `arenas.yml` lists the twelve plot cuboids, the plaza centre (`0.5, 65, 0.5`) as start and
|
||||
spectator location, and the hub spawn as lobby and end location, with `maximumplayers: 12` (one plot per
|
||||
player). Plot floors are regenerated from the cuboid's lowest layer with `Floor.Material` on every reset;
|
||||
Plaza's oak floors match the default `log`, and its frames and pedestals sit outside the cuboids so they
|
||||
survive resets. Keep both worlds out of GameModeInventories-OG's `restrict_adventure_worlds` and Spawn-OG's
|
||||
`login-safety.worlds`.
|
||||
|
||||
The server-root copies are rebuilt from `maps/` on every start, so in-game edits to an arena world do not
|
||||
survive a restart; to change a map, replace the files under `maps/<Name>/`. Chunks outside the saved
|
||||
region generate as void through the bundled `BuildBattle-OG:void` generator, which the plugin pins onto
|
||||
each arena world in MyWorlds' `worlds.yml` unless one is already set (`MyWorlds.Void-Generator`).
|
||||
|
||||
## Join Signs
|
||||
|
||||
Admins can place physical signs that players right-click to join an arena. Signs render the four lines from
|
||||
`Signs.Lines` in `language.yml` (title, arena name, game state, player counts) and update automatically. With
|
||||
`Sign-Block-States: true` in `config.yml`, the block behind the sign also changes color with the game state
|
||||
(white waiting, yellow starting, orange in game, gray ending, black restarting).
|
||||
|
||||
To set one up:
|
||||
|
||||
1. Make sure the arena exists (`/bba setup create <arena>`, see Quick Setup above).
|
||||
2. Place a sign in a persistent world such as the server hub — not in the `BB<n>-map`/`BB<n>-hub` worlds,
|
||||
which are recreated between games.
|
||||
3. Write `[buildbattle]` on the first line and the arena id (e.g. `BB1`) on the second line. Requires the
|
||||
`buildbattle.admin.sign.create` permission.
|
||||
4. The sign reformats immediately; right-clicking it joins that arena.
|
||||
|
||||
Sign locations are saved under the arena's `signs:` list in `arenas.yml`. Breaking a registered sign requires
|
||||
`buildbattle.admin.sign.break` and removes it from the arena.
|
||||
|
||||
## World naming
|
||||
|
||||
Arena worlds must be named `BB<n>-<map>` and their lobby worlds `BB<n>-hub`, for example `BB1-map` and
|
||||
`BB1-hub`. Chat-OG resolves a world to a multi-world game by that `<letters><digits>-` prefix and keys its
|
||||
per-game Discord channel off it, so the `BB` prefix must also exist under `discord.games` in **Chat-OG's**
|
||||
`config.yml`. Worlds named any other way simply stay in global chat — everything else still works.
|
||||
|
||||
Arena ids follow the same convention, so the arena that owns `BB1-hub` and `BB1-map` is named `BB1`. `/bbjoin`
|
||||
accepts the id case-insensitively and also accepts the bare number, so `/bbjoin BB1`, `/bbjoin bb1` and
|
||||
`/bbjoin 1` are the same command. A bare number that matches more than one arena is refused rather than
|
||||
guessed.
|
||||
|
||||
> **Upgrading from 5.1.4 or earlier:** the bundled `arenas.yml` template changed from `bb_lobby` / `bb_game_1`
|
||||
> to `BB1-hub` / `BB1-map`, and its arena id from `default` to `BB1`. Existing arenas keep whatever names they
|
||||
> already have; changing the template does not migrate them. To adopt the convention: stop the server, rename
|
||||
> the world folders, then update the arena id, the three location lines and `world:` in `arenas.yml` along with
|
||||
> your MyWorlds `worlds.yml` and `inventories.yml` entries. Until the worlds are renamed, `/bbjoin <number>`
|
||||
> cannot resolve the arena and no chat formatter is registered.
|
||||
|
||||
## Configuration
|
||||
|
||||
`config.yml` holds the fork-specific `MyWorlds` block:
|
||||
|
||||
```yaml
|
||||
MyWorlds:
|
||||
# Applied to MyWorlds at runtime on startup; MyWorlds' own config.yml is never rewritten.
|
||||
Enable-World-Inventories: true
|
||||
Enable-World-Chat: true
|
||||
# BuildBattle arenas, plots and lobby locations are blocked from these worlds.
|
||||
Protected-Worlds:
|
||||
- world
|
||||
- world_nether
|
||||
- world_the_end
|
||||
# Days to keep a player's pre-arena return location on disk (0 = keep forever).
|
||||
PreJoin-Location-Expiry-Days: 30
|
||||
# Cold-storage map directory, relative to the server root (absolute paths accepted, empty disables).
|
||||
# Each arena world is copied from <Map-Base>/<Name>/ to the server root and loaded on every boot.
|
||||
Map-Base: 'maps'
|
||||
# Pin the bundled void generator onto every arena world so unsaved chunks stay void.
|
||||
Void-Generator: true
|
||||
```
|
||||
|
||||
Classic and Teams matches run in rounds, set per mode under `Time-Manager` in `config.yml`:
|
||||
|
||||
```yaml
|
||||
Time-Manager:
|
||||
Classic:
|
||||
# Build rounds per match; each round gets its own theme and plot vote, points add up.
|
||||
Rounds: 3
|
||||
# Pick each round's theme at random from themes.yml instead of holding a vote.
|
||||
Random-Theme: true
|
||||
Voting:
|
||||
# Total time of voting for themes before starting
|
||||
Theme: 25
|
||||
# Total time of voting per player plot
|
||||
Plot: 15
|
||||
# Build time per round
|
||||
In-Game: 150
|
||||
```
|
||||
|
||||
Each round announces its theme (drawn at random from the mode's list in `themes.yml`, or voted on for
|
||||
`Voting.Theme` seconds when `Random-Theme` is off; a theme is never repeated within a match), runs the build
|
||||
clock, then walks every plot for a vote. Plots are wiped between rounds, votes add up across them, and the
|
||||
highest total after the last round wins. `Rounds: 1` is the single-build upstream flow.
|
||||
|
||||
While building, each player is held to their plot plus a grace margin (`Plot.Border` in `config.yml`):
|
||||
|
||||
```yaml
|
||||
Plot:
|
||||
# Wall around the plot a player is building in, shown only to them; the world is never changed.
|
||||
Border:
|
||||
# Draw the wall. Off, the limit below still holds and a builder past it is pulled back.
|
||||
Enabled: true
|
||||
# Blocks a builder may step outside the plot before the wall.
|
||||
Grace: 3
|
||||
# Wall blocks within this many blocks of the builder are drawn.
|
||||
Distance: 8
|
||||
# RAINBOW_GLASS, RAINBOW_WOOL, RAINBOW_TERRACOTTA, RAINBOW_CONCRETE or any block name.
|
||||
Block: RAINBOW_GLASS
|
||||
```
|
||||
|
||||
The wall is the one-block shell just outside that margin, sent to the builder as client-side block
|
||||
changes (`Player#sendMultiBlockChange`) and restored as they move away, so nothing in the world changes
|
||||
and nobody else sees it. It is drawn during build time only, on all six faces, and skips real solid blocks.
|
||||
A move that would still end beyond the wall is cancelled, and anyone found past it by any other route
|
||||
(a teleport, a vehicle) is pulled to the nearest legal spot at their own height, or to the plot spawn
|
||||
when that spot is blocked. `Plot.Move-Outside: true` turns the whole thing off.
|
||||
|
||||
Arenas live in `arenas.yml`:
|
||||
|
||||
```yaml
|
||||
instances:
|
||||
BB1:
|
||||
lobbylocation: BB1-hub,-1.0,80.0,7.0,0.0,0.0
|
||||
startlocation: BB1-map,-1.0,80.0,7.0,0.0,0.0
|
||||
endlocation: BB1-hub,-1.0,80.0,7.0,0.0,0.0
|
||||
minimumplayers: 2
|
||||
maximumplayers: 10
|
||||
plotmembersize: 1
|
||||
mapname: mapname
|
||||
world: BB1-map
|
||||
# classic (deprecated: solo), guess_the_build
|
||||
gametype: classic
|
||||
isdone: false
|
||||
signs: {}
|
||||
plots: {}
|
||||
```
|
||||
|
||||
Themes are in `themes.yml`, messages in `language.yml`, and per-player statistics use `mysql.yml` when
|
||||
`Database.Enabled` is on.
|
||||
|
||||
The boss bar is a timer for the current phase: its title names the phase with a `mm:ss` clock and
|
||||
`true-og.net`, its colour follows the phase, and it drains as the phase runs out. `Bossbar.Display` in
|
||||
`config.yml` turns it off; the `Bossbar` lists in `language.yml` are not read.
|
||||
|
||||
## Placeholders
|
||||
|
||||
Registered through Utilities-OG as MiniPlaceholders, resolved for the viewing player, and updated the
|
||||
moment a game's points are awarded:
|
||||
|
||||
| Placeholder | Value |
|
||||
|-------------|-------|
|
||||
| `<bb_score>` | The player's `POINTS_TOTAL` |
|
||||
| `<bb_rank>` | Colored rank name for that score: Apprentice (0), Builder (100), Bricklayer (300), Carpenter (750), Mason (1,500), Craftsman (3,000), Architect (6,000), Engineer (10,000), Sculptor (15,000), Master Builder (25,000), Forger (40,000), Dreamer (60,000), Extractor (100,000), Dom (150,000); Dreamweaver for the top player once they also reach Dom |
|
||||
|
||||
## Integrations
|
||||
|
||||
| Plugin | Effect when installed |
|
||||
|--------|-----------------------|
|
||||
| `MyWorlds` / `My_Worlds` | **Required.** Arena world management, per-world inventories and chat. |
|
||||
| `Utilities-OG` | Registers the `<bb_score>` and `<bb_rank>` [placeholders](#placeholders). `language.yml` values containing a MiniMessage tag or the `&*` rainbow code render through TrueOG's colorizer, enabling `<#rrggbb>` hex, `<gradient:...>`, named colours and decorations. Plain `&`-coded values are passed through byte-for-byte, so nothing shipped changes appearance. Without the plugin, all values keep their default formatting. |
|
||||
| `Chat-OG` | Arena chat is scoped per world, styled by BuildBattle-OG's own formatter, and mirrored to the game's Discord channel, provided worlds follow the [naming convention](#world-naming) and `discord.games.BB` exists in Chat-OG's config. The formatter shows the player count in the lobby, `VOTE` and `JUDGING` during the voting phases, and the theme while building — never in Guess The Build, where the theme is the answer. |
|
||||
| `Scoreboard-OG` | With `1.2.0` or newer, the arena sidebar is drawn through Scoreboard-OG's sidebar API instead of MiniGamesBox's packet board. The network board returns on its own when the player leaves the arena, and `/togglescoreboard` is honoured. Older builds, or no Scoreboard-OG at all, keep the MiniGamesBox board. Both draw the same code-built card in the TrueOG style (`♥ BuildBattle-OG ♥` title, blank-separated blocks, `true-og.net` footer) with every line within 16 legacy characters for 1.8 clients; only `Scoreboard.Title` and `Scoreboard.Theme-Unknown` in `language.yml` are still read. |
|
||||
| `GameModeInventories-OG` | Its inventory swap is suspended for everyone inside arena worlds, by any route in, and for one tick after leaving, so the survival inventory is never filed under an arena gamemode. Builders additionally get a creative exemption scoped to arena worlds at runtime. Do **not** grant regular players `gamemodeinventories.toggle` or `gamemodeinventories.anywhere`, and keep arena worlds **out** of `restrict_adventure_worlds` — guessers are put in adventure mode. |
|
||||
| `Spawn-OG` | Keep arena worlds **out** of its `login-safety.worlds` list so reconnect handling stays with BuildBattle-OG. |
|
||||
| `VotingPlugin` | Keeps `/vote` and `/v` everywhere outside BuildBattle worlds; BuildBattle-OG never declares either label in plugin.yml. |
|
||||
| `Citizens` | Enables `/bba addnpc` for plot NPCs. |
|
||||
| `PlaceholderAPI` | Exposes arena placeholders to other plugins. |
|
||||
|
||||
## Commands
|
||||
|
||||
`/bb` (aliases `buildbattle`, `buildb`) and `/bba` (aliases `buildbattleadmin`, `buildbadmin`) each print
|
||||
their own help listing. The tables below cover the arguments this fork defines plus the most-used ones
|
||||
inherited from MiniGamesBox.
|
||||
|
||||
### Player Commands
|
||||
|
||||
| Command | Permission | Description |
|
||||
|---------|------------|-------------|
|
||||
| `/bb join [lobby]` | — | Join a lobby by id (`BB1`, or just `1`); no argument lists the lobbies with clickable join lines |
|
||||
| `/bbjoin [lobby]` | — | The same as `/bb join` |
|
||||
| `/hub`, `/lobby`, `/spawn` | — | Leave the arena and return to where you came from, or to main spawn |
|
||||
| `/bb randomjoin` | — | Join any arena with room |
|
||||
| `/vote [#]` or `/v [#]` | — | List the themes up for voting and cast a vote |
|
||||
| `/bb leave` | — | Leave the current arena |
|
||||
| `/bb arenas` | `buildbattle.arenas` | Open the arena selector |
|
||||
| `/bb menu` | — | Open the plot options menu |
|
||||
| `/bb guess <word>` | — | Submit a Guess The Build guess |
|
||||
| `/bb selectplot` | `buildbattle.command.selectplot` | Select the plot you are standing in |
|
||||
| `/bb stats` | — | Show your statistics |
|
||||
| `/bb top [statistic]` | — | Show the leaderboard |
|
||||
| `/hub` | — | Leave the arena or lobby and return to the main world |
|
||||
|
||||
### Admin Commands
|
||||
|
||||
| Command | Permission | Description |
|
||||
|---------|------------|-------------|
|
||||
| `/bba setup create <arena>` | `buildbattle.admin.setup` | Create a new arena |
|
||||
| `/bba setup edit <arena>` | `buildbattle.admin.setup` | Open the arena setup inventory |
|
||||
| `/bba delete <arena>` | `buildbattle.admin.delete` | Delete an arena |
|
||||
| `/bba list` | `buildbattle.admin.list` | List arenas and their states |
|
||||
| `/bba reload` | `buildbattle.admin.reload` | Reload configuration |
|
||||
| `/bba stop` | `buildbattle.admin.stop` | Stop the running game |
|
||||
| `/bbforcestart [time]` | `buildbattle.admin.forcestart` | Start the game ignoring `minimumplayers` |
|
||||
| `/bba forcestart` | `buildbattle.admin.forcestart` | Force the game to start |
|
||||
| `/bba forceplay <arena> <theme>` | `buildbattle.admin.forceplay` | Force an arena to play a theme |
|
||||
| `/bba settheme <theme>` | `buildbattle.admin.settheme` | Set the current arena's theme |
|
||||
| `/bba theme [add/remove] [gameType] [theme]` | `buildbattle.admin.theme` | Manage the theme list |
|
||||
| `/bba addplot <arena>` | `buildbattle.admin.addplot` | Add a build plot using the location wand |
|
||||
| `/bba removeplot <arena> <plot ID>` | `buildbattle.admin.removeplot` | Remove a build plot |
|
||||
| `/bba addnpc` | `buildbattle.admin.addnpc` | Place a plot NPC (requires Citizens) |
|
||||
| `/bba locwand` | `buildbattle.admin.locwand` | Get the plot selection wand |
|
||||
| `/bba tp <arena/worldName> [location type]` | `buildbattle.admin.teleport` | Teleport to an arena location |
|
||||
| `/bba spychat` | `buildbattle.admin.spychat` | Toggle arena chat spying |
|
||||
| `/bba statistic <adjust/set> <statistic> <amount> [player]` | `buildbattle.admin.statistic` | Adjust a player's statistic (`buildbattle.admin.statistic.others` for `[player]`) |
|
||||
|
||||
## Permissions
|
||||
|
||||
### Administration
|
||||
|
||||
`buildbattle.admin.*` (default OP) grants every node in the Admin Commands table above, plus:
|
||||
|
||||
| Permission | Default | Description |
|
||||
|------------|---------|-------------|
|
||||
| `buildbattle.admin` | OP | Base administrative access |
|
||||
| `buildbattle.admin.sign.create` | OP | Create BuildBattle join signs |
|
||||
| `buildbattle.admin.sign.break` | OP | Break BuildBattle join signs |
|
||||
| `buildbattle.admin.statistic.others` | OP | Adjust another player's statistics |
|
||||
| `buildbattle.admin.locale` / `.locales` | OP | Inspect and switch locales |
|
||||
| `buildbattle.admin.kitfile` | OP | Manage kit files |
|
||||
| `buildbattle.admin.placeholders` | OP | Check placeholder resolution |
|
||||
| `buildbattle.admin.leaderboard.manage` | OP | Manage leaderboard holograms |
|
||||
| `buildbattle.command.override` | OP | Bypass in-game command blocking (`Block.In-Game.Commands`) |
|
||||
| `buildbattle.updatenotify` | OP | Update notifications (inert in this fork) |
|
||||
|
||||
### Gameplay
|
||||
|
||||
| Permission | Default | Description |
|
||||
|------------|---------|-------------|
|
||||
| `buildbattle.command.selectplot` | OP | Select the plot you are standing in |
|
||||
| `buildbattle.particles` | OP | Use the particle menu |
|
||||
| `buildbattle.heads` | OP | Use the player-heads menu (set per entry in `heads/mainmenu.yml`) |
|
||||
| `buildbattle.arenas` | OP | Open the arena selector |
|
||||
| `buildbattle.fullgames` | OP | Join arenas that are already full |
|
||||
| `buildbattle.join.<arena>` | OP | Join a specific arena, when per-arena join permissions are enabled |
|
||||
|
||||
Point, voting and experience multipliers are configured by permission node in `permissions.yml`. Biome menu
|
||||
entries use `biomes.VIP` by default, configurable in `biomes.yml`.
|
||||
|
||||
## Building
|
||||
|
||||
```bash
|
||||
git clone --recursive https://git.trueog.net/trueog/BuildBattle-OG
|
||||
cd BuildBattle-OG
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
If you cloned without `--recursive`, run `./bootstrap.sh` first. The shaded plugin jar lands in
|
||||
`build/libs/BuildBattle-OG-<version>.jar`.
|
||||
|
||||
# Credits
|
||||
|
||||
BuildBattle-OG is a fork of [Plugily-Projects/BuildBattle](https://github.com/Plugily-Projects/BuildBattle) by
|
||||
Tigerpanzer_02, Plajer, TomTheDeveloper and contributors, distributed under the GPLv3.
|
||||
|
||||
## Open Source Libraries
|
||||
|
||||
| Library | Author | License |
|
||||
|-------------------------------------------------------------|-------------------------------------------------------|------------------------------------------------------------------------------------|
|
||||
| [InventoryFramework](https://github.com/stefvanschie/IF/) | [stefvanschie](https://github.com/stefvanschie) | [Unlicense](https://github.com/stefvanschie/IF/blob/master/LICENSE) |
|
||||
| [ScoreboardLib](https://github.com/TigerHix/ScoreboardLib/) | [TigerHix](https://github.com/TigerHix) | [LGPLv3](https://github.com/TigerHix/ScoreboardLib/blob/master/LICENSE) |
|
||||
| [HikariCP](https://github.com/brettwooldridge/HikariCP) | [brettwooldridge](https://github.com/brettwooldridge) | [Apache License 2.0](https://github.com/brettwooldridge/HikariCP/blob/dev/LICENSE) |
|
||||
| [Commons Box](https://github.com/Plajer/Commons-Box) | [Plajer](https://github.com/Plajer) | [GPLv3](https://github.com/Plajer/Commons-Box/blob/master/LICENSE.md) |
|
||||
|
||||
The plot wall (`PlotBorderManager`) is derived from the border module of
|
||||
[EternalCombat](https://github.com/EternalCodeTeam/EternalCombat) by the EternalCode Team, by way of the
|
||||
TrueOG [Duels-OG](https://git.trueog.net/trueog/Duels-OG) adaptation. Both are licensed under the
|
||||
[Apache License 2.0](https://github.com/EternalCodeTeam/EternalCombat/blob/master/LICENSE); the file keeps
|
||||
that notice and lists the changes made.
|
||||
|
||||
## Attributions
|
||||
|
||||
Thanks to Code Whale for the Open Source POEditor license behind upstream's locales, and to
|
||||
[Minecraft Heads](https://minecraft-heads.com/) for the head names and textures used in the heads menu.
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Fetch all submodule content.
|
||||
git submodule update --force --recursive --init
|
||||
@@ -0,0 +1,205 @@
|
||||
/* ------------------------------ Plugins ------------------------------ */
|
||||
plugins {
|
||||
id("java") // Import Java plugin.
|
||||
id("java-library") // Import Java Library plugin.
|
||||
id("com.diffplug.spotless") version "8.1.0" // Import Spotless plugin.
|
||||
id("com.gradleup.shadow") version "8.3.9" // Import Shadow plugin.
|
||||
id("checkstyle") // Import Checkstyle plugin.
|
||||
eclipse // Import Eclipse plugin.
|
||||
}
|
||||
|
||||
extra["kotlinAttribute"] = Attribute.of("kotlin-tag", Boolean::class.javaObjectType)
|
||||
|
||||
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
|
||||
|
||||
/* --------------------------- JDK / Kotlin ---------------------------- */
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
|
||||
toolchain { // Select Java toolchain.
|
||||
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
|
||||
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "plugily.projects"
|
||||
|
||||
version = "5.1.12"
|
||||
|
||||
description = "BuildBattle-OG" // Declare plugin description.
|
||||
|
||||
val apiVersion = "1.19" // Declare minecraft server target version.
|
||||
|
||||
// Harvest every upstream license shipped alongside a vendored jar in libs/, so adding a library does
|
||||
// not also require editing this file.
|
||||
val vendoredLicenseFiles =
|
||||
fileTree("libs") {
|
||||
include("**/LICENSE", "**/LICENSE.*", "**/License", "**/License.*", "**/COPYING", "**/COPYING.*")
|
||||
include("**/NOTICE", "**/NOTICE.*")
|
||||
exclude("**/build/**", "**/.git/**")
|
||||
}
|
||||
|
||||
/* ----------------------------- Resources ----------------------------- */
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
val props = mapOf("version" to version, "apiVersion" to apiVersion)
|
||||
inputs.properties(props) // Indicates to rerun if version changes.
|
||||
filesMatching("plugin.yml") { expand(props) }
|
||||
from("LICENSE.md") { into("/") } // Bundle licenses into jarfiles.
|
||||
}
|
||||
|
||||
/* ---------------------------- Repos ---------------------------------- */
|
||||
repositories {
|
||||
mavenCentral() // Import the Maven Central Maven Repository.
|
||||
maven("https://ci.mg-dev.eu/plugin/repository/everything/") // BKCommonLib.
|
||||
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
|
||||
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
|
||||
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
|
||||
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let { // TrueOG Bootstrap mavenLocal().
|
||||
val dir = file(it)
|
||||
if (dir.isDirectory) {
|
||||
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
|
||||
maven { url = uri("file://${dir.absolutePath}") }
|
||||
} else {
|
||||
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
mavenLocal()
|
||||
}
|
||||
} ?: logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
maven { url = uri("https://maven.plugily.xyz/releases") }
|
||||
maven { url = uri("https://maven.plugily.xyz/snapshots") }
|
||||
maven { url = uri("https://repo.citizensnpcs.co/") }
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
}
|
||||
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur API version to be packaged.
|
||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||
compileOnly(project(":libs:MyWorlds")) // Import MyWorlds API (git submodule, built from source).
|
||||
compileOnly(
|
||||
"com.bergerkiller.bukkit:BKCommonLib:1.19.4-v2"
|
||||
) // Import BKCommonLib API from its Maven repository (required by MyWorlds at compile time).
|
||||
compileOnly("net.citizensnpcs:citizensapi:2.0.26-SNAPSHOT") {
|
||||
exclude(group = "ch.ethz.globis.phtree", module = "phtree")
|
||||
}
|
||||
// Import TrueOG Network Utilities-OG Java API (from source), used for TrueOG color/gradient rendering.
|
||||
// NEVER promote this to implementation: Utilities-OG shades the Kotlin stdlib and coroutines, and with
|
||||
// isEnableRelocation = true below they would be rewritten under plugily.projects.shadow.* and break at
|
||||
// runtime. compileOnly/compileOnlyApi stay off runtimeClasspath, so Shadow never bundles or relocates them.
|
||||
compileOnlyApi(project(":libs:Utilities-OG"))
|
||||
compileOnly(
|
||||
files("libs/Chat-OG/Chat-OG.jar")
|
||||
) // Import Chat-OG API for world chat formatting (vendored jar until the API lands in trueog/Chat-OG).
|
||||
compileOnly(project(":libs:Scoreboard-OG")) // Import TrueOG Network Scoreboard-OG Java API (from source).
|
||||
implementation("plugily.projects:MiniGamesBox-Classic:1.4.5")
|
||||
implementation("org.slf4j:slf4j-api:2.0.17") // Bundle a relocated SLF4J API for shaded dependencies.
|
||||
implementation("org.slf4j:slf4j-nop:2.0.17") // Provide a relocated no-op SLF4J backend to avoid provider warnings.
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.13.3") // Add JUnit API to testing environment.
|
||||
// compileOnly/compileOnlyApi do not propagate to the test classpath, so restate what the tests need.
|
||||
testImplementation("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Adventure lives here.
|
||||
testImplementation(project(":libs:Utilities-OG")) // The colorizer under test.
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // Add JUnit engine to the testing runtime.
|
||||
}
|
||||
|
||||
apply(from = "eclipse.gradle.kts") // Import eclipse classpath support script.
|
||||
|
||||
/* ---------------------- Reproducible jars ---------------------------- */
|
||||
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
|
||||
isPreserveFileTimestamps = false
|
||||
isReproducibleFileOrder = true
|
||||
}
|
||||
|
||||
/* ----------------------------- Shadow -------------------------------- */
|
||||
tasks.shadowJar {
|
||||
exclude("io.github.miniplaceholders.*") // Exclude the MiniPlaceholders package from being shadowed.
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/locale/LocaleService.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/locale/LocaleService$*.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/ServiceRegistry.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/metrics/Metrics.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/metrics/Metrics$*.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/metrics/MetricsService.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/metrics/MetricsService$*.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/UpdateChecker.class")
|
||||
exclude("plugily/projects/minigamesbox/classic/utils/services/UpdateChecker$*.class")
|
||||
from("LICENSE.md") {
|
||||
into("META-INF/licenses/BuildBattle-OG")
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
from(vendoredLicenseFiles) {
|
||||
into("META-INF/licenses/libs")
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
isEnableRelocation = true
|
||||
relocationPrefix = "${project.group}.shadow"
|
||||
relocate("com.zaxxer.hikari", "plugily.projects.buildbattle.database.hikari")
|
||||
relocate("plugily.projects.minigamesbox", "plugily.projects.buildbattle.minigamesbox")
|
||||
archiveClassifier.set("") // Use empty string instead of null.
|
||||
// Relocate the SLF4J provider registration with SLF4J itself; the other service files keep their current form.
|
||||
mergeServiceFiles { setIncludes(listOf("META-INF/services/org.slf4j.spi.SLF4JServiceProvider")) }
|
||||
minimize {
|
||||
// SLF4J discovers providers through META-INF/services, so Shadow's static minimizer cannot see this usage.
|
||||
exclude(dependency("org.slf4j:slf4j-nop:.*"))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
|
||||
|
||||
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar) } // Build depends on spotless and shadow.
|
||||
|
||||
/* --------------------------------- Testing ---------------------------- */
|
||||
tasks.withType<Test>().configureEach {
|
||||
useJUnitPlatform() // Enable testing with JUnit 5.
|
||||
}
|
||||
|
||||
/* --------------------------- Javac opts ------------------------------- */
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.add("-parameters") // Enable reflection for java code.
|
||||
options.isFork = true // Run javac in its own process.
|
||||
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
|
||||
options.encoding = "UTF-8" // Use UTF-8 file encoding.
|
||||
}
|
||||
|
||||
/* ----------------------------- Auto Formatting ------------------------ */
|
||||
spotless {
|
||||
java {
|
||||
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
|
||||
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
|
||||
removeUnusedImports() // Remove imports that aren't being called.
|
||||
}
|
||||
kotlinGradle {
|
||||
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
|
||||
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
|
||||
}
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.18.1" // Declare checkstyle version to use.
|
||||
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
|
||||
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
|
||||
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
|
||||
}
|
||||
|
||||
tasks.named("compileJava") {
|
||||
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
|
||||
}
|
||||
|
||||
tasks.named("spotlessCheck") {
|
||||
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
|
||||
}
|
||||
|
||||
/* ------------------------------ Eclipse SHIM ------------------------- */
|
||||
|
||||
// This can't be put in eclipse.gradle.kts because Gradle is weird.
|
||||
// Qualifying subproject names keeps :libs:Utilities-OG from colliding with the standalone
|
||||
// Utilities-OG project that also lives in the Eclipse workspace.
|
||||
subprojects {
|
||||
// ":libs" is only an implicit container created by include(":libs:Utilities-OG"). Applying the
|
||||
// Java plugin to it produced a junk libs/build/libs/libs-BuildBattle-OG.jar next to the vendored
|
||||
// dependency directories.
|
||||
if (project.path == ":libs") {
|
||||
return@subprojects
|
||||
}
|
||||
apply(plugin = "java-library")
|
||||
apply(plugin = "eclipse")
|
||||
eclipse.project.name = "${project.name}-${rootProject.name}"
|
||||
tasks.withType<Jar>().configureEach { archiveBaseName.set("${project.name}-${rootProject.name}") }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="FinalLocalVariable"/>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="Indentation">
|
||||
<property name="severity" value="ignore"/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="ignoreCase" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="(?<!\w)fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="23">
|
||||
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
@@ -0,0 +1,151 @@
|
||||
/* Eclipse IDE classpath plumbing. Shared across TrueOG plugin repos. */
|
||||
|
||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel
|
||||
import java.nio.file.Files
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import javax.xml.transform.OutputKeys
|
||||
import javax.xml.transform.TransformerFactory
|
||||
import javax.xml.transform.dom.DOMSource
|
||||
import javax.xml.transform.stream.StreamResult
|
||||
|
||||
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
|
||||
|
||||
val kotlinPluginProjects = configurations
|
||||
.getByName("compileClasspath")
|
||||
.allDependencies
|
||||
.filterIsInstance<ProjectDependency>()
|
||||
.filter { it -> it.attributes.getAttribute(kotlinAttribute) != null }
|
||||
.map { it.path }
|
||||
kotlinPluginProjects.forEach { evaluationDependsOn(it) }
|
||||
|
||||
val ideLibs: Configuration by
|
||||
configurations.creating {
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
}
|
||||
|
||||
configure<EclipseModel> {
|
||||
project {
|
||||
name = "BuildBattle-OG-Plugin"
|
||||
}
|
||||
classpath {
|
||||
plusConfigurations.add(ideLibs)
|
||||
}
|
||||
}
|
||||
|
||||
val ideLibDir = layout.buildDirectory.dir("ide-libs")
|
||||
val hashRegex = Regex("-[0-9a-fA-F]{10}(?=\\.jar$)") // Black magic.
|
||||
|
||||
val copyTasks = mutableListOf<TaskProvider<Copy>>()
|
||||
|
||||
kotlinPluginProjects.forEach { path ->
|
||||
val sub = project(path)
|
||||
val shadowJarProv = sub.tasks.named("shadowJar")
|
||||
val copyTask =
|
||||
tasks.register<Copy>("ideCopy${sub.name.replaceFirstChar(Char::titlecase)}") {
|
||||
dependsOn(shadowJarProv)
|
||||
from(shadowJarProv)
|
||||
into(ideLibDir)
|
||||
rename { it.replace(hashRegex, "") } // Remove git commit hash from jarfile.
|
||||
}
|
||||
copyTasks += copyTask
|
||||
}
|
||||
|
||||
/* Ensure the jars exist before .classpath is generated */
|
||||
tasks.named("eclipseClasspath").configure { dependsOn(copyTasks) }
|
||||
|
||||
/* Supply those jars to the ideLibs configuration (after evaluation) */
|
||||
afterEvaluate { dependencies { add("ideLibs", fileTree(ideLibDir) { include("*.jar") }) } }
|
||||
|
||||
val injectIdeLibs =
|
||||
tasks.register("injectIdeLibs") {
|
||||
dependsOn("eclipse") // run after all eclipse files are generated
|
||||
doLast {
|
||||
val cpFile = file(".classpath")
|
||||
if (!cpFile.exists()) return@doLast
|
||||
|
||||
val jars = fileTree(ideLibDir.get()) { include("*.jar") }.files.sortedBy { it.name }
|
||||
if (jars.isEmpty()) return@doLast
|
||||
|
||||
// Parse DOM
|
||||
val dbf = DocumentBuilderFactory.newInstance()
|
||||
val doc = dbf.newDocumentBuilder().parse(cpFile)
|
||||
val root = doc.documentElement
|
||||
|
||||
// Helper to see if an entry already exists
|
||||
fun exists(path: String): Boolean =
|
||||
root.getElementsByTagName("classpathentry").let { list ->
|
||||
(0 until list.length).any { i ->
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue
|
||||
kind == "lib" && p == path
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any entry that points to ide-libs dir (folder or jars) to avoid dupes
|
||||
val toRemove = mutableListOf<org.w3c.dom.Node>()
|
||||
val list = root.getElementsByTagName("classpathentry")
|
||||
val dirPath = ideLibDir.get().asFile.absolutePath
|
||||
for (i in 0 until list.length) {
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue ?: ""
|
||||
if (kind == "lib" && (p == dirPath || p.startsWith("$dirPath/"))) {
|
||||
toRemove += n
|
||||
}
|
||||
}
|
||||
toRemove.forEach { root.removeChild(it) }
|
||||
|
||||
// Append our jar entries LAST
|
||||
jars.forEach { f ->
|
||||
val abs = f.absolutePath
|
||||
if (!exists(abs)) {
|
||||
val entry = doc.createElement("classpathentry")
|
||||
entry.setAttribute("kind", "lib")
|
||||
entry.setAttribute("path", abs)
|
||||
root.appendChild(entry)
|
||||
}
|
||||
}
|
||||
|
||||
// Write back pretty
|
||||
val tf =
|
||||
TransformerFactory.newInstance().newTransformer().apply {
|
||||
setOutputProperty(OutputKeys.INDENT, "yes")
|
||||
setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1")
|
||||
setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no")
|
||||
setOutputProperty(OutputKeys.ENCODING, "UTF-8")
|
||||
}
|
||||
Files.newBufferedWriter(cpFile.toPath()).use { w -> tf.transform(DOMSource(doc), StreamResult(w)) }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("eclipse").configure { finalizedBy(injectIdeLibs) }
|
||||
|
||||
val eclipseModel = extensions.getByType<EclipseModel>()
|
||||
|
||||
fun Project.addResolvableEclipseConfigs() {
|
||||
val jarAttr =
|
||||
objects.named(org.gradle.api.attributes.LibraryElements::class, org.gradle.api.attributes.LibraryElements.JAR)
|
||||
val apiAttr = objects.named(org.gradle.api.attributes.Usage::class, org.gradle.api.attributes.Usage.JAVA_API)
|
||||
|
||||
val compileOnlyRes =
|
||||
configurations.create("eclipseCompileOnly") {
|
||||
extendsFrom(configurations.getByName("compileOnly"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
val compileOnlyApiRes =
|
||||
configurations.create("eclipseCompileOnlyApi") {
|
||||
extendsFrom(configurations.getByName("compileOnlyApi"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
eclipseModel.classpath.plusConfigurations.addAll(listOf(compileOnlyRes, compileOnlyApiRes))
|
||||
}
|
||||
|
||||
addResolvableEclipseConfigs()
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+27
-25
@@ -1,23 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# BuildBattle - Ultimate building competition minigame
|
||||
# Copyright (C) 2022 Plugily Projects - maintained by Tigerpanzer_02 and contributors
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
@@ -59,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -87,7 +85,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -115,7 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -134,10 +133,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -145,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -153,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -202,16 +204,16 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
+94
-92
@@ -1,92 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <https://unlicense.org>
|
||||
Submodule
+1
Submodule libs/MyWorlds added at 659627d65e.
Submodule
+1
Submodule libs/Scoreboard-OG added at 3c2e10c103.
Submodule
+1
Submodule libs/Utilities-OG added at 8b5c86cc9c.
@@ -1,206 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~
|
||||
~ BuildBattle - Ultimate building competition minigame
|
||||
~ Copyright (C) 2021 Plugily Projects - maintained by Tigerpanzer_02, 2Wild4You and contributors
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>buildbattle</artifactId>
|
||||
<version>5.0.15</version>
|
||||
<name>BuildBattle</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plugilyprojects</id>
|
||||
<url>https://maven.plugily.xyz/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plugilyprojects-snapshots</id>
|
||||
<url>https://maven.plugily.xyz/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citizens-repo</id>
|
||||
<url>https://repo.citizensnpcs.co/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>23.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>MiniGamesBox-Classic</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizensapi</artifactId>
|
||||
<version>2.0.26-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ch.ethz.globis.phtree</groupId>
|
||||
<artifactId>phtree</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.21.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.1.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.9.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<configuration>
|
||||
<windowtitle>BuildBattle API docs for v${project.version}</windowtitle>
|
||||
<description>Minecraft building minigame.
|
||||
The goal is to build the best you can! You must compete with other players in this building game.
|
||||
Who will be the best? Have fun using it! Leave a good rating if you really like it.
|
||||
</description>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.hikari</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.database.hikari</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>plugily.projects.minigamesbox</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.minigamesbox</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- External beta versions discord deployer plugin -->
|
||||
<plugin>
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>betty-maven-plugin</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<configuration>
|
||||
<changelogFile>${project.basedir}/CHANGELOG.md</changelogFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- External beta versions discord deployer plugin -->
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>Release</id>
|
||||
<url>https://maven.plugily.xyz/releases</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>Snapshot</id>
|
||||
<url>https://maven.plugily.xyz/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -1,208 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~
|
||||
~ BuildBattle - Ultimate building competition minigame
|
||||
~ Copyright (C) 2021 Plugily Projects - maintained by Tigerpanzer_02, 2Wild4You and contributors
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>buildbattle</artifactId>
|
||||
<version>5.0.13-SNAPSHOT4</version>
|
||||
<name>BuildBattle</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plugilyprojects</id>
|
||||
<url>https://maven.plugily.xyz/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plugilyprojects-snapshots</id>
|
||||
<url>https://maven.plugily.xyz/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citizens-repo</id>
|
||||
<url>http://repo.citizensnpcs.co/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>23.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>MiniGamesBox-Classic</artifactId>
|
||||
<version>1.3.17-SNAPSHOT10</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizensapi</artifactId>
|
||||
<version>2.0.26-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ch.ethz.globis.phtree</groupId>
|
||||
<artifactId>phtree</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.21.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.1.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.9.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<configuration>
|
||||
<windowtitle>Murder Mystery API docs for v${project.version}</windowtitle>
|
||||
<description>Minecraft survival minigame.
|
||||
Be the murderer, innocent or the detective! Don't be killed during the game to win! API
|
||||
documentation for hooking Murder Mystery with your plugin.
|
||||
</description>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.hikari</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.database.hikari</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>plugily.projects.minigamesbox</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.minigamesbox</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- External beta versions discord deployer plugin -->
|
||||
<plugin>
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>betty-maven-plugin</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<configuration>
|
||||
<changelogFile>${project.basedir}/CHANGELOG.md</changelogFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- External beta versions discord deployer plugin -->
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>Release</id>
|
||||
<url>https://maven.plugily.xyz/releases</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>Snapshot</id>
|
||||
<url>https://maven.plugily.xyz/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
rootProject.name = "BuildBattle-OG"
|
||||
|
||||
// Fetch submodule content before the libraries below are wired in as subprojects.
|
||||
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
|
||||
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
|
||||
}
|
||||
|
||||
// Every git submodule under libs/ with a Gradle build becomes :libs:<name>, like Template-OG.
|
||||
file("libs")
|
||||
.listFiles()
|
||||
?.filter { it.isDirectory && !it.name.startsWith(".") && file("${it.path}/build.gradle.kts").exists() }
|
||||
?.forEach { dir ->
|
||||
include(":libs:${dir.name}")
|
||||
project(":libs:${dir.name}").projectDir = dir
|
||||
}
|
||||
@@ -20,131 +20,629 @@
|
||||
|
||||
package plugily.projects.buildbattle;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Filter;
|
||||
import java.util.logging.LogRecord;
|
||||
import nl.skbotnl.chatog.api.ChatOGAPI;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import plugily.projects.buildbattle.arena.ArenaEvents;
|
||||
import plugily.projects.buildbattle.arena.ArenaManager;
|
||||
import plugily.projects.buildbattle.arena.ArenaRegistry;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.PlotBorderManager;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.PlotMenuHandler;
|
||||
import plugily.projects.buildbattle.arena.vote.VoteEvents;
|
||||
import plugily.projects.buildbattle.arena.vote.VoteItems;
|
||||
import plugily.projects.buildbattle.boot.AdditionalValueInitializer;
|
||||
import plugily.projects.buildbattle.boot.MessageInitializer;
|
||||
import plugily.projects.buildbattle.boot.PlaceholderInitializer;
|
||||
import plugily.projects.buildbattle.boot.TrueOGPlaceholderInitializer;
|
||||
import plugily.projects.buildbattle.chat.BuildBattleChatFormatter;
|
||||
import plugily.projects.buildbattle.commands.ForceStartCommand;
|
||||
import plugily.projects.buildbattle.commands.HubCommand;
|
||||
import plugily.projects.buildbattle.commands.HubCommandListener;
|
||||
import plugily.projects.buildbattle.commands.JoinLobbyCommand;
|
||||
import plugily.projects.buildbattle.commands.VoteCommandListener;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.buildbattle.handlers.LanguageMigrator;
|
||||
import plugily.projects.buildbattle.handlers.language.TrueOGLanguageManager;
|
||||
import plugily.projects.buildbattle.handlers.menu.OptionsRegistry;
|
||||
import plugily.projects.buildbattle.handlers.misc.ArenaWorldProvisioner;
|
||||
import plugily.projects.buildbattle.handlers.misc.BlacklistManager;
|
||||
import plugily.projects.buildbattle.handlers.misc.BuilderCreativeManager;
|
||||
import plugily.projects.buildbattle.handlers.misc.GameModeInventoriesGuard;
|
||||
import plugily.projects.buildbattle.handlers.misc.HeadDatabaseManager;
|
||||
import plugily.projects.buildbattle.handlers.misc.MyWorldsManager;
|
||||
import plugily.projects.buildbattle.handlers.misc.PreJoinLocationListener;
|
||||
import plugily.projects.buildbattle.handlers.misc.PreJoinLocationStore;
|
||||
import plugily.projects.buildbattle.handlers.misc.ReconnectToMainWorldListener;
|
||||
import plugily.projects.buildbattle.handlers.misc.ScoreboardOGBridge;
|
||||
import plugily.projects.buildbattle.handlers.misc.VoidChunkGenerator;
|
||||
import plugily.projects.buildbattle.handlers.setup.SetupCategoryManager;
|
||||
import plugily.projects.buildbattle.handlers.stats.BuildBattleScores;
|
||||
import plugily.projects.buildbattle.handlers.themes.ThemeManager;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.api.handlers.language.ILanguageManager;
|
||||
import plugily.projects.minigamesbox.classic.PluginMain;
|
||||
import plugily.projects.minigamesbox.classic.handlers.setup.SetupInventory;
|
||||
import plugily.projects.minigamesbox.classic.handlers.setup.categories.PluginSetupCategoryManager;
|
||||
import plugily.projects.minigamesbox.classic.utils.services.metrics.Metrics;
|
||||
|
||||
/**
|
||||
* Created by Tom on 17/08/2015.
|
||||
* Updated by Tigerpanzer_02 on 03.12.2021
|
||||
* Created by Tom on 17/08/2015. Updated by Tigerpanzer_02 on 03.12.2021
|
||||
*/
|
||||
public class Main extends PluginMain {
|
||||
|
||||
private VoteItems voteItems;
|
||||
private ThemeManager themeManager;
|
||||
private BlacklistManager blacklistManager;
|
||||
private OptionsRegistry optionsRegistry;
|
||||
private ArenaRegistry arenaRegistry;
|
||||
private ArenaManager arenaManager;
|
||||
private ArgumentsRegistry argumentsRegistry;
|
||||
private PlotMenuHandler plotMenuHandler;
|
||||
private VoteItems voteItems;
|
||||
private HeadDatabaseManager headDatabaseManager;
|
||||
private ThemeManager themeManager;
|
||||
private BlacklistManager blacklistManager;
|
||||
private OptionsRegistry optionsRegistry;
|
||||
private ArenaRegistry arenaRegistry;
|
||||
private ArenaManager arenaManager;
|
||||
private ArgumentsRegistry argumentsRegistry;
|
||||
private PlotMenuHandler plotMenuHandler;
|
||||
private MyWorldsManager myWorldsManager;
|
||||
private ArenaWorldProvisioner arenaWorldProvisioner;
|
||||
private PreJoinLocationStore preJoinLocationStore;
|
||||
private BuilderCreativeManager builderCreativeManager;
|
||||
private PlotBorderManager plotBorderManager;
|
||||
private GameModeInventoriesGuard gmiGuard;
|
||||
private ILanguageManager languageManager;
|
||||
private BuildBattleScores buildBattleScores;
|
||||
|
||||
@TestOnly
|
||||
public Main() {
|
||||
|
||||
@TestOnly
|
||||
public Main() {
|
||||
super();
|
||||
}
|
||||
super();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
long start = System.currentTimeMillis();
|
||||
MessageInitializer messageInitializer = new MessageInitializer(this);
|
||||
super.onEnable();
|
||||
getDebugger().debug("[System] [Plugin] Initialization start");
|
||||
arenaRegistry = new ArenaRegistry(this);
|
||||
new PlaceholderInitializer(this);
|
||||
messageInitializer.registerMessages();
|
||||
new AdditionalValueInitializer(this);
|
||||
initializePluginClasses();
|
||||
getDebugger().debug("Full {0} plugin enabled", getName());
|
||||
getDebugger().debug("[System] [Plugin] Initialization finished took {0}ms", System.currentTimeMillis() - start);
|
||||
}
|
||||
}
|
||||
|
||||
public void initializePluginClasses() {
|
||||
addFileName("themes");
|
||||
addFileName("vote_items");
|
||||
blacklistManager = new BlacklistManager(this);
|
||||
themeManager = new ThemeManager(this);
|
||||
BaseArena.init(this);
|
||||
new ArenaEvents(this);
|
||||
arenaManager = new ArenaManager(this);
|
||||
arenaRegistry.registerArenas();
|
||||
getSignManager().loadSigns();
|
||||
getSignManager().updateSigns();
|
||||
argumentsRegistry = new ArgumentsRegistry(this);
|
||||
voteItems = new VoteItems(this);
|
||||
new VoteEvents(this);
|
||||
plotMenuHandler = new PlotMenuHandler(this);
|
||||
optionsRegistry = new OptionsRegistry(this);
|
||||
optionsRegistry.registerOptions();
|
||||
addPluginMetrics();
|
||||
}
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
private void addPluginMetrics() {
|
||||
getMetrics().addCustomChart(new Metrics.SimplePie("hooked_addons", () -> {
|
||||
if(getServer().getPluginManager().getPlugin("BuildBattle-Extras") != null) {
|
||||
return "Extras";
|
||||
}
|
||||
return "None";
|
||||
}));
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
installDebugNoiseFilter();
|
||||
// Write bundled powerups.yml to the data folder so the shaded
|
||||
// MiniGamesBox-Classic reader finds it instead of logging
|
||||
// "File powerups.yml does not exist!".
|
||||
if (!new java.io.File(getDataFolder(), "powerups.yml").exists()) {
|
||||
|
||||
saveResource("powerups.yml", false);
|
||||
|
||||
public VoteItems getVoteItems() {
|
||||
return voteItems;
|
||||
}
|
||||
}
|
||||
|
||||
public ThemeManager getThemeManager() {
|
||||
return themeManager;
|
||||
}
|
||||
new LanguageMigrator(this);
|
||||
MessageInitializer messageInitializer = new MessageInitializer(this);
|
||||
// Must precede super.onEnable(): SignManager caches Signs.Lines and the
|
||||
// game-state names into
|
||||
// final fields while the base plugin enables, and never re-reads them (not even
|
||||
// on /bba reload).
|
||||
installTrueOGColorizer();
|
||||
super.onEnable();
|
||||
getDebugger().debug("[System] [Plugin] Initialization start");
|
||||
arenaRegistry = new ArenaRegistry(this);
|
||||
myWorldsManager = new MyWorldsManager(this);
|
||||
if (!myWorldsManager.initialize()) {
|
||||
|
||||
public BlacklistManager getBlacklistManager() {
|
||||
return blacklistManager;
|
||||
}
|
||||
// super.onEnable() already ran, so a bare return would leave the plugin marked
|
||||
// enabled with no arenas, commands or listeners registered. Fail fast instead.
|
||||
// Note this runs onDisable() re-entrantly, inside onEnable(). That is safe
|
||||
// today only
|
||||
// because registerArenas() has not run yet, so onDisable()'s loop over the
|
||||
// arena
|
||||
// registry is empty and never dereferences the still-null arenaManager. If
|
||||
// arenas ever
|
||||
// become populated earlier, move this check above super.onEnable() instead.
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
|
||||
public OptionsRegistry getOptionsRegistry() {
|
||||
return optionsRegistry;
|
||||
}
|
||||
}
|
||||
|
||||
public PlotMenuHandler getPlotMenuHandler() {
|
||||
return plotMenuHandler;
|
||||
}
|
||||
preJoinLocationStore = new PreJoinLocationStore(this);
|
||||
new PlaceholderInitializer(this);
|
||||
messageInitializer.registerMessages();
|
||||
new AdditionalValueInitializer(this);
|
||||
initializePluginClasses();
|
||||
// After AdditionalValueInitializer, which registers the POINTS_TOTAL statistic
|
||||
// this reads.
|
||||
buildBattleScores = new BuildBattleScores(this);
|
||||
if (getServer().getPluginManager().getPlugin("Utilities-OG") != null) {
|
||||
|
||||
new TrueOGPlaceholderInitializer(buildBattleScores);
|
||||
|
||||
@Override
|
||||
public ArenaRegistry getArenaRegistry() {
|
||||
return arenaRegistry;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArenaManager getArenaManager() {
|
||||
return arenaManager;
|
||||
}
|
||||
getDebugger().debug("Full {0} plugin enabled", getName());
|
||||
getDebugger().debug("[System] [Plugin] Initialization finished took {0}ms", System.currentTimeMillis() - start);
|
||||
|
||||
@Override
|
||||
public ArgumentsRegistry getArgumentsRegistry() {
|
||||
return argumentsRegistry;
|
||||
}
|
||||
}
|
||||
|
||||
// Route language values through TrueOG's colorizer when Utilities-OG is
|
||||
// installed. It is a
|
||||
// compileOnly dependency, so only build the decorator once its classes are
|
||||
// known present.
|
||||
// Every plugin is loaded before any is enabled, so this check is already valid
|
||||
// pre-onEnable.
|
||||
private void installTrueOGColorizer() {
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("Utilities-OG") == null) {
|
||||
|
||||
getLogger().info("Utilities-OG is not installed, so messages keep their default formatting.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Delegate resolved lazily: PluginMain has not built its LanguageManager yet at
|
||||
// this point.
|
||||
languageManager = new TrueOGLanguageManager(super::getLanguageManager);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>
|
||||
* Returns the colorizing decorator once {@link #installTrueOGColorizer()} has
|
||||
* run, which is before {@code super.onEnable()} so that values the base plugin
|
||||
* caches at startup (join sign lines, game-state names) are already colorized.
|
||||
*/
|
||||
@Override
|
||||
public ILanguageManager getLanguageManager() {
|
||||
|
||||
return languageManager != null ? languageManager : super.getLanguageManager();
|
||||
|
||||
}
|
||||
|
||||
// Suppress known non-actionable startup noise from shaded MiniGamesBox-Classic.
|
||||
private void installDebugNoiseFilter() {
|
||||
|
||||
java.util.logging.Logger jul = java.util.logging.Logger.getLogger(getName());
|
||||
Filter previous = jul.getFilter();
|
||||
jul.setFilter(new Filter() {
|
||||
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
|
||||
String msg = record.getMessage();
|
||||
// Raw locale records contain color codes and concatenated values,
|
||||
// so match them by substring rather than prefix.
|
||||
if (msg != null && msg.contains("Loaded locale"))
|
||||
return false;
|
||||
return previous == null || previous.isLoggable(record);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void initializePluginClasses() {
|
||||
|
||||
addFileName("themes");
|
||||
addFileName("vote_items");
|
||||
blacklistManager = new BlacklistManager(this);
|
||||
headDatabaseManager = new HeadDatabaseManager(this);
|
||||
themeManager = new ThemeManager(this);
|
||||
BaseArena.init(this);
|
||||
new ArenaEvents(this);
|
||||
arenaManager = new ArenaManager(this);
|
||||
gmiGuard = new GameModeInventoriesGuard(this, player -> isArenaWorld(player.getWorld()));
|
||||
builderCreativeManager = new BuilderCreativeManager(this);
|
||||
plotBorderManager = new PlotBorderManager(this);
|
||||
// Load worlds first, or MiniGamesBox generates vanilla ones on register.
|
||||
arenaWorldProvisioner = new ArenaWorldProvisioner(this);
|
||||
arenaWorldProvisioner.provisionArenaWorlds();
|
||||
arenaRegistry.registerArenas();
|
||||
// /reload leaves players standing in arena worlds with no suspension.
|
||||
gmiGuard.sweepOnlinePlayers();
|
||||
new ReconnectToMainWorldListener(this);
|
||||
new PreJoinLocationListener(this);
|
||||
PluginCommand hubCommand = getCommand("hub");
|
||||
HubCommand hub = new HubCommand(this);
|
||||
if (hubCommand != null) {
|
||||
|
||||
hubCommand.setExecutor(hub);
|
||||
|
||||
} else {
|
||||
|
||||
getLogger().warning("The 'hub' command is missing from plugin.yml, so /hub will not work.");
|
||||
|
||||
}
|
||||
|
||||
registerCommand("bbjoin", new JoinLobbyCommand(this));
|
||||
registerCommand("bbforcestart", new ForceStartCommand(this));
|
||||
// Claims /v and /vote inside BuildBattle worlds before VotingPlugin sees them.
|
||||
new VoteCommandListener(this);
|
||||
// Claims /hub, /lobby and /spawn inside BuildBattle worlds the same way, so
|
||||
// another minigame's /hub or Spawn-OG's /spawn never handles an arena player.
|
||||
new HubCommandListener(this, hub);
|
||||
ensureCommandWhitelist();
|
||||
registerChatFormatter();
|
||||
|
||||
myWorldsManager.synchronizeArenaWorldInventories();
|
||||
getSignManager().loadSigns();
|
||||
getSignManager().updateSigns();
|
||||
argumentsRegistry = new ArgumentsRegistry(this);
|
||||
voteItems = new VoteItems(this);
|
||||
new VoteEvents(this);
|
||||
plotMenuHandler = new PlotMenuHandler(this);
|
||||
optionsRegistry = new OptionsRegistry(this);
|
||||
optionsRegistry.registerOptions();
|
||||
|
||||
}
|
||||
|
||||
public VoteItems getVoteItems() {
|
||||
|
||||
return voteItems;
|
||||
|
||||
}
|
||||
|
||||
public HeadDatabaseManager getHeadDatabaseManager() {
|
||||
|
||||
return headDatabaseManager;
|
||||
|
||||
}
|
||||
|
||||
public ThemeManager getThemeManager() {
|
||||
|
||||
return themeManager;
|
||||
|
||||
}
|
||||
|
||||
public BlacklistManager getBlacklistManager() {
|
||||
|
||||
return blacklistManager;
|
||||
|
||||
}
|
||||
|
||||
public OptionsRegistry getOptionsRegistry() {
|
||||
|
||||
return optionsRegistry;
|
||||
|
||||
}
|
||||
|
||||
public PlotMenuHandler getPlotMenuHandler() {
|
||||
|
||||
return plotMenuHandler;
|
||||
|
||||
}
|
||||
|
||||
public BuildBattleScores getBuildBattleScores() {
|
||||
|
||||
return buildBattleScores;
|
||||
|
||||
}
|
||||
|
||||
public ArenaWorldProvisioner getArenaWorldProvisioner() {
|
||||
|
||||
return arenaWorldProvisioner;
|
||||
|
||||
}
|
||||
|
||||
// Backs the BuildBattle-OG:void id pinned onto arena worlds in MyWorlds.
|
||||
@Override
|
||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||
|
||||
return new VoidChunkGenerator();
|
||||
|
||||
}
|
||||
|
||||
public MyWorldsManager getMyWorldsManager() {
|
||||
|
||||
return myWorldsManager;
|
||||
|
||||
}
|
||||
|
||||
public BuilderCreativeManager getBuilderCreativeManager() {
|
||||
|
||||
return builderCreativeManager;
|
||||
|
||||
}
|
||||
|
||||
public PlotBorderManager getPlotBorderManager() {
|
||||
|
||||
return plotBorderManager;
|
||||
|
||||
}
|
||||
|
||||
public GameModeInventoriesGuard getGmiGuard() {
|
||||
|
||||
return gmiGuard;
|
||||
|
||||
}
|
||||
|
||||
// BuildBattle territory: every registered arena's lobby and game worlds plus
|
||||
// the plot worlds arenas.yml names, which MiniGamesBox does not list.
|
||||
public boolean isArenaWorld(World world) {
|
||||
|
||||
if (world == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (arenaRegistry != null) {
|
||||
|
||||
for (World arenaWorld : arenaRegistry.getArenaWorlds()) {
|
||||
|
||||
if (arenaWorld != null && arenaWorld.getName().equals(world.getName())) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (World arenaWorld : arenaRegistry.getArenaIngameWorlds()) {
|
||||
|
||||
if (arenaWorld != null && arenaWorld.getName().equals(world.getName())) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return myWorldsManager != null && myWorldsManager.isConfiguredArenaWorld(world.getName());
|
||||
|
||||
}
|
||||
|
||||
// Chat-OG routes a world to a game by the letter prefix of its name (BB1-hub
|
||||
// and
|
||||
// BB1-map both belong to key "BB"), so the formatter is registered once per
|
||||
// distinct prefix across the configured arena worlds.
|
||||
private void registerChatFormatter() {
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("Chat-OG") == null) {
|
||||
|
||||
getLogger().info("Chat-OG is not installed, so BuildBattle chat keeps its default formatting.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Set<String> keys = new LinkedHashSet<>();
|
||||
for (IPluginArena arena : getArenaRegistry().getArenas()) {
|
||||
|
||||
addGameKey(keys, arena.getLobbyLocation());
|
||||
addGameKey(keys, arena.getStartLocation());
|
||||
|
||||
}
|
||||
|
||||
if (keys.isEmpty()) {
|
||||
|
||||
getLogger().warning("No arena world follows the <prefix><number>-<name> convention, so no BuildBattle "
|
||||
+ "chat formatter was registered.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BuildBattleChatFormatter formatter = new BuildBattleChatFormatter(this);
|
||||
for (String key : keys) {
|
||||
|
||||
if (!ChatOGAPI.setFormatter(key, formatter)) {
|
||||
|
||||
getLogger().warning("Chat-OG was not ready, so no chat formatter was registered for " + key + ".");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Mirrors Chat-OG's own parse: letters, then digits, then '-'. Anything else is
|
||||
// not part of a multi world game and contributes no key.
|
||||
private static void addGameKey(Set<String> keys, Location location) {
|
||||
|
||||
if (location == null || location.getWorld() == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
String worldName = location.getWorld().getName();
|
||||
int index = 0;
|
||||
while (index < worldName.length() && Character.isLetter(worldName.charAt(index))) {
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
int digitStart = index;
|
||||
while (index < worldName.length() && Character.isDigit(worldName.charAt(index))) {
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
if (index == digitStart || index >= worldName.length() || worldName.charAt(index) != '-') {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
keys.add(worldName.substring(0, digitStart));
|
||||
|
||||
}
|
||||
|
||||
// MiniGamesBox blocks every command an arena member runs that is not on
|
||||
// Commands.Whitelist, and it does not check whether the event was already
|
||||
// cancelled, so the commands HubCommandListener claims have to be listed or
|
||||
// the player gets a "blocked" message after being sent home. Older configs
|
||||
// predate /lobby and /spawn, so the list is topped up here.
|
||||
private void ensureCommandWhitelist() {
|
||||
|
||||
final java.util.List<String> whitelist = new java.util.ArrayList<>(
|
||||
getConfig().getStringList("Commands.Whitelist"));
|
||||
boolean changed = false;
|
||||
for (String required : new String[] { "hub", "lobby", "spawn", "bbjoin", "bbforcestart" }) {
|
||||
|
||||
if (whitelist.stream().noneMatch(required::equalsIgnoreCase)) {
|
||||
|
||||
whitelist.add(required);
|
||||
changed = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
||||
getConfig().set("Commands.Whitelist", whitelist);
|
||||
saveConfig();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void registerCommand(String name, CommandExecutor executor) {
|
||||
|
||||
PluginCommand command = getCommand(name);
|
||||
if (command == null) {
|
||||
|
||||
getLogger()
|
||||
.warning("The '" + name + "' command is missing from plugin.yml, so /" + name + " will not work.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
command.setExecutor(executor);
|
||||
if (executor instanceof TabCompleter tabCompleter) {
|
||||
|
||||
command.setTabCompleter(tabCompleter);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void savePreJoinLocation(Player player) {
|
||||
|
||||
savePreJoinLocation(player.getUniqueId(), player.getLocation());
|
||||
|
||||
}
|
||||
|
||||
public void savePreJoinLocation(UUID playerId, Location location) {
|
||||
|
||||
if (preJoinLocationStore != null && location != null && location.getWorld() != null) {
|
||||
|
||||
preJoinLocationStore.put(playerId, location);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean hasPreJoinLocation(UUID playerId) {
|
||||
|
||||
return preJoinLocationStore != null && preJoinLocationStore.getWorldName(playerId) != null;
|
||||
|
||||
}
|
||||
|
||||
public void removePreJoinLocation(UUID playerId) {
|
||||
|
||||
if (preJoinLocationStore != null) {
|
||||
|
||||
preJoinLocationStore.remove(playerId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Location getAndRemovePreJoinLocation(UUID playerId) {
|
||||
|
||||
if (preJoinLocationStore == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
// Pulls the stored world back in through MyWorlds when it is unloaded.
|
||||
Location location = preJoinLocationStore.getOrLoadWorld(playerId);
|
||||
preJoinLocationStore.remove(playerId);
|
||||
return location;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
// Order matters on /reload, where players stay online. super.onDisable() stops
|
||||
// every arena, which restores inventories through MiniGamesBox; lifting the
|
||||
// GameModeInventories suspension before that lets GMI swap mid-restore and file
|
||||
// arena state as the player's real survival inventory. The location store is
|
||||
// flushed last so anything teardown changes still reaches disk.
|
||||
super.onDisable();
|
||||
|
||||
// Arena stop already released every claimed sidebar; this catches a stray one.
|
||||
ScoreboardOGBridge.releaseAll();
|
||||
|
||||
if (builderCreativeManager != null) {
|
||||
|
||||
builderCreativeManager.revokeAll();
|
||||
|
||||
}
|
||||
|
||||
if (plotBorderManager != null) {
|
||||
|
||||
plotBorderManager.clearAll();
|
||||
|
||||
}
|
||||
|
||||
if (gmiGuard != null) {
|
||||
|
||||
gmiGuard.releaseAll();
|
||||
|
||||
}
|
||||
|
||||
if (preJoinLocationStore != null) {
|
||||
|
||||
preJoinLocationStore.shutdown();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArenaRegistry getArenaRegistry() {
|
||||
|
||||
return arenaRegistry;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArenaManager getArenaManager() {
|
||||
|
||||
return arenaManager;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArgumentsRegistry getArgumentsRegistry() {
|
||||
|
||||
return argumentsRegistry;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginSetupCategoryManager getSetupCategoryManager(SetupInventory setupInventory) {
|
||||
|
||||
return new SetupCategoryManager(setupInventory);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginSetupCategoryManager getSetupCategoryManager(SetupInventory setupInventory) {
|
||||
return new SetupCategoryManager(setupInventory);
|
||||
}
|
||||
}
|
||||
+28
-20
@@ -22,36 +22,44 @@ package plugily.projects.buildbattle.api.event.guess;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.buildbattle.handlers.themes.BBTheme;
|
||||
import plugily.projects.buildbattle.handlers.themes.GuessTheme;
|
||||
import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* @since 5.0.0
|
||||
* <p>
|
||||
* Called when player guess the theme right
|
||||
* <p>
|
||||
* Called when player guess the theme right
|
||||
*/
|
||||
public class PlayerThemeGuessEvent extends PlugilyEvent {
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final BBTheme theme;
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final GuessTheme theme;
|
||||
|
||||
public PlayerThemeGuessEvent(GuessArena eventArena, BBTheme theme) {
|
||||
super(eventArena);
|
||||
this.theme = theme;
|
||||
}
|
||||
public PlayerThemeGuessEvent(GuessArena eventArena, GuessTheme theme) {
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
super(eventArena);
|
||||
this.theme = theme;
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
|
||||
return HANDLERS;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
||||
return HANDLERS;
|
||||
|
||||
}
|
||||
|
||||
public GuessTheme getTheme() {
|
||||
|
||||
return theme;
|
||||
|
||||
}
|
||||
|
||||
public BBTheme getTheme() {
|
||||
return theme;
|
||||
}
|
||||
}
|
||||
+46
-31
@@ -29,42 +29,57 @@ import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
|
||||
public class PlotPlayerChooseEvent extends PlugilyEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final Plot plot;
|
||||
private boolean isCancelled;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final Plot plot;
|
||||
private boolean isCancelled;
|
||||
|
||||
public PlotPlayerChooseEvent(Player player, Plot plot, BaseArena baseArena) {
|
||||
super(baseArena);
|
||||
this.player = player;
|
||||
this.plot = plot;
|
||||
this.isCancelled = false;
|
||||
}
|
||||
public PlotPlayerChooseEvent(Player player, Plot plot, BaseArena baseArena) {
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
super(baseArena);
|
||||
this.player = player;
|
||||
this.plot = plot;
|
||||
this.isCancelled = false;
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
public Plot getPlot() {
|
||||
return plot;
|
||||
}
|
||||
public static HandlerList getHandlerList() {
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.isCancelled;
|
||||
}
|
||||
return handlers;
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.isCancelled = cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
|
||||
return player;
|
||||
|
||||
}
|
||||
|
||||
public Plot getPlot() {
|
||||
|
||||
return plot;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
|
||||
return this.isCancelled;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
|
||||
this.isCancelled = cancelled;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
||||
return handlers;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
+27
-18
@@ -28,29 +28,38 @@ import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
/**
|
||||
* @author Plajer
|
||||
* @since 4.0.0-pre-12
|
||||
* <p>
|
||||
* Called when player receive plot in game after the game starts
|
||||
* <p>
|
||||
* Called when player receive plot in game after the game starts
|
||||
*/
|
||||
public class PlotPlayerReceiveEvent extends PlugilyEvent {
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final Plot plot;
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final Plot plot;
|
||||
|
||||
public PlotPlayerReceiveEvent(BaseArena eventArena, Plot plot) {
|
||||
super(eventArena);
|
||||
this.plot = plot;
|
||||
}
|
||||
public PlotPlayerReceiveEvent(BaseArena eventArena, Plot plot) {
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
super(eventArena);
|
||||
this.plot = plot;
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
|
||||
return HANDLERS;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
||||
return HANDLERS;
|
||||
|
||||
}
|
||||
|
||||
public Plot getPlot() {
|
||||
|
||||
return plot;
|
||||
|
||||
}
|
||||
|
||||
public Plot getPlot() {
|
||||
return plot;
|
||||
}
|
||||
}
|
||||
@@ -28,30 +28,38 @@ import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
/**
|
||||
* @author Plajer
|
||||
* @since 4.0.0-pre-12
|
||||
* <p>
|
||||
* Called when plot is being reset
|
||||
* <p>
|
||||
* Called when plot is being reset
|
||||
*/
|
||||
public class PlotResetEvent extends PlugilyEvent {
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final Plot plot;
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final Plot plot;
|
||||
|
||||
public PlotResetEvent(BaseArena eventArena, Plot plot) {
|
||||
super(eventArena);
|
||||
this.plot = plot;
|
||||
}
|
||||
public PlotResetEvent(BaseArena eventArena, Plot plot) {
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
super(eventArena);
|
||||
this.plot = plot;
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
}
|
||||
|
||||
public Plot getPlot() {
|
||||
return plot;
|
||||
}
|
||||
public static HandlerList getHandlerList() {
|
||||
|
||||
return HANDLERS;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
||||
return HANDLERS;
|
||||
|
||||
}
|
||||
|
||||
public Plot getPlot() {
|
||||
|
||||
return plot;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -20,6 +20,7 @@
|
||||
|
||||
package plugily.projects.buildbattle.arena;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
@@ -27,80 +28,233 @@ import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.api.user.IUser;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArenaManager;
|
||||
import plugily.projects.minigamesbox.classic.user.User;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>Created at 13.05.2018
|
||||
* <p>
|
||||
* Created at 13.05.2018
|
||||
*/
|
||||
public class ArenaManager extends PluginArenaManager {
|
||||
|
||||
private final Main plugin;
|
||||
private final Main plugin;
|
||||
|
||||
public ArenaManager(Main plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public ArenaManager(Main plugin) {
|
||||
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
|
||||
@Override
|
||||
public void additionalPartyJoin(Player player, IPluginArena arena, Player partyLeader) {
|
||||
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Plot> plots = pluginArena.getPlotManager().getPlots();
|
||||
Plot partyPlot = plots.get(plots.size() == 1 ? 0 : plugin.getRandom().nextInt(plots.size()));
|
||||
@Override
|
||||
public void joinAttempt(@NotNull Player player, @NotNull IPluginArena arena) {
|
||||
|
||||
if(arena.getPlayersLeft().contains(partyLeader)) {
|
||||
Plot partyLeaderPlot = pluginArena.getPlotManager().getPlot(partyLeader);
|
||||
if(partyLeaderPlot != null) {
|
||||
partyPlot = partyLeaderPlot;
|
||||
}
|
||||
}
|
||||
if(partyPlot != null) {
|
||||
partyPlot.addMember(player, pluginArena, false);
|
||||
}
|
||||
if (!plugin.getArenaRegistry().isInArena(player)) {
|
||||
|
||||
}
|
||||
plugin.savePreJoinLocation(player);
|
||||
|
||||
@Override
|
||||
public void leaveAttempt(@NotNull Player player, @NotNull IPluginArena arena) {
|
||||
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return;
|
||||
}
|
||||
super.leaveAttempt(player, arena);
|
||||
IUser user = plugin.getUserManager().getUser(player);
|
||||
user.setStatistic("LOCAL_POINTS", 0);
|
||||
user.setStatistic("LOCAL_POINTS_GTB", 0);
|
||||
Plot plot = pluginArena.getPlotManager().getPlot(player);
|
||||
if(plot == null) {
|
||||
return;
|
||||
}
|
||||
plot.getMembers().remove(player);
|
||||
if(arena instanceof BuildArena) {
|
||||
if(plot.getMembers().isEmpty()) {
|
||||
((BuildArena) arena).getQueue().remove(plot);
|
||||
}
|
||||
}
|
||||
if(arena instanceof GuessArena) {
|
||||
GuessArena guessArena = (GuessArena) pluginArena;
|
||||
((GuessArena) arena).getWhoGuessed().remove(player);
|
||||
if(guessArena.getCurrentBuilders().contains(player)) {
|
||||
if(plot.getMembers().isEmpty()) {
|
||||
if(arena.getArenaState() == IArenaState.IN_GAME) {
|
||||
//ToDo message force skipped
|
||||
pluginArena.setTimer(plugin.getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Round-Delay"), true);
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suspend GameModeInventories swapping before MiniGamesBox takes over
|
||||
// this player's inventory and gamemode. Lifted again on arena leave, or
|
||||
// immediately below when the join is refused.
|
||||
plugin.getBuilderCreativeManager().enterArena(player);
|
||||
super.joinAttempt(player, arena);
|
||||
if (!plugin.getArenaRegistry().isInArena(player)) {
|
||||
|
||||
plugin.getBuilderCreativeManager().revoke(player);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void additionalPartyJoin(Player player, IPluginArena arena, Player partyLeader) {
|
||||
|
||||
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
|
||||
if (pluginArena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
List<Plot> plots = pluginArena.getPlotManager().getPlots();
|
||||
Plot partyPlot = plots.get(plots.size() == 1 ? 0 : plugin.getRandom().nextInt(plots.size()));
|
||||
|
||||
if (arena.getPlayersLeft().contains(partyLeader)) {
|
||||
|
||||
Plot partyLeaderPlot = pluginArena.getPlotManager().getPlot(partyLeader);
|
||||
if (partyLeaderPlot != null) {
|
||||
|
||||
partyPlot = partyLeaderPlot;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (partyPlot != null) {
|
||||
|
||||
partyPlot.addMember(player, pluginArena, false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leaveAttempt(@NotNull Player player, @NotNull IPluginArena arena) {
|
||||
|
||||
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
|
||||
if (pluginArena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
super.leaveAttempt(player, arena);
|
||||
// After the MiniGamesBox inventory restore, so GameModeInventories-OG
|
||||
// cannot swap inventories mid-restore.
|
||||
plugin.getBuilderCreativeManager().revoke(player);
|
||||
IUser user = plugin.getUserManager().getUser(player);
|
||||
user.setStatistic("LOCAL_POINTS", 0);
|
||||
user.setStatistic("LOCAL_POINTS_GTB", 0);
|
||||
Plot plot = pluginArena.getPlotManager().getPlot(player);
|
||||
if (plot == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plot.getMembers().remove(player);
|
||||
if (arena instanceof BuildArena) {
|
||||
|
||||
if (plot.getMembers().isEmpty()) {
|
||||
|
||||
((BuildArena) arena).getQueue().remove(plot);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (arena instanceof GuessArena) {
|
||||
|
||||
GuessArena guessArena = (GuessArena) pluginArena;
|
||||
((GuessArena) arena).getWhoGuessed().remove(player);
|
||||
if (guessArena.getCurrentBuilders().contains(player)) {
|
||||
|
||||
if (plot.getMembers().isEmpty()) {
|
||||
|
||||
if (arena.getArenaState() == IArenaState.IN_GAME) {
|
||||
|
||||
// ToDo message force skipped
|
||||
pluginArena.setTimer(
|
||||
plugin.getConfig().getInt(
|
||||
"Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Round-Delay"),
|
||||
true);
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void hubLeaveAttempt(@NotNull Player player, @NotNull BaseArena pluginArena) {
|
||||
|
||||
plugin.getDebugger().debug("[{0}] Hub leave attempt for {1}", pluginArena.getId(), player.getName());
|
||||
|
||||
IUser user = plugin.getUserManager().getUser(player);
|
||||
if (user != null) {
|
||||
|
||||
plugin.getUserManager().saveAllStatistic(user);
|
||||
user.setStatistic("LOCAL_POINTS", 0);
|
||||
user.setStatistic("LOCAL_POINTS_GTB", 0);
|
||||
user.setSpectator(false);
|
||||
user.setPermanentSpectator(false);
|
||||
pluginArena.getScoreboardManager().removeScoreboard(user);
|
||||
|
||||
}
|
||||
|
||||
restoreVisibility(player);
|
||||
player.closeInventory();
|
||||
pluginArena.removeSpectatorPlayer(player);
|
||||
pluginArena.getBossbarManager().doBarAction(IPluginArena.IBarAction.REMOVE, player);
|
||||
pluginArena.getPlayers().remove(player);
|
||||
plugin.getActionBarManager().clearActionBarsFromPlayer(player);
|
||||
removePlotMembership(player, pluginArena);
|
||||
|
||||
if (shouldStopAfterHubLeave(pluginArena)) {
|
||||
|
||||
stopGame(true, pluginArena);
|
||||
|
||||
}
|
||||
|
||||
plugin.getSignManager().updateSigns();
|
||||
plugin.getDebugger().debug("[{0}] Hub leave complete for {1}", pluginArena.getId(), player.getName());
|
||||
|
||||
}
|
||||
|
||||
private void restoreVisibility(Player player) {
|
||||
|
||||
for (Player online : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
VersionUtils.showPlayer(plugin, player, online);
|
||||
if (plugin.getArenaRegistry().getArena(online) == null) {
|
||||
|
||||
VersionUtils.showPlayer(plugin, online, player);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void removePlotMembership(Player player, BaseArena pluginArena) {
|
||||
|
||||
Plot plot = pluginArena.getPlotManager().getPlot(player);
|
||||
pluginArena.getPlotList().remove(player);
|
||||
if (plot == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plot.removeMember(player);
|
||||
if (pluginArena instanceof BuildArena && plot.getMembers().isEmpty()) {
|
||||
|
||||
((BuildArena) pluginArena).getQueue().remove(plot);
|
||||
|
||||
}
|
||||
|
||||
if (pluginArena instanceof GuessArena) {
|
||||
|
||||
GuessArena guessArena = (GuessArena) pluginArena;
|
||||
guessArena.getWhoGuessed().remove(player);
|
||||
boolean currentBuilder = guessArena.getCurrentBuilders().remove(player);
|
||||
if (currentBuilder && plot.getMembers().isEmpty() && pluginArena.getArenaState() == IArenaState.IN_GAME) {
|
||||
|
||||
pluginArena.setTimer(plugin.getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Round-Delay"), true);
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldStopAfterHubLeave(BaseArena pluginArena) {
|
||||
|
||||
IArenaState state = pluginArena.getArenaState();
|
||||
return pluginArena.getPlayers().isEmpty() && state != IArenaState.FULL_GAME
|
||||
&& state != IArenaState.WAITING_FOR_PLAYERS && state != IArenaState.STARTING;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.buildbattle.handlers.misc.ArenaWorldProvisioner;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArenaRegistry;
|
||||
@@ -47,139 +48,274 @@ import java.util.Locale;
|
||||
*/
|
||||
public class ArenaRegistry extends PluginArenaRegistry {
|
||||
|
||||
private final Main plugin;
|
||||
private final Main plugin;
|
||||
|
||||
public ArenaRegistry(Main plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public ArenaRegistry(Main plugin) {
|
||||
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
|
||||
@Override
|
||||
public PluginArena getNewArena(String id) {
|
||||
switch(ConfigUtils.getConfig(plugin, "arenas").getString("instances." + id + ".gametype", "classic").toLowerCase(Locale.ENGLISH)) {
|
||||
case "gtb":
|
||||
case "guessthebuild":
|
||||
case "guess_the_build":
|
||||
return new GuessArena(id);
|
||||
case "classic":
|
||||
case "solo":
|
||||
case "team":
|
||||
default:
|
||||
return new BuildArena(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean additionalValidatorChecks(ConfigurationSection section, PluginArena arena, String id) {
|
||||
if(!super.additionalValidatorChecks(section, arena, id)) return false;
|
||||
|
||||
boolean isBuildArena = arena instanceof BuildArena;
|
||||
boolean isGuessArena = arena instanceof GuessArena;
|
||||
|
||||
if(isBuildArena) {
|
||||
int plotMemberSize = section.getInt(id + ".plotmembersize", 0);
|
||||
|
||||
// Member size can not be less than 1
|
||||
if(plotMemberSize < 1) {
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey().value("INVALID PLOT MEMBER SIZE!").arena(arena).build());
|
||||
return false;
|
||||
}
|
||||
|
||||
arena.setArenaOption("PLOT_MEMBER_SIZE", plotMemberSize);
|
||||
int minPlayers = arena.getArenaOption("MINIMUM_PLAYERS");
|
||||
if(minPlayers <= plotMemberSize) {
|
||||
arena.setArenaOption("MINIMUM_PLAYERS", plotMemberSize + 1);
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey().value("MIN PLAYERS NEEDS TO BE 1 MORE THAN PLOT_MEMBER_SIZE, AUTOMATICALLY ADJUSTED. CONFIRM BY CHECKING ARENA SETUP!").arena(arena).build());
|
||||
}
|
||||
|
||||
((BuildArena) arena).setTypeByPlotMembers();
|
||||
} else {
|
||||
//todo gtb team mode, because why not!
|
||||
arena.setArenaOption("PLOT_MEMBER_SIZE", 1);
|
||||
}
|
||||
|
||||
ConfigurationSection plotSection = section.getConfigurationSection(id + ".plots");
|
||||
if(plotSection == null) {
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey().value("PLOTS SETUP MISSING!").arena(arena).build());
|
||||
return false;
|
||||
}
|
||||
// Skips arenas with unloaded worlds: MiniGamesBox would createWorld() them.
|
||||
@Override
|
||||
public void registerArena(String id) {
|
||||
|
||||
BaseArena baseArena = (BaseArena) arena;
|
||||
ArenaWorldProvisioner provisioner = plugin.getArenaWorldProvisioner();
|
||||
for (String worldName : ArenaWorldProvisioner.collectArenaWorlds(ConfigUtils.getConfig(plugin, "arenas"), id)
|
||||
.keySet())
|
||||
{
|
||||
|
||||
for(String plotName : plotSection.getKeys(false)) {
|
||||
String minPointString = plotSection.getString(plotName + ".1", null);
|
||||
String maxPointString = plotSection.getString(plotName + ".2", null);
|
||||
if (plugin.getMyWorldsManager().isProtectedWorld(worldName)) {
|
||||
|
||||
if(minPointString != null && maxPointString != null) {
|
||||
Location minPoint = LocationSerializer.getLocation(minPointString);
|
||||
Location maxPoint = LocationSerializer.getLocation(maxPointString);
|
||||
// additionalValidatorChecks reports this one.
|
||||
continue;
|
||||
|
||||
if(minPoint != null && maxPoint != null) {
|
||||
World minWorld = minPoint.getWorld();
|
||||
|
||||
if(minWorld != null) {
|
||||
Biome biome = ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15) ?
|
||||
minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockY(), minPoint.getBlockZ())
|
||||
: minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockZ());
|
||||
|
||||
Plot buildPlot = new Plot(baseArena, biome);
|
||||
|
||||
buildPlot.setCuboid(new Cuboid(minPoint, maxPoint));
|
||||
buildPlot.fullyResetPlot();
|
||||
|
||||
if(isGuessArena) {
|
||||
int plotMemberSize = arena.getArenaOption("PLOT_MEMBER_SIZE");
|
||||
int maxPlayers = arena.getMaximumPlayers();
|
||||
int plotAmount = maxPlayers / plotMemberSize;
|
||||
for(int i = 0; i < plotAmount; i++) {
|
||||
Plot copyBuildPlot = new Plot(baseArena, biome);
|
||||
copyBuildPlot.setCuboid(new Cuboid(minPoint, maxPoint));
|
||||
copyBuildPlot.fullyResetPlot();
|
||||
baseArena.getPlotManager().addBuildPlot(copyBuildPlot);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
baseArena.getPlotManager().addBuildPlot(buildPlot);
|
||||
}
|
||||
}
|
||||
|
||||
if (provisioner == null || !provisioner.isWorldAvailable(worldName)) {
|
||||
|
||||
plugin.getLogger().severe("Arena " + id + " is not registered: its world '" + worldName
|
||||
+ "' is not loaded and could not be loaded from disk, and registering it anyway would let"
|
||||
+ " MiniGamesBox generate a vanilla world named '" + worldName + "' in its place.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey().value("PLOT NOT CONFIGURED!").arena(arena).build());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(isBuildArena) {
|
||||
((BuildArena) arena).initPoll();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BaseArena getArena(Player player) {
|
||||
IPluginArena pluginArena = super.getArena(player);
|
||||
if(pluginArena instanceof BaseArena) {
|
||||
return (BaseArena) pluginArena;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
super.registerArena(id);
|
||||
|
||||
@Override
|
||||
public @Nullable BaseArena getArena(String id) {
|
||||
IPluginArena pluginArena = super.getArena(id);
|
||||
if(pluginArena instanceof BaseArena) {
|
||||
return (BaseArena) pluginArena;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public @NotNull List<BaseArena> getPluginArenas() {
|
||||
List<BaseArena> baseArenas = new ArrayList<>(super.getArenas().size());
|
||||
for(IPluginArena pluginArena : super.getArenas()) {
|
||||
if(pluginArena instanceof BaseArena) {
|
||||
baseArenas.add((BaseArena) pluginArena);
|
||||
}
|
||||
@Override
|
||||
public PluginArena getNewArena(String id) {
|
||||
|
||||
switch (ConfigUtils.getConfig(plugin, "arenas").getString("instances." + id + ".gametype", "classic")
|
||||
.toLowerCase(Locale.ENGLISH))
|
||||
{
|
||||
|
||||
case "gtb":
|
||||
case "guessthebuild":
|
||||
case "guess_the_build":
|
||||
return new GuessArena(id);
|
||||
case "classic":
|
||||
case "solo":
|
||||
case "team":
|
||||
default:
|
||||
return new BuildArena(id);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return baseArenas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean additionalValidatorChecks(ConfigurationSection section, PluginArena arena, String id) {
|
||||
|
||||
if (!super.additionalValidatorChecks(section, arena, id))
|
||||
return false;
|
||||
|
||||
boolean isBuildArena = arena instanceof BuildArena;
|
||||
boolean isGuessArena = arena instanceof GuessArena;
|
||||
String arenaPath = id + ".";
|
||||
|
||||
if (!plugin.getMyWorldsManager().requireConfiguredArenaWorld(
|
||||
plugin.getMyWorldsManager().getWorldName(section.getString(arenaPath + "lobbylocation")),
|
||||
"Lobby location", (BaseArena) arena))
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (!plugin.getMyWorldsManager().requireConfiguredArenaWorld(
|
||||
plugin.getMyWorldsManager().getWorldName(section.getString(arenaPath + "startlocation")),
|
||||
"Start location", (BaseArena) arena))
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (!plugin.getMyWorldsManager().requireConfiguredArenaWorld(
|
||||
plugin.getMyWorldsManager().getWorldName(section.getString(arenaPath + "endlocation")), "End location",
|
||||
(BaseArena) arena))
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (isBuildArena) {
|
||||
|
||||
int plotMemberSize = section.getInt(id + ".plotmembersize", 0);
|
||||
|
||||
// Member size can not be less than 1
|
||||
if (plotMemberSize < 1) {
|
||||
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey()
|
||||
.value("INVALID PLOT MEMBER SIZE!").arena(arena).build());
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
arena.setArenaOption("PLOT_MEMBER_SIZE", plotMemberSize);
|
||||
int minPlayers = arena.getArenaOption("MINIMUM_PLAYERS");
|
||||
if (minPlayers <= plotMemberSize) {
|
||||
|
||||
arena.setArenaOption("MINIMUM_PLAYERS", plotMemberSize + 1);
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey()
|
||||
.value("MIN PLAYERS NEEDS TO BE 1 MORE THAN PLOT_MEMBER_SIZE, AUTOMATICALLY ADJUSTED. CONFIRM BY CHECKING ARENA SETUP!")
|
||||
.arena(arena).build());
|
||||
|
||||
}
|
||||
|
||||
((BuildArena) arena).setTypeByPlotMembers();
|
||||
|
||||
} else {
|
||||
|
||||
// todo gtb team mode, because why not!
|
||||
arena.setArenaOption("PLOT_MEMBER_SIZE", 1);
|
||||
|
||||
}
|
||||
|
||||
ConfigurationSection plotSection = section.getConfigurationSection(id + ".plots");
|
||||
if (plotSection == null) {
|
||||
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey()
|
||||
.value("PLOTS SETUP MISSING!").arena(arena).build());
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
BaseArena baseArena = (BaseArena) arena;
|
||||
|
||||
for (String plotName : plotSection.getKeys(false)) {
|
||||
|
||||
String minPointString = plotSection.getString(plotName + ".1", null);
|
||||
String maxPointString = plotSection.getString(plotName + ".2", null);
|
||||
|
||||
if (minPointString != null && maxPointString != null) {
|
||||
|
||||
if (!plugin.getMyWorldsManager().validateArenaWorld(
|
||||
plugin.getMyWorldsManager().getWorldName(minPointString), "Plot " + plotName + " corner 1",
|
||||
baseArena)
|
||||
|| !plugin.getMyWorldsManager().validateArenaWorld(
|
||||
plugin.getMyWorldsManager().getWorldName(maxPointString),
|
||||
"Plot " + plotName + " corner 2", baseArena))
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Location minPoint = LocationSerializer.getLocation(minPointString);
|
||||
Location maxPoint = LocationSerializer.getLocation(maxPointString);
|
||||
|
||||
if (minPoint != null && maxPoint != null) {
|
||||
|
||||
World minWorld = minPoint.getWorld();
|
||||
|
||||
if (minWorld != null) {
|
||||
|
||||
Biome biome = ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15)
|
||||
? minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockY(), minPoint.getBlockZ())
|
||||
: minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockZ());
|
||||
|
||||
Plot buildPlot = new Plot(baseArena, biome);
|
||||
|
||||
buildPlot.setCuboid(new Cuboid(minPoint, maxPoint));
|
||||
buildPlot.fullyResetPlot();
|
||||
|
||||
if (isGuessArena) {
|
||||
|
||||
int plotMemberSize = arena.getArenaOption("PLOT_MEMBER_SIZE");
|
||||
int maxPlayers = arena.getMaximumPlayers();
|
||||
int plotAmount = maxPlayers / plotMemberSize;
|
||||
for (int i = 0; i < plotAmount; i++) {
|
||||
|
||||
Plot copyBuildPlot = new Plot(baseArena, biome);
|
||||
copyBuildPlot.setCuboid(new Cuboid(minPoint, maxPoint));
|
||||
copyBuildPlot.fullyResetPlot();
|
||||
baseArena.getPlotManager().addBuildPlot(copyBuildPlot);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
||||
baseArena.getPlotManager().addBuildPlot(buildPlot);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
plugin.getDebugger().sendConsoleMsg(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey()
|
||||
.value("PLOT NOT CONFIGURED!").arena(arena).build());
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isBuildArena) {
|
||||
|
||||
((BuildArena) arena).initPoll();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BaseArena getArena(Player player) {
|
||||
|
||||
IPluginArena pluginArena = super.getArena(player);
|
||||
if (pluginArena instanceof BaseArena) {
|
||||
|
||||
return (BaseArena) pluginArena;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BaseArena getArena(String id) {
|
||||
|
||||
IPluginArena pluginArena = super.getArena(id);
|
||||
if (pluginArena instanceof BaseArena) {
|
||||
|
||||
return (BaseArena) pluginArena;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public @NotNull List<BaseArena> getPluginArenas() {
|
||||
|
||||
List<BaseArena> baseArenas = new ArrayList<>(super.getArenas().size());
|
||||
for (IPluginArena pluginArena : super.getArenas()) {
|
||||
|
||||
if (pluginArena instanceof BaseArena) {
|
||||
|
||||
baseArenas.add((BaseArena) pluginArena);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return baseArenas;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,16 +25,18 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.managers.MapRestorerManager;
|
||||
import plugily.projects.buildbattle.arena.managers.PhaseBossbarManager;
|
||||
import plugily.projects.buildbattle.arena.managers.ScoreboardManager;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.PlotManager;
|
||||
import plugily.projects.buildbattle.handlers.menu.registry.particles.ParticleRefreshScheduler;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.TitleBuilder;
|
||||
import plugily.projects.minigamesbox.classic.handlers.reward.RewardType;
|
||||
import plugily.projects.minigamesbox.classic.handlers.reward.RewardsFactory;
|
||||
import plugily.projects.minigamesbox.classic.utils.items.HandlerItem;
|
||||
import plugily.projects.minigamesbox.classic.utils.actionbar.ActionBar;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -44,228 +46,401 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 17.12.2021
|
||||
* <p>
|
||||
* Created at 17.12.2021
|
||||
*/
|
||||
public class BaseArena extends PluginArena {
|
||||
|
||||
private static Main plugin;
|
||||
private final List<Player> spectators = new ArrayList<>();
|
||||
private MapRestorerManager mapRestorerManager;
|
||||
private final PlotManager plotManager;
|
||||
private String theme = null;
|
||||
protected ParticleRefreshScheduler particleRefreshScheduler;
|
||||
private ArenaType arenaType;
|
||||
private static Main plugin;
|
||||
private final List<Player> spectators = new ArrayList<>();
|
||||
private MapRestorerManager mapRestorerManager;
|
||||
private final PlotManager plotManager;
|
||||
private final PhaseBossbarManager bossbarManager;
|
||||
// Seconds the running phase started with; feeds the boss bar's progress.
|
||||
private int phaseLength;
|
||||
private String theme = null;
|
||||
protected ParticleRefreshScheduler particleRefreshScheduler;
|
||||
private ArenaType arenaType;
|
||||
|
||||
private ArenaInGameState arenaInGameState;
|
||||
private ArenaInGameState arenaInGameState = ArenaInGameState.NONE;
|
||||
|
||||
private Map<Player, Plot> plotList = new HashMap<>();
|
||||
private Map<Player, Plot> plotList = new HashMap<>();
|
||||
|
||||
private Plot winnerPlot;
|
||||
private Plot winnerPlot;
|
||||
|
||||
public BaseArena(String id) {
|
||||
super(id);
|
||||
setPluginValues();
|
||||
setScoreboardManager(new ScoreboardManager(this));
|
||||
mapRestorerManager = new MapRestorerManager(this);
|
||||
plotManager = new PlotManager(this);
|
||||
setMapRestorerManager(mapRestorerManager);
|
||||
}
|
||||
public BaseArena(String id) {
|
||||
|
||||
public static void init(Main plugin) {
|
||||
BaseArena.plugin = plugin;
|
||||
}
|
||||
super(id);
|
||||
setPluginValues();
|
||||
setScoreboardManager(new ScoreboardManager(this));
|
||||
mapRestorerManager = new MapRestorerManager(this);
|
||||
plotManager = new PlotManager(this);
|
||||
setMapRestorerManager(mapRestorerManager);
|
||||
bossbarManager = new PhaseBossbarManager(this);
|
||||
|
||||
@Override
|
||||
public Main getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MapRestorerManager getMapRestorerManager() {
|
||||
return mapRestorerManager;
|
||||
}
|
||||
|
||||
|
||||
private void setPluginValues() {
|
||||
}
|
||||
|
||||
|
||||
public void addSpectatorPlayer(Player player) {
|
||||
spectators.add(player);
|
||||
}
|
||||
|
||||
public void removeSpectatorPlayer(Player player) {
|
||||
spectators.remove(player);
|
||||
}
|
||||
|
||||
public boolean isSpectatorPlayer(Player player) {
|
||||
return spectators.contains(player);
|
||||
}
|
||||
|
||||
public void cleanUpArena() {
|
||||
spectators.clear();
|
||||
plotList.clear();
|
||||
setTheme(null);
|
||||
winnerPlot = null;
|
||||
}
|
||||
|
||||
public List<Player> getSpectators() {
|
||||
return spectators;
|
||||
}
|
||||
|
||||
public enum ArenaType {
|
||||
SOLO("Classic"), TEAM("Teams"), GUESS_THE_BUILD("Guess-The-Build");
|
||||
|
||||
private final String prefix;
|
||||
|
||||
ArenaType(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
// MiniGamesBox adds and removes players through this getter, so the phase
|
||||
// timer bar replaces its rotating-message bar without touching its field.
|
||||
@Override
|
||||
public PhaseBossbarManager getBossbarManager() {
|
||||
|
||||
public enum ArenaInGameState {
|
||||
THEME_VOTING("Theme-Voting"), BUILD_TIME("Build-Time"), PLOT_VOTING("Plot-Voting"), NONE("NONE");
|
||||
return bossbarManager;
|
||||
|
||||
private final String prefix;
|
||||
|
||||
ArenaInGameState(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
// The bar is refreshed after the state handlers so it shows this second.
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
/**
|
||||
* Get current arena theme
|
||||
*
|
||||
* @return arena theme String or "Theme" as default
|
||||
*/
|
||||
@NotNull
|
||||
public String getTheme() {
|
||||
return theme;
|
||||
}
|
||||
super.run();
|
||||
bossbarManager.bossBarUpdate();
|
||||
|
||||
public void setTheme(String arenaTheme) {
|
||||
this.theme = arenaTheme;
|
||||
}
|
||||
|
||||
public void sendBuildLeftTimeMessage() {
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_TIME_LEFT_TITLE").asKey().arena(this).sendArena();
|
||||
String message = new MessageBuilder("IN_GAME_MESSAGES_PLOT_TIME_LEFT_CHAT").asKey().arena(this).build();
|
||||
for(Player p : getPlayers()) {
|
||||
VersionUtils.sendActionBar(p, message);
|
||||
p.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
public final void checkPlayerOutSidePlot() {
|
||||
if(plugin.getConfigPreferences().getOption("PLOT_MOVE_OUTSIDE")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(getArenaOption("IN_PLOT_CHECKER") >= 3) {
|
||||
setArenaOption("IN_PLOT_CHECKER", 0);
|
||||
public int getPhaseLength() {
|
||||
|
||||
for(Player player : getPlayersLeft()) {
|
||||
Plot buildPlot = null;
|
||||
return phaseLength;
|
||||
|
||||
}
|
||||
|
||||
// A timer raised above its current value starts a new phase countdown.
|
||||
@Override
|
||||
public void setTimer(int seconds) {
|
||||
|
||||
notePhaseTimer(seconds);
|
||||
super.setTimer(seconds);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTimer(int seconds, boolean forceArenaTimer) {
|
||||
|
||||
notePhaseTimer(seconds);
|
||||
super.setTimer(seconds, forceArenaTimer);
|
||||
|
||||
}
|
||||
|
||||
private void notePhaseTimer(int seconds) {
|
||||
|
||||
if (seconds > getTimer()) {
|
||||
|
||||
phaseLength = seconds;
|
||||
|
||||
if(this instanceof BuildArena) {
|
||||
buildPlot = getPlotFromPlayer(player);
|
||||
} else if(this instanceof GuessArena && (buildPlot = getPlotFromPlayer(player)) != null) {
|
||||
player.setPlayerWeather(buildPlot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(buildPlot.getTime(), player.getWorld().getTime()), false);
|
||||
}
|
||||
|
||||
if(buildPlot != null && buildPlot.getCuboid() != null && !buildPlot.getCuboid().isInWithMarge(player.getLocation(), 5)) {
|
||||
VersionUtils.teleport(player, buildPlot.getTeleportLocation());
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_OUTSIDE").asKey().arena(this).player(player).sendPlayer();
|
||||
}
|
||||
|
||||
// A state change adopts whatever timer the new phase was given.
|
||||
private void resetPhase() {
|
||||
|
||||
phaseLength = Math.max(0, getTimer());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArenaState(IArenaState arenaState, boolean forceArenaState) {
|
||||
|
||||
final boolean changed = arenaState != getArenaState();
|
||||
super.setArenaState(arenaState, forceArenaState);
|
||||
if (changed) {
|
||||
|
||||
resetPhase();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
changeArenaOptionBy("IN_PLOT_CHECKER", 1);
|
||||
}
|
||||
@Override
|
||||
public void setArenaState(IArenaState arenaState) {
|
||||
|
||||
public void calculateWinnerPlot() {
|
||||
winnerPlot = plotManager.getTopPlotsOrder().get(0);
|
||||
}
|
||||
final boolean changed = arenaState != getArenaState();
|
||||
super.setArenaState(arenaState);
|
||||
if (changed) {
|
||||
|
||||
public void executeEndRewards() {
|
||||
RewardsFactory rewards = plugin.getRewardsHandler();
|
||||
RewardType placeRewardType = rewards.getRewardType("PLACE");
|
||||
resetPhase();
|
||||
|
||||
List<Plot> plotsRanking = plotManager.getTopPlotsOrder();
|
||||
}
|
||||
|
||||
plotsRanking.forEach(plot -> plot.getMembers().forEach(player -> rewards.performReward(player, this, placeRewardType, plotsRanking.indexOf(plot) + 1)));
|
||||
plugin.getRewardsHandler().performReward(this, plugin.getRewardsHandler().getRewardType("END_GAME"));
|
||||
}
|
||||
|
||||
public void teleportToWinnerPlot() {
|
||||
Location winnerLocation = winnerPlot.getTeleportLocation();
|
||||
String formattedMembers = winnerPlot.getFormattedMembers();
|
||||
for(Player player : getPlayers()) {
|
||||
VersionUtils.teleport(player, winnerLocation);
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_WINNER").asKey().player(player).value(formattedMembers).sendPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
public PlotManager getPlotManager() {
|
||||
return plotManager;
|
||||
}
|
||||
public static void init(Main plugin) {
|
||||
|
||||
public ArenaType getArenaType() {
|
||||
return arenaType;
|
||||
}
|
||||
BaseArena.plugin = plugin;
|
||||
|
||||
public void setArenaType(ArenaType arenaType) {
|
||||
this.arenaType = arenaType;
|
||||
}
|
||||
}
|
||||
|
||||
public ArenaInGameState getArenaInGameState() {
|
||||
return arenaInGameState;
|
||||
}
|
||||
@Override
|
||||
public Main getPlugin() {
|
||||
|
||||
public void setArenaInGameState(ArenaInGameState arenaInGameState) {
|
||||
this.arenaInGameState = arenaInGameState;
|
||||
}
|
||||
return plugin;
|
||||
|
||||
public ParticleRefreshScheduler getParticleRefreshScheduler() {
|
||||
return particleRefreshScheduler;
|
||||
}
|
||||
}
|
||||
|
||||
public void setParticleRefreshScheduler(ParticleRefreshScheduler particleRefreshScheduler) {
|
||||
this.particleRefreshScheduler = particleRefreshScheduler;
|
||||
}
|
||||
@Override
|
||||
public MapRestorerManager getMapRestorerManager() {
|
||||
|
||||
public boolean enoughPlayersToContinue() {
|
||||
return true;
|
||||
}
|
||||
return mapRestorerManager;
|
||||
|
||||
public void distributePlots() {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Player, Plot> getPlotList() {
|
||||
return plotList;
|
||||
}
|
||||
private void setPluginValues() {
|
||||
|
||||
public Plot getPlotFromPlayer(Player player) {
|
||||
return plotList.get(player);
|
||||
}
|
||||
}
|
||||
|
||||
public Plot getWinnerPlot() {
|
||||
return winnerPlot;
|
||||
}
|
||||
public void addSpectatorPlayer(Player player) {
|
||||
|
||||
public void setWinnerPlot(Plot winnerPlot) {
|
||||
this.winnerPlot = winnerPlot;
|
||||
}
|
||||
spectators.add(player);
|
||||
|
||||
}
|
||||
|
||||
public void removeSpectatorPlayer(Player player) {
|
||||
|
||||
spectators.remove(player);
|
||||
|
||||
}
|
||||
|
||||
public boolean isSpectatorPlayer(Player player) {
|
||||
|
||||
return spectators.contains(player);
|
||||
|
||||
}
|
||||
|
||||
public void cleanUpArena() {
|
||||
|
||||
spectators.clear();
|
||||
plotList.clear();
|
||||
setTheme(null);
|
||||
winnerPlot = null;
|
||||
phaseLength = 0;
|
||||
bossbarManager.removeAll();
|
||||
|
||||
}
|
||||
|
||||
public List<Player> getSpectators() {
|
||||
|
||||
return spectators;
|
||||
|
||||
}
|
||||
|
||||
public enum ArenaType {
|
||||
|
||||
SOLO("Classic"), TEAM("Teams"), GUESS_THE_BUILD("Guess-The-Build");
|
||||
|
||||
private final String prefix;
|
||||
|
||||
ArenaType(String prefix) {
|
||||
|
||||
this.prefix = prefix;
|
||||
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
|
||||
return prefix;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum ArenaInGameState {
|
||||
|
||||
THEME_VOTING("Theme-Voting"), BUILD_TIME("Build-Time"), PLOT_VOTING("Plot-Voting"), NONE("NONE");
|
||||
|
||||
private final String prefix;
|
||||
|
||||
ArenaInGameState(String prefix) {
|
||||
|
||||
this.prefix = prefix;
|
||||
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
|
||||
return prefix;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current arena theme
|
||||
*
|
||||
* @return arena theme String or "Theme" as default
|
||||
*/
|
||||
@NotNull
|
||||
public String getTheme() {
|
||||
|
||||
return theme;
|
||||
|
||||
}
|
||||
|
||||
public void setTheme(String arenaTheme) {
|
||||
|
||||
this.theme = arenaTheme;
|
||||
|
||||
}
|
||||
|
||||
public void sendBuildLeftTimeMessage() {
|
||||
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_TIME_LEFT_TITLE").asKey().arena(this).sendArena();
|
||||
MessageBuilder message = new MessageBuilder("IN_GAME_MESSAGES_PLOT_TIME_LEFT_CHAT").asKey().arena(this);
|
||||
message.sendArena();
|
||||
getPlayers().forEach(player -> getPlugin().getActionBarManager().addActionBar(player,
|
||||
new ActionBar(message, ActionBar.ActionBarType.DISPLAY)));
|
||||
|
||||
}
|
||||
|
||||
public final void checkPlayerOutSidePlot() {
|
||||
|
||||
if (plugin.getConfigPreferences().getOption("PLOT_MOVE_OUTSIDE")) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (getArenaOption("IN_PLOT_CHECKER") >= 3) {
|
||||
|
||||
setArenaOption("IN_PLOT_CHECKER", 0);
|
||||
|
||||
for (Player player : getPlayersLeft()) {
|
||||
|
||||
if (this instanceof GuessArena) {
|
||||
|
||||
Plot buildPlot = ((GuessArena) this).getBuildPlot();
|
||||
if (buildPlot != null) {
|
||||
|
||||
player.setPlayerWeather(buildPlot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(buildPlot.getTime(), player.getWorld().getTime()), false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Past the wall by any route: pulled to the nearest legal spot.
|
||||
plugin.getPlotBorderManager().enforce(player);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
changeArenaOptionBy("IN_PLOT_CHECKER", 1);
|
||||
|
||||
}
|
||||
|
||||
public void calculateWinnerPlot() {
|
||||
|
||||
winnerPlot = plotManager.getTopPlotsOrder().get(0);
|
||||
|
||||
}
|
||||
|
||||
public void executeEndRewards() {
|
||||
|
||||
RewardsFactory rewards = plugin.getRewardsHandler();
|
||||
RewardType placeRewardType = rewards.getRewardType("PLACE");
|
||||
|
||||
List<Plot> plotsRanking = plotManager.getTopPlotsOrder();
|
||||
|
||||
plotsRanking.forEach(plot -> plot.getMembers().forEach(
|
||||
player -> rewards.performReward(player, this, placeRewardType, plotsRanking.indexOf(plot) + 1)));
|
||||
plugin.getRewardsHandler().performReward(this, plugin.getRewardsHandler().getRewardType("END_GAME"));
|
||||
|
||||
}
|
||||
|
||||
public void teleportToWinnerPlot() {
|
||||
|
||||
Location winnerLocation = winnerPlot.getTeleportLocation();
|
||||
String formattedMembers = winnerPlot.getFormattedMembers();
|
||||
for (Player player : getPlayers()) {
|
||||
|
||||
VersionUtils.teleport(player, winnerLocation);
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_WINNER").asKey().player(player).value(formattedMembers)
|
||||
.sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PlotManager getPlotManager() {
|
||||
|
||||
return plotManager;
|
||||
|
||||
}
|
||||
|
||||
public ArenaType getArenaType() {
|
||||
|
||||
return arenaType;
|
||||
|
||||
}
|
||||
|
||||
public void setArenaType(ArenaType arenaType) {
|
||||
|
||||
this.arenaType = arenaType;
|
||||
|
||||
}
|
||||
|
||||
public ArenaInGameState getArenaInGameState() {
|
||||
|
||||
return arenaInGameState;
|
||||
|
||||
}
|
||||
|
||||
public void setArenaInGameState(ArenaInGameState arenaInGameState) {
|
||||
|
||||
final boolean changed = arenaInGameState != this.arenaInGameState;
|
||||
this.arenaInGameState = arenaInGameState;
|
||||
if (changed) {
|
||||
|
||||
resetPhase();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ParticleRefreshScheduler getParticleRefreshScheduler() {
|
||||
|
||||
return particleRefreshScheduler;
|
||||
|
||||
}
|
||||
|
||||
public void setParticleRefreshScheduler(ParticleRefreshScheduler particleRefreshScheduler) {
|
||||
|
||||
this.particleRefreshScheduler = particleRefreshScheduler;
|
||||
|
||||
}
|
||||
|
||||
public boolean enoughPlayersToContinue() {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void distributePlots() {
|
||||
|
||||
}
|
||||
|
||||
public Map<Player, Plot> getPlotList() {
|
||||
|
||||
return plotList;
|
||||
|
||||
}
|
||||
|
||||
public Plot getPlotFromPlayer(Player player) {
|
||||
|
||||
return plotList.get(player);
|
||||
|
||||
}
|
||||
|
||||
public Plot getWinnerPlot() {
|
||||
|
||||
return winnerPlot;
|
||||
|
||||
}
|
||||
|
||||
public void setWinnerPlot(Plot winnerPlot) {
|
||||
|
||||
this.winnerPlot = winnerPlot;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,159 +25,323 @@ import org.jetbrains.annotations.NotNull;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.buildbattle.arena.states.build.InGameState;
|
||||
import plugily.projects.buildbattle.arena.states.build.StartingState;
|
||||
import plugily.projects.buildbattle.handlers.themes.ThemeManager;
|
||||
import plugily.projects.buildbattle.handlers.themes.vote.VoteMenu;
|
||||
import plugily.projects.buildbattle.handlers.themes.vote.VotePoll;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 22.04.2022
|
||||
* <p>
|
||||
* Created at 22.04.2022
|
||||
*/
|
||||
public class BuildArena extends BaseArena {
|
||||
private final Queue<Plot> queue = new LinkedList<>();
|
||||
private Plot votingPlot;
|
||||
private VoteMenu voteMenu;
|
||||
|
||||
public BuildArena(String id) {
|
||||
super(id);
|
||||
setArenaType(ArenaType.SOLO);
|
||||
addGameStateHandler(IArenaState.IN_GAME, new InGameState());
|
||||
addGameStateHandler(IArenaState.STARTING, new StartingState());
|
||||
getPlugin().getDebugger().debug("Init Arena {0} with ArenaType {1}", getId(), getArenaType());
|
||||
}
|
||||
private final Queue<Plot> queue = new LinkedList<>();
|
||||
private Plot votingPlot;
|
||||
private VoteMenu voteMenu;
|
||||
private int round = 1;
|
||||
// Themes built so far this match, so no round repeats one.
|
||||
private final List<String> playedThemes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Initiates voting poll
|
||||
*/
|
||||
public void initPoll() {
|
||||
voteMenu = new VoteMenu(this);
|
||||
voteMenu.resetPoll();
|
||||
}
|
||||
public BuildArena(String id) {
|
||||
|
||||
super(id);
|
||||
setArenaType(ArenaType.SOLO);
|
||||
addGameStateHandler(IArenaState.IN_GAME, new InGameState());
|
||||
addGameStateHandler(IArenaState.STARTING, new StartingState());
|
||||
getPlugin().getDebugger().debug("Init Arena {0} with ArenaType {1}", getId(), getArenaType());
|
||||
|
||||
@Override
|
||||
public void cleanUpArena() {
|
||||
votingPlot = null;
|
||||
if(voteMenu != null) {
|
||||
voteMenu.resetPoll();
|
||||
}
|
||||
super.cleanUpArena();
|
||||
}
|
||||
|
||||
public VotePoll getVotePoll() {
|
||||
return voteMenu.getVotePoll();
|
||||
}
|
||||
/**
|
||||
* Initiates voting poll
|
||||
*/
|
||||
public void initPoll() {
|
||||
|
||||
public VoteMenu getVoteMenu() {
|
||||
return voteMenu;
|
||||
}
|
||||
voteMenu = new VoteMenu(this);
|
||||
voteMenu.resetPoll();
|
||||
|
||||
public void setVotingPlot(Plot votingPlot) {
|
||||
this.votingPlot = votingPlot;
|
||||
}
|
||||
|
||||
public Plot getVotingPlot() {
|
||||
return votingPlot;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Queue<Plot> getQueue() {
|
||||
return queue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distributePlots() {
|
||||
int neededPlots = getPlayersLeft().size() / getArenaOption("PLOT_MEMBER_SIZE");
|
||||
if(getPlotManager().getPlots().size() < neededPlots) {
|
||||
getPlugin().getMessageUtils().errorOccurred();
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[Build Battle] [PLOT WARNING] Not enough plots in arena " + getId() + "! Lacks " + (neededPlots - getPlotManager().getPlots().size()) + " plots");
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[PLOT WARNING] Required " + neededPlots + " but have " + getPlotManager().getPlots().size());
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[PLOT WARNING] Instance was stopped!");
|
||||
getPlugin().getArenaManager().stopGame(true, this);
|
||||
}
|
||||
switch(getArenaType()) {
|
||||
case SOLO:
|
||||
List<Player> players = new ArrayList<>(getPlayersLeft());
|
||||
for(Plot plot : getPlotManager().getPlots()) {
|
||||
if(players.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!getPlugin().getUserManager().getUser(players.get(0)).isSpectator()) {
|
||||
plot.addMember(players.remove(0), this, true);
|
||||
}
|
||||
@Override
|
||||
public void cleanUpArena() {
|
||||
|
||||
votingPlot = null;
|
||||
queue.clear();
|
||||
round = 1;
|
||||
playedThemes.clear();
|
||||
if (voteMenu != null) {
|
||||
|
||||
voteMenu.resetPoll();
|
||||
|
||||
}
|
||||
break;
|
||||
case TEAM:
|
||||
int plotMemberSize = getArenaOption("PLOT_MEMBER_SIZE");
|
||||
int neededDividedPlots = getPlayersLeft().size() / plotMemberSize;
|
||||
int currentDividedPlots = (int) getPlotManager().getPlots().stream().filter(plot -> plot.getMembersSize() > 0).count();
|
||||
|
||||
super.cleanUpArena();
|
||||
|
||||
}
|
||||
|
||||
public int getRound() {
|
||||
|
||||
return round;
|
||||
|
||||
}
|
||||
|
||||
// Build rounds per match from Time-Manager.<type>.Rounds, never below one.
|
||||
public int getRounds() {
|
||||
|
||||
return Math.max(1, getPlugin().getConfig().getInt("Time-Manager." + getArenaType().getPrefix() + ".Rounds", 3));
|
||||
|
||||
}
|
||||
|
||||
public boolean isLastRound() {
|
||||
|
||||
return round >= getRounds();
|
||||
|
||||
}
|
||||
|
||||
// Time-Manager.<type>.Random-Theme: the plugin picks each theme, no vote.
|
||||
public boolean isRandomTheme() {
|
||||
|
||||
return getPlugin().getConfig().getBoolean("Time-Manager." + getArenaType().getPrefix() + ".Random-Theme", true);
|
||||
|
||||
}
|
||||
|
||||
public List<String> getPlayedThemes() {
|
||||
|
||||
return playedThemes;
|
||||
|
||||
}
|
||||
|
||||
// An unused theme from this type's list, or null when the list is empty.
|
||||
public String pickRandomTheme() {
|
||||
|
||||
List<String> themes = new ArrayList<>(
|
||||
getPlugin().getThemeManager().getThemes(ThemeManager.GameThemes.getByArenaType(getArenaType())));
|
||||
List<String> unplayed = new ArrayList<>(themes);
|
||||
unplayed.removeAll(playedThemes);
|
||||
List<String> pool = unplayed.isEmpty() ? themes : unplayed;
|
||||
return pool.isEmpty() ? null : pool.get(ThreadLocalRandom.current().nextInt(pool.size()));
|
||||
|
||||
}
|
||||
|
||||
// Closes the judged round: every occupied plot is cleared for a new theme.
|
||||
public void nextRound() {
|
||||
|
||||
round++;
|
||||
votingPlot = null;
|
||||
queue.clear();
|
||||
setTheme(null);
|
||||
for (Plot plot : getPlotManager().getPlots()) {
|
||||
|
||||
if (plot.getMembers().isEmpty()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
plot.resetPlot();
|
||||
plot.resetRoundPoints();
|
||||
|
||||
if(neededDividedPlots > currentDividedPlots) {
|
||||
List<Plot> fullPlots = getPlotManager().getPlots().stream().filter(plot -> plot.getMembersSize() == plotMemberSize).collect(Collectors.toList());
|
||||
List<Player> playersToMove = getPlayersLeft().stream().filter(player -> fullPlots.stream().noneMatch(plot -> plot.getMembers().contains(player))).collect(Collectors.toList());
|
||||
if(!playersToMove.isEmpty()) {
|
||||
for(int i = 0; i < playersToMove.size(); i++) {
|
||||
Player move = playersToMove.get(i);
|
||||
List<Plot> emptyPlots = getPlotManager().getPlots().stream().filter(plot -> plot.getMembersSize() < plotMemberSize).collect(Collectors.toList());
|
||||
Plot maxEmptyPlot = emptyPlots.stream().max(Comparator.comparing(Plot::getMembersSize)).get();
|
||||
maxEmptyPlot.addMember(move, this, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
//check if not only one plot got players
|
||||
Plot maxPlayers = getPlotManager().getPlots().stream().max(Comparator.comparing(Plot::getMembersSize)).get();
|
||||
Plot minPlayers = getPlotManager().getPlots().stream().min(Comparator.comparing(Plot::getMembersSize)).get();
|
||||
if(maxPlayers.getMembersSize() == getPlayersLeft().size()) {
|
||||
for(int i = 0; i < maxPlayers.getMembersSize() / 2; i++) {
|
||||
Player move = maxPlayers.getMembers().get(i);
|
||||
minPlayers.addMember(move, this, true);
|
||||
maxPlayers.removeMember(move);
|
||||
}
|
||||
|
||||
if (voteMenu != null) {
|
||||
|
||||
voteMenu.resetPoll();
|
||||
|
||||
}
|
||||
}
|
||||
for(Plot plot : getPlotManager().getPlots()) {
|
||||
if(plot.getMembers().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
for(Player member : plot.getMembers()) {
|
||||
getPlotList().put(member, plot);
|
||||
}
|
||||
}
|
||||
getPlotManager().teleportToPlots();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean enoughPlayersToContinue() {
|
||||
int size = getPlayersLeft().size();
|
||||
int memberSize = getArenaOption("PLOT_MEMBER_SIZE");
|
||||
|
||||
if(size > memberSize) {
|
||||
return true;
|
||||
}
|
||||
if(size == memberSize) {
|
||||
return !new HashSet<>(getPlotManager().getPlot(getPlayersLeft().get(0)).getMembers()).containsAll(getPlayersLeft());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinimumPlayers(int amount) {
|
||||
if(getArenaType() == ArenaType.TEAM && amount <= getArenaOption("PLOT_MEMBER_SIZE")) {
|
||||
getPlugin().getDebugger().debug("Minimum players amount for TEAM game mode arena cannot be less than 3! Setting amount to 3!");
|
||||
super.setMinimumPlayers(3);
|
||||
return;
|
||||
}
|
||||
super.setMinimumPlayers(amount);
|
||||
}
|
||||
public VotePoll getVotePoll() {
|
||||
|
||||
protected void setTypeByPlotMembers() {
|
||||
setArenaType(getArenaOption("PLOT_MEMBER_SIZE") <= 1 ? ArenaType.SOLO : ArenaType.TEAM);
|
||||
}
|
||||
return voteMenu.getVotePoll();
|
||||
|
||||
}
|
||||
|
||||
public VoteMenu getVoteMenu() {
|
||||
|
||||
return voteMenu;
|
||||
|
||||
}
|
||||
|
||||
public void setVotingPlot(Plot votingPlot) {
|
||||
|
||||
this.votingPlot = votingPlot;
|
||||
|
||||
}
|
||||
|
||||
public Plot getVotingPlot() {
|
||||
|
||||
return votingPlot;
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Queue<Plot> getQueue() {
|
||||
|
||||
return queue;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distributePlots() {
|
||||
|
||||
int neededPlots = getPlayersLeft().size() / getArenaOption("PLOT_MEMBER_SIZE");
|
||||
if (getPlotManager().getPlots().size() < neededPlots) {
|
||||
|
||||
getPlugin().getMessageUtils().errorOccurred();
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[Build Battle] [PLOT WARNING] Not enough plots in arena "
|
||||
+ getId() + "! Lacks " + (neededPlots - getPlotManager().getPlots().size()) + " plots");
|
||||
getPlugin().getDebugger().sendConsoleMsg(
|
||||
"&c[PLOT WARNING] Required " + neededPlots + " but have " + getPlotManager().getPlots().size());
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[PLOT WARNING] Instance was stopped!");
|
||||
getPlugin().getArenaManager().stopGame(true, this);
|
||||
|
||||
}
|
||||
|
||||
switch (getArenaType()) {
|
||||
|
||||
case SOLO:
|
||||
List<Player> players = new ArrayList<>(getPlayersLeft());
|
||||
for (Plot plot : getPlotManager().getPlots()) {
|
||||
|
||||
if (players.isEmpty()) {
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (!plot.getMembers().isEmpty()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (!getPlugin().getUserManager().getUser(players.get(0)).isSpectator()) {
|
||||
|
||||
plot.addMember(players.remove(0), this, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case TEAM:
|
||||
int plotMemberSize = getArenaOption("PLOT_MEMBER_SIZE");
|
||||
int neededDividedPlots = getPlayersLeft().size() / plotMemberSize;
|
||||
int currentDividedPlots = (int) getPlotManager().getPlots().stream()
|
||||
.filter(plot -> plot.getMembersSize() > 0).count();
|
||||
|
||||
if (neededDividedPlots > currentDividedPlots) {
|
||||
|
||||
List<Plot> fullPlots = getPlotManager().getPlots().stream()
|
||||
.filter(plot -> plot.getMembersSize() == plotMemberSize).collect(Collectors.toList());
|
||||
List<Player> playersToMove = getPlayersLeft().stream()
|
||||
.filter(player -> fullPlots.stream().noneMatch(plot -> plot.getMembers().contains(player)))
|
||||
.collect(Collectors.toList());
|
||||
if (!playersToMove.isEmpty()) {
|
||||
|
||||
for (int i = 0; i < playersToMove.size(); i++) {
|
||||
|
||||
Player move = playersToMove.get(i);
|
||||
List<Plot> emptyPlots = getPlotManager().getPlots().stream()
|
||||
.filter(plot -> plot.getMembersSize() < plotMemberSize)
|
||||
.collect(Collectors.toList());
|
||||
Plot maxEmptyPlot = emptyPlots.stream().max(Comparator.comparing(Plot::getMembersSize))
|
||||
.get();
|
||||
maxEmptyPlot.addMember(move, this, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// check if not only one plot got players
|
||||
Plot maxPlayers = getPlotManager().getPlots().stream().max(Comparator.comparing(Plot::getMembersSize))
|
||||
.get();
|
||||
Plot minPlayers = getPlotManager().getPlots().stream().min(Comparator.comparing(Plot::getMembersSize))
|
||||
.get();
|
||||
if (maxPlayers.getMembersSize() == getPlayersLeft().size()) {
|
||||
|
||||
for (int i = 0; i < maxPlayers.getMembersSize() / 2; i++) {
|
||||
|
||||
Player move = maxPlayers.getMembers().get(i);
|
||||
minPlayers.addMember(move, this, true);
|
||||
maxPlayers.removeMember(move);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Plot plot : getPlotManager().getPlots()) {
|
||||
|
||||
if (plot.getMembers().isEmpty()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (Player member : plot.getMembers()) {
|
||||
|
||||
getPlotList().put(member, plot);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getPlotManager().teleportToPlots();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enoughPlayersToContinue() {
|
||||
|
||||
int size = getPlayersLeft().size();
|
||||
int memberSize = getArenaOption("PLOT_MEMBER_SIZE");
|
||||
|
||||
if (size > memberSize) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (size == memberSize) {
|
||||
|
||||
return !new HashSet<>(getPlotManager().getPlot(getPlayersLeft().get(0)).getMembers())
|
||||
.containsAll(getPlayersLeft());
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinimumPlayers(int amount) {
|
||||
|
||||
if (getArenaType() == ArenaType.TEAM && amount <= getArenaOption("PLOT_MEMBER_SIZE")) {
|
||||
|
||||
getPlugin().getDebugger().debug(
|
||||
"Minimum players amount for TEAM game mode arena cannot be less than 3! Setting amount to 3!");
|
||||
super.setMinimumPlayers(3);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
super.setMinimumPlayers(amount);
|
||||
|
||||
}
|
||||
|
||||
protected void setTypeByPlotMembers() {
|
||||
|
||||
setArenaType(getArenaOption("PLOT_MEMBER_SIZE") <= 1 ? ArenaType.SOLO : ArenaType.TEAM);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import plugily.projects.buildbattle.api.event.guess.PlayerThemeGuessEvent;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.buildbattle.arena.states.guess.InGameState;
|
||||
import plugily.projects.buildbattle.arena.states.guess.StartingState;
|
||||
import plugily.projects.buildbattle.handlers.themes.BBTheme;
|
||||
import plugily.projects.buildbattle.handlers.themes.GuessTheme;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
@@ -39,218 +39,320 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 29.05.2022
|
||||
* <p>
|
||||
* Created at 29.05.2022
|
||||
*/
|
||||
public class GuessArena extends BaseArena {
|
||||
|
||||
private final List<Player> whoGuessed = new ArrayList<>();
|
||||
private int round = 1;
|
||||
private BBTheme currentTheme = null;
|
||||
private final List<Player> whoGuessed = new ArrayList<>();
|
||||
private int round = 1;
|
||||
private GuessTheme currentTheme = null;
|
||||
|
||||
private Plot buildPlot = null;
|
||||
private List<Integer> removedCharsAt = new ArrayList<>();
|
||||
private Plot buildPlot = null;
|
||||
private List<Integer> removedCharsAt = new ArrayList<>();
|
||||
|
||||
private final int plotMemberSize = getArenaOption("PLOT_MEMBER_SIZE");
|
||||
private final int plotMemberSize = getArenaOption("PLOT_MEMBER_SIZE");
|
||||
|
||||
private List<Plot> playedPlots = new ArrayList<>();
|
||||
private List<Plot> playedPlots = new ArrayList<>();
|
||||
|
||||
private List<String> playedThemes = new ArrayList<>();
|
||||
private List<String> playedThemes = new ArrayList<>();
|
||||
|
||||
public GuessArena(String id) {
|
||||
super(id);
|
||||
setArenaType(ArenaType.GUESS_THE_BUILD);
|
||||
addGameStateHandler(IArenaState.IN_GAME, new InGameState());
|
||||
addGameStateHandler(IArenaState.STARTING, new StartingState());
|
||||
getPlugin().getDebugger().debug("Init Arena {0} with ArenaType {1}", getId(), getArenaType());
|
||||
}
|
||||
public GuessArena(String id) {
|
||||
|
||||
@Override
|
||||
public void cleanUpArena() {
|
||||
currentTheme = null;
|
||||
resetBuildPlot();
|
||||
round = 1;
|
||||
playedPlots.clear();
|
||||
playedThemes.clear();
|
||||
super.cleanUpArena();
|
||||
}
|
||||
super(id);
|
||||
setArenaType(ArenaType.GUESS_THE_BUILD);
|
||||
addGameStateHandler(IArenaState.IN_GAME, new InGameState());
|
||||
addGameStateHandler(IArenaState.STARTING, new StartingState());
|
||||
getPlugin().getDebugger().debug("Init Arena {0} with ArenaType {1}", getId(), getArenaType());
|
||||
|
||||
@Override
|
||||
public void distributePlots() {
|
||||
int neededPlots = getPlayersLeft().size() / plotMemberSize;
|
||||
if(getPlotManager().getPlots().size() < neededPlots) {
|
||||
getPlugin().getMessageUtils().errorOccurred();
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[Build Battle] [PLOT WARNING] Not enough plots in arena " + getId() + "! Lacks " + (neededPlots - getPlotManager().getPlots().size()) + " plots");
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[PLOT WARNING] Required " + neededPlots + " but have " + getPlotManager().getPlots().size());
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[PLOT WARNING] Instance was stopped!");
|
||||
getPlugin().getArenaManager().stopGame(true, this);
|
||||
}
|
||||
List<Player> players = new ArrayList<>(getPlayersLeft());
|
||||
for(Plot plot : getPlotManager().getPlots()) {
|
||||
if(players.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
if(!getPlugin().getUserManager().getUser(players.get(0)).isSpectator()) {
|
||||
plot.addMember(players.remove(0), this, true);
|
||||
}
|
||||
}
|
||||
for(Plot plot : getPlotManager().getPlots()) {
|
||||
if(plot.getMembers().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
for(Player member : plot.getMembers()) {
|
||||
getPlotList().put(member, plot);
|
||||
}
|
||||
}
|
||||
getPlotManager().teleportToPlots();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean enoughPlayersToContinue() {
|
||||
int size = getPlayersLeft().size();
|
||||
|
||||
if(size > plotMemberSize) {
|
||||
return true;
|
||||
}
|
||||
if(size == plotMemberSize) {
|
||||
return !new HashSet<>(getPlotManager().getPlot(getPlayersLeft().get(0)).getMembers()).containsAll(getPlayersLeft());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setNextPlot() {
|
||||
List<Plot> plots = new ArrayList<>(getPlotList().values());
|
||||
plots.removeAll(playedPlots);
|
||||
if(plots.isEmpty()) {
|
||||
plots = new ArrayList<>(getPlotList().values());
|
||||
playedPlots.clear();
|
||||
}
|
||||
Plot nextPlot = plots.get(getPlugin().getRandom().nextInt(plots.size()));
|
||||
playedPlots.add(nextPlot);
|
||||
buildPlot = nextPlot;
|
||||
getPlugin().getDebugger().debug("Arena {0} Next BuilderTeam is {1}", getId(), nextPlot.getFormattedMembers());
|
||||
teleportPlayersToPlot(nextPlot);
|
||||
}
|
||||
|
||||
public void resetBuildPlot() {
|
||||
if(buildPlot != null) {
|
||||
buildPlot.resetPlot();
|
||||
}
|
||||
removedCharsAt.clear();
|
||||
setBuildPlot(null);
|
||||
setCurrentTheme(null);
|
||||
whoGuessed.clear();
|
||||
round += 1;
|
||||
getPlayers().forEach(player -> getPlugin().getActionBarManager().clearActionBarsFromPlayer(player));
|
||||
}
|
||||
|
||||
public void teleportPlayersToPlot(Plot plot) {
|
||||
Location plotLoc = plot.getTeleportLocation();
|
||||
for(Player player : getPlayers()) {
|
||||
VersionUtils.teleport(player, plotLoc);
|
||||
player.setPlayerWeather(plot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(plot.getTime(), player.getWorld().getTime()), false);
|
||||
VersionUtils.setCollidable(player, false);
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
player.getInventory().clear();
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinimumPlayers(int amount) {
|
||||
if(amount <= plotMemberSize) {
|
||||
getPlugin().getDebugger().debug("Minimum players amount for TEAM game mode arena cannot be less than 3! Setting amount to 3!");
|
||||
setArenaOption("MINIMUM_PLAYERS", 3);
|
||||
return;
|
||||
}
|
||||
super.setMinimumPlayers(amount);
|
||||
}
|
||||
|
||||
public void addWhoGuessed(Player player) {
|
||||
whoGuessed.add(player);
|
||||
getPlugin().getRewardsHandler().performReward(player, this, getPlugin().getRewardsHandler().getRewardType("GUESS"), -1);
|
||||
|
||||
int timer = getTimer();
|
||||
|
||||
//decrease game time by guessed theme
|
||||
if(timer >= 15) {
|
||||
setTimer(timer - getPlugin().getConfig().getInt("Time-Manager." + getArenaType().getPrefix() + ".Guess"));
|
||||
}
|
||||
|
||||
//-1 because builder can´t guess
|
||||
if(whoGuessed.size() >= getPlayersLeft().size() - 1) {
|
||||
setTimer(getPlugin().getConfig().getInt("Time-Manager." + getArenaType().getPrefix() + ".Round-Delay"));
|
||||
setArenaInGameState(ArenaInGameState.PLOT_VOTING);
|
||||
@Override
|
||||
public void cleanUpArena() {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESSED").asKey().arena(this).sendArena();
|
||||
currentTheme = null;
|
||||
resetBuildPlot();
|
||||
round = 1;
|
||||
playedPlots.clear();
|
||||
playedThemes.clear();
|
||||
super.cleanUpArena();
|
||||
|
||||
getPlugin().getRewardsHandler().performReward(this, getPlugin().getRewardsHandler().getRewardType("GUESS_ALL"));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastPlayerGuessed(Player player) {
|
||||
int bonusAmount = getPlugin().getConfig().getInt("Guessing-Points." + (whoGuessed.size() + 1), 0);
|
||||
int points = currentTheme.getDifficulty().getPointsReward() + bonusAmount;
|
||||
getPlotManager().getPlot(player).addPoints(points);
|
||||
buildPlot.addPoints(getPlugin().getConfig().getInt("Guessing-Points.Builder", 1));
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_GUESSED").asKey().arena(this).player(player).sendArena();
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_POINTS").asKey().integer(points).arena(this).player(player).sendPlayer();
|
||||
@Override
|
||||
public void distributePlots() {
|
||||
|
||||
addWhoGuessed(player);
|
||||
Bukkit.getScheduler().runTask(getPlugin(), () -> Bukkit.getPluginManager().callEvent(new PlayerThemeGuessEvent(this, currentTheme)));
|
||||
}
|
||||
int neededPlots = getPlayersLeft().size() / plotMemberSize;
|
||||
if (getPlotManager().getPlots().size() < neededPlots) {
|
||||
|
||||
public BBTheme getCurrentBBTheme() {
|
||||
return currentTheme;
|
||||
}
|
||||
getPlugin().getMessageUtils().errorOccurred();
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[Build Battle] [PLOT WARNING] Not enough plots in arena "
|
||||
+ getId() + "! Lacks " + (neededPlots - getPlotManager().getPlots().size()) + " plots");
|
||||
getPlugin().getDebugger().sendConsoleMsg(
|
||||
"&c[PLOT WARNING] Required " + neededPlots + " but have " + getPlotManager().getPlots().size());
|
||||
getPlugin().getDebugger().sendConsoleMsg("&c[PLOT WARNING] Instance was stopped!");
|
||||
getPlugin().getArenaManager().stopGame(true, this);
|
||||
|
||||
public boolean isCurrentThemeSet() {
|
||||
return currentTheme != null;
|
||||
}
|
||||
}
|
||||
|
||||
List<Player> players = new ArrayList<>(getPlayersLeft());
|
||||
for (Plot plot : getPlotManager().getPlots()) {
|
||||
|
||||
if (players.isEmpty()) {
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (!plot.getMembers().isEmpty()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (!getPlugin().getUserManager().getUser(players.get(0)).isSpectator()) {
|
||||
|
||||
plot.addMember(players.remove(0), this, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Plot plot : getPlotManager().getPlots()) {
|
||||
|
||||
if (plot.getMembers().isEmpty()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (Player member : plot.getMembers()) {
|
||||
|
||||
getPlotList().put(member, plot);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getPlotManager().teleportToPlots();
|
||||
|
||||
public List<Player> getCurrentBuilders() {
|
||||
if(buildPlot == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return buildPlot.getMembers();
|
||||
}
|
||||
|
||||
public Plot getBuildPlot() {
|
||||
return buildPlot;
|
||||
}
|
||||
@Override
|
||||
public boolean enoughPlayersToContinue() {
|
||||
|
||||
public void setBuildPlot(Plot buildPlot) {
|
||||
this.buildPlot = buildPlot;
|
||||
}
|
||||
int size = getPlayersLeft().size();
|
||||
|
||||
if (size > plotMemberSize) {
|
||||
|
||||
public List<String> getPlayedThemes() {
|
||||
return playedThemes;
|
||||
}
|
||||
return true;
|
||||
|
||||
public int getRound() {
|
||||
return round;
|
||||
}
|
||||
}
|
||||
|
||||
if (size == plotMemberSize) {
|
||||
|
||||
return !new HashSet<>(getPlotManager().getPlot(getPlayersLeft().get(0)).getMembers())
|
||||
.containsAll(getPlayersLeft());
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
public void setCurrentTheme(BBTheme currentTheme) {
|
||||
if(currentTheme == null) {
|
||||
getPlugin().getDebugger().debug("Arena {0} set Theme null", getId());
|
||||
} else {
|
||||
getPlugin().getDebugger().debug("Arena {0} set Theme to {1} ({2})", getId(), currentTheme.getTheme(), currentTheme.getDifficulty());
|
||||
}
|
||||
this.currentTheme = currentTheme;
|
||||
}
|
||||
|
||||
public List<Player> getWhoGuessed() {
|
||||
return whoGuessed;
|
||||
}
|
||||
public void setNextPlot() {
|
||||
|
||||
public List<Integer> getRemovedCharsAt() {
|
||||
return removedCharsAt;
|
||||
}
|
||||
List<Plot> plots = new ArrayList<>(getPlotList().values());
|
||||
plots.removeAll(playedPlots);
|
||||
if (plots.isEmpty()) {
|
||||
|
||||
plots = new ArrayList<>(getPlotList().values());
|
||||
playedPlots.clear();
|
||||
|
||||
}
|
||||
|
||||
Plot nextPlot = plots.get(getPlugin().getRandom().nextInt(plots.size()));
|
||||
playedPlots.add(nextPlot);
|
||||
buildPlot = nextPlot;
|
||||
getPlugin().getDebugger().debug("Arena {0} Next BuilderTeam is {1}", getId(), nextPlot.getFormattedMembers());
|
||||
teleportPlayersToPlot(nextPlot);
|
||||
|
||||
}
|
||||
|
||||
public void resetBuildPlot() {
|
||||
|
||||
if (buildPlot != null) {
|
||||
|
||||
buildPlot.resetPlot();
|
||||
|
||||
}
|
||||
|
||||
removedCharsAt.clear();
|
||||
setBuildPlot(null);
|
||||
setCurrentTheme(null);
|
||||
whoGuessed.clear();
|
||||
round += 1;
|
||||
getPlayers().forEach(player -> getPlugin().getActionBarManager().clearActionBarsFromPlayer(player));
|
||||
|
||||
}
|
||||
|
||||
public void teleportPlayersToPlot(Plot plot) {
|
||||
|
||||
Location plotLoc = plot.getTeleportLocation();
|
||||
for (Player player : getPlayers()) {
|
||||
|
||||
VersionUtils.teleport(player, plotLoc);
|
||||
player.setPlayerWeather(plot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(plot.getTime(), player.getWorld().getTime()), false);
|
||||
VersionUtils.setCollidable(player, false);
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
player.getInventory().clear();
|
||||
player.updateInventory();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinimumPlayers(int amount) {
|
||||
|
||||
if (amount <= plotMemberSize) {
|
||||
|
||||
getPlugin().getDebugger().debug(
|
||||
"Minimum players amount for TEAM game mode arena cannot be less than 3! Setting amount to 3!");
|
||||
setArenaOption("MINIMUM_PLAYERS", 3);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
super.setMinimumPlayers(amount);
|
||||
|
||||
}
|
||||
|
||||
public void addWhoGuessed(Player player) {
|
||||
|
||||
whoGuessed.add(player);
|
||||
getPlugin().getRewardsHandler().performReward(player, this,
|
||||
getPlugin().getRewardsHandler().getRewardType("GUESS"), -1);
|
||||
|
||||
int timer = getTimer();
|
||||
|
||||
// decrease game time by guessed theme
|
||||
if (timer >= 15) {
|
||||
|
||||
setTimer(timer - getPlugin().getConfig().getInt("Time-Manager." + getArenaType().getPrefix() + ".Guess"));
|
||||
|
||||
}
|
||||
|
||||
// -1 because builder can´t guess
|
||||
if (whoGuessed.size() >= getPlayersLeft().size() - 1) {
|
||||
|
||||
setTimer(getPlugin().getConfig().getInt("Time-Manager." + getArenaType().getPrefix() + ".Round-Delay"));
|
||||
setArenaInGameState(ArenaInGameState.PLOT_VOTING);
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESSED").asKey().arena(this).sendArena();
|
||||
|
||||
getPlugin().getRewardsHandler().performReward(this,
|
||||
getPlugin().getRewardsHandler().getRewardType("GUESS_ALL"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void broadcastPlayerGuessed(Player player) {
|
||||
|
||||
int bonusAmount = getPlugin().getConfig().getInt("Guessing-Points." + (whoGuessed.size() + 1), 0);
|
||||
int points = currentTheme.getDifficulty().getPointsReward() + bonusAmount;
|
||||
getPlotManager().getPlot(player).addPoints(points);
|
||||
buildPlot.addPoints(getPlugin().getConfig().getInt("Guessing-Points.Builder", 1));
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_GUESSED").asKey().arena(this).player(player)
|
||||
.sendArena();
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_POINTS").asKey().integer(points).arena(this)
|
||||
.player(player).sendPlayer();
|
||||
|
||||
addWhoGuessed(player);
|
||||
Bukkit.getScheduler().runTask(getPlugin(),
|
||||
() -> Bukkit.getPluginManager().callEvent(new PlayerThemeGuessEvent(this, currentTheme)));
|
||||
|
||||
}
|
||||
|
||||
public GuessTheme getCurrentBBTheme() {
|
||||
|
||||
return currentTheme;
|
||||
|
||||
}
|
||||
|
||||
public boolean isCurrentThemeSet() {
|
||||
|
||||
return currentTheme != null;
|
||||
|
||||
}
|
||||
|
||||
public List<Player> getCurrentBuilders() {
|
||||
|
||||
if (buildPlot == null) {
|
||||
|
||||
return new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
return buildPlot.getMembers();
|
||||
|
||||
}
|
||||
|
||||
public Plot getBuildPlot() {
|
||||
|
||||
return buildPlot;
|
||||
|
||||
}
|
||||
|
||||
public void setBuildPlot(Plot buildPlot) {
|
||||
|
||||
this.buildPlot = buildPlot;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getPlayedThemes() {
|
||||
|
||||
return playedThemes;
|
||||
|
||||
}
|
||||
|
||||
public int getRound() {
|
||||
|
||||
return round;
|
||||
|
||||
}
|
||||
|
||||
public void setCurrentTheme(GuessTheme currentTheme) {
|
||||
|
||||
if (currentTheme == null) {
|
||||
|
||||
getPlugin().getDebugger().debug("Arena {0} set Theme null", getId());
|
||||
|
||||
} else {
|
||||
|
||||
getPlugin().getDebugger().debug("Arena {0} set Theme to {1} ({2})", getId(),
|
||||
currentTheme.getThemesAsString(), currentTheme.getDifficulty());
|
||||
|
||||
}
|
||||
|
||||
this.currentTheme = currentTheme;
|
||||
|
||||
}
|
||||
|
||||
public List<Player> getWhoGuessed() {
|
||||
|
||||
return whoGuessed;
|
||||
|
||||
}
|
||||
|
||||
public List<Integer> getRemovedCharsAt() {
|
||||
|
||||
return removedCharsAt;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,33 +26,46 @@ import plugily.projects.minigamesbox.classic.arena.managers.PluginMapRestorerMan
|
||||
|
||||
public class MapRestorerManager extends PluginMapRestorerManager {
|
||||
|
||||
public final BaseArena arena;
|
||||
public final BaseArena arena;
|
||||
|
||||
public MapRestorerManager(BaseArena arena) {
|
||||
super(arena);
|
||||
this.arena = arena;
|
||||
}
|
||||
public MapRestorerManager(BaseArena arena) {
|
||||
|
||||
@Override
|
||||
public void fullyRestoreArena() {
|
||||
arena.cleanUpArena();
|
||||
clearPlots();
|
||||
cancelParticleRefresh();
|
||||
arena.setArenaOption("IN_PLOT_CHECKER", 0);
|
||||
arena.setArenaInGameState(BaseArena.ArenaInGameState.NONE);
|
||||
super.fullyRestoreArena();
|
||||
}
|
||||
super(arena);
|
||||
this.arena = arena;
|
||||
|
||||
private void clearPlots() {
|
||||
for(Plot plot : arena.getPlotManager().getPlots()) {
|
||||
plot.fullyResetPlot();
|
||||
plot.getMembers().clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelParticleRefresh() {
|
||||
if(arena.getParticleRefreshScheduler() != null) {
|
||||
arena.getParticleRefreshScheduler().cancelTask();
|
||||
@Override
|
||||
public void fullyRestoreArena() {
|
||||
|
||||
arena.cleanUpArena();
|
||||
clearPlots();
|
||||
cancelParticleRefresh();
|
||||
arena.setArenaOption("IN_PLOT_CHECKER", 0);
|
||||
arena.setArenaInGameState(BaseArena.ArenaInGameState.NONE);
|
||||
super.fullyRestoreArena();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void clearPlots() {
|
||||
|
||||
for (Plot plot : arena.getPlotManager().getPlots()) {
|
||||
|
||||
plot.fullyResetPlot();
|
||||
plot.getMembers().clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cancelParticleRefresh() {
|
||||
|
||||
if (arena.getParticleRefreshScheduler() != null) {
|
||||
|
||||
arena.getParticleRefreshScheduler().cancelTask();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package plugily.projects.buildbattle.arena.managers;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.handlers.misc.TrueOGBoard;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.managers.BossbarManager;
|
||||
|
||||
// The arena boss bar as a phase timer with true-og.net in its title.
|
||||
public class PhaseBossbarManager extends BossbarManager {
|
||||
|
||||
private static final String SITE = " &8| &e"
|
||||
+ ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', TrueOGBoard.FOOTER));
|
||||
|
||||
private final BaseArena arena;
|
||||
// One bar per arena; every player and spectator watches the same phase.
|
||||
private final BossBar bar;
|
||||
|
||||
public PhaseBossbarManager(BaseArena arena) {
|
||||
|
||||
super(arena);
|
||||
this.arena = arena;
|
||||
this.bar = Bukkit.createBossBar("", BarColor.WHITE, BarStyle.SOLID);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doBarAction(IPluginArena.IBarAction action, Player player) {
|
||||
|
||||
if (!arena.getPlugin().getConfigPreferences().getOption("BOSSBAR")) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (action == IPluginArena.IBarAction.ADD) {
|
||||
|
||||
bar.addPlayer(player);
|
||||
bossBarUpdate();
|
||||
|
||||
} else {
|
||||
|
||||
bar.removePlayer(player);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called once per arena second, after the state handlers have run.
|
||||
@Override
|
||||
public void bossBarUpdate() {
|
||||
|
||||
if (bar.getPlayers().isEmpty()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
bar.setColor(color());
|
||||
bar.setTitle(ChatColor.translateAlternateColorCodes('&', title() + SITE));
|
||||
setProgress(progress());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgress(double progress) {
|
||||
|
||||
bar.setProgress(Math.max(0.0, Math.min(1.0, progress)));
|
||||
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
|
||||
bar.removeAll();
|
||||
|
||||
}
|
||||
|
||||
private String title() {
|
||||
|
||||
final String clock = " &f" + TrueOGBoard.clock(arena.getTimer());
|
||||
switch (arena.getArenaState()) {
|
||||
|
||||
case WAITING_FOR_PLAYERS:
|
||||
return "&eWaiting for players &7(" + arena.getPlayers().size() + "/" + arena.getMinimumPlayers() + ")";
|
||||
case STARTING:
|
||||
case FULL_GAME:
|
||||
return "&aStarting in" + clock;
|
||||
case IN_GAME:
|
||||
return "&6" + phaseName() + clock;
|
||||
case ENDING:
|
||||
return "&cGame over" + clock;
|
||||
case RESTARTING:
|
||||
return "&cRestarting" + clock;
|
||||
default:
|
||||
return "&e" + TrueOGBoard.fit(arena.getMapName(), 32);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Guess The Build reuses the build states for pick, guess and round break.
|
||||
private String phaseName() {
|
||||
|
||||
boolean guess = arena.getArenaType() == BaseArena.ArenaType.GUESS_THE_BUILD;
|
||||
switch (arena.getArenaInGameState()) {
|
||||
|
||||
case THEME_VOTING:
|
||||
return guess ? "Builder picks a theme" : "Theme vote" + round();
|
||||
case BUILD_TIME:
|
||||
return guess ? "Guess the build" : "Building" + round();
|
||||
case PLOT_VOTING:
|
||||
return guess ? "Next round in" : "Plot vote" + round();
|
||||
default:
|
||||
return "Starting";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// " 2/3" for a multi-round Classic or Teams match, otherwise nothing.
|
||||
private String round() {
|
||||
|
||||
if (!(arena instanceof BuildArena) || ((BuildArena) arena).getRounds() <= 1) {
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
BuildArena build = (BuildArena) arena;
|
||||
return " " + build.getRound() + "/" + build.getRounds();
|
||||
|
||||
}
|
||||
|
||||
private BarColor color() {
|
||||
|
||||
IArenaState state = arena.getArenaState();
|
||||
if (state == IArenaState.IN_GAME) {
|
||||
|
||||
switch (arena.getArenaInGameState()) {
|
||||
|
||||
case BUILD_TIME:
|
||||
return BarColor.GREEN;
|
||||
case PLOT_VOTING:
|
||||
return BarColor.BLUE;
|
||||
default:
|
||||
return BarColor.YELLOW;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (state == IArenaState.ENDING || state == IArenaState.RESTARTING) {
|
||||
|
||||
return BarColor.RED;
|
||||
|
||||
}
|
||||
|
||||
return state == IArenaState.WAITING_FOR_PLAYERS ? BarColor.WHITE : BarColor.GREEN;
|
||||
|
||||
}
|
||||
|
||||
// Full while waiting, otherwise the share of the phase still to run.
|
||||
private double progress() {
|
||||
|
||||
if (arena.getArenaState() == IArenaState.WAITING_FOR_PLAYERS) {
|
||||
|
||||
return 1.0;
|
||||
|
||||
}
|
||||
|
||||
int length = arena.getPhaseLength();
|
||||
if (length <= 0) {
|
||||
|
||||
return 1.0;
|
||||
|
||||
}
|
||||
|
||||
return (double) arena.getTimer() / length;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,58 +20,358 @@
|
||||
|
||||
package plugily.projects.buildbattle.arena.managers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.buildbattle.handlers.misc.ScoreboardOGBridge;
|
||||
import plugily.projects.buildbattle.handlers.misc.TrueOGBoard;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.user.IUser;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.managers.PluginScoreboardManager;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>Created at 19.12.2021
|
||||
*/
|
||||
// The arena sidebar in the Scoreboard-OG house style. Lines are built here rather
|
||||
// than read from language.yml so every card fits 1.8 clients and stays branded.
|
||||
public class ScoreboardManager extends PluginScoreboardManager {
|
||||
|
||||
private final PluginArena arena;
|
||||
// Renders the §x hex form MiniGamesBox's colorizer emits.
|
||||
private static final LegacyComponentSerializer SECTION_SERIALIZER = LegacyComponentSerializer.builder()
|
||||
.character('§').hexColors().useUnusualXRepeatedCharacterHexFormat().build();
|
||||
|
||||
public ScoreboardManager(PluginArena arena) {
|
||||
super(arena);
|
||||
this.arena = arena;
|
||||
}
|
||||
private final BaseArena arena;
|
||||
// Players whose sidebar Scoreboard-OG renders for this arena.
|
||||
private final Set<UUID> claimed = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public ScoreboardManager(PluginArena arena) {
|
||||
|
||||
super(arena);
|
||||
this.arena = (BaseArena) arena;
|
||||
|
||||
@Override
|
||||
public List<String> getScoreboardLines(Player player) {
|
||||
List<String> lines;
|
||||
switch(arena.getArenaState()) {
|
||||
case IN_GAME: {
|
||||
if(arena instanceof GuessArena) {
|
||||
lines = arena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + arena.getArenaState().getFormattedName() + ".Guess-The-Build" + (((GuessArena) arena).getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING ? "-Waiting" : ""));
|
||||
} else {
|
||||
if(arena.getArenaOption("PLOT_MEMBER_SIZE") <= 1) {
|
||||
lines = arena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + arena.getArenaState().getFormattedName() + ".Classic");
|
||||
} else {
|
||||
lines = arena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + arena.getArenaState().getFormattedName() + ".Teams");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ENDING: {
|
||||
if(arena instanceof GuessArena) {
|
||||
lines = arena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + arena.getArenaState().getFormattedName() + ".Guess-The-Build");
|
||||
} else {
|
||||
lines = arena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + arena.getArenaState().getFormattedName() + ".Classic");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
lines = super.getScoreboardLines(player);
|
||||
}
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
// With Scoreboard-OG present the arena board rides its sidebar and the network
|
||||
// board returns by itself on leave. Without it the MiniGamesBox board is used.
|
||||
@Override
|
||||
public void createScoreboard(IUser user) {
|
||||
|
||||
Player player = user.getPlayer();
|
||||
if (player == null || !ScoreboardOGBridge.isAvailable()) {
|
||||
|
||||
super.createScoreboard(user);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
claimed.add(player.getUniqueId());
|
||||
ScoreboardOGBridge.claim(player, this::title, this::lines);
|
||||
|
||||
}
|
||||
|
||||
// Scoreboard-OG polls the provider itself, so only the FastBoards need pushing.
|
||||
@Override
|
||||
public void updateScoreboards() {
|
||||
|
||||
if (!ScoreboardOGBridge.isAvailable()) {
|
||||
|
||||
super.updateScoreboards();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeScoreboard(IUser user) {
|
||||
|
||||
Player player = user.getPlayer();
|
||||
if (player != null && claimed.remove(player.getUniqueId())) {
|
||||
|
||||
ScoreboardOGBridge.release(player);
|
||||
|
||||
}
|
||||
|
||||
super.removeScoreboard(user);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAllScoreboards() {
|
||||
|
||||
for (UUID playerId : new ArrayList<>(claimed)) {
|
||||
|
||||
Player player = Bukkit.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
||||
ScoreboardOGBridge.release(player);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
claimed.clear();
|
||||
super.stopAllScoreboards();
|
||||
|
||||
}
|
||||
|
||||
private Component title(Player player) {
|
||||
|
||||
return legacy(TrueOGBoard.TITLE);
|
||||
|
||||
}
|
||||
|
||||
private List<Component> lines(Player player) {
|
||||
|
||||
List<Component> out = new ArrayList<>();
|
||||
for (String line : getScoreboardLines(player)) {
|
||||
|
||||
out.add(legacy(line));
|
||||
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
private static Component legacy(String text) {
|
||||
|
||||
if (text == null || text.isEmpty()) {
|
||||
|
||||
return Component.empty();
|
||||
|
||||
}
|
||||
|
||||
return SECTION_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes('&', text));
|
||||
|
||||
}
|
||||
|
||||
// Top to bottom in the network board's layout: a blank, labelled blocks split
|
||||
// by blanks, then the site footer. Also feeds the FastBoard fallback.
|
||||
@Override
|
||||
public List<String> getScoreboardLines(Player player) {
|
||||
|
||||
List<String> lines = new ArrayList<>();
|
||||
lines.add("");
|
||||
IArenaState state = arena.getArenaState();
|
||||
if (state == IArenaState.IN_GAME) {
|
||||
|
||||
if (arena instanceof GuessArena) {
|
||||
|
||||
addGuessLines(lines, player, (GuessArena) arena);
|
||||
|
||||
} else {
|
||||
|
||||
addBuildLines(lines, player);
|
||||
|
||||
}
|
||||
|
||||
} else if (state == IArenaState.ENDING) {
|
||||
|
||||
addEndingLines(lines);
|
||||
|
||||
} else if (state == IArenaState.RESTARTING) {
|
||||
|
||||
lines.add("&cRestarting...");
|
||||
|
||||
} else {
|
||||
|
||||
addLobbyLines(lines);
|
||||
|
||||
}
|
||||
|
||||
lines.add("");
|
||||
lines.add(TrueOGBoard.FOOTER);
|
||||
return lines;
|
||||
|
||||
}
|
||||
|
||||
private void addLobbyLines(List<String> lines) {
|
||||
|
||||
lines.add("&6Mode:");
|
||||
lines.add("&f" + modeName());
|
||||
lines.add("");
|
||||
lines.add("&eMap:");
|
||||
lines.add("&f" + TrueOGBoard.fit(arena.getMapName(), TrueOGBoard.VALUE_WIDTH));
|
||||
lines.add("");
|
||||
lines.add("&6Players:");
|
||||
lines.add("&f" + arena.getPlayers().size() + "&7/&f" + arena.getMaximumPlayers());
|
||||
lines.add("");
|
||||
lines.add("&6Starting in:");
|
||||
IArenaState state = arena.getArenaState();
|
||||
if (state == IArenaState.STARTING || state == IArenaState.FULL_GAME) {
|
||||
|
||||
lines.add("&f" + TrueOGBoard.clock(arena.getTimer()));
|
||||
|
||||
} else {
|
||||
|
||||
int needed = Math.max(0, arena.getMinimumPlayers() - arena.getPlayers().size());
|
||||
lines.add(needed == 0 ? "&aReady" : "&7Need " + needed + " more");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Classic and Teams: theme, phase and clock, then the player's company.
|
||||
private void addBuildLines(List<String> lines, Player player) {
|
||||
|
||||
lines.add("&eTheme:");
|
||||
lines.add("&f" + TrueOGBoard.fit(theme(player), TrueOGBoard.VALUE_WIDTH));
|
||||
lines.add("");
|
||||
lines.add("&6Phase:");
|
||||
lines.add("&f" + phaseName());
|
||||
lines.add("&6Time: &f" + TrueOGBoard.clock(arena.getTimer()));
|
||||
if (arena instanceof BuildArena && ((BuildArena) arena).getRounds() > 1) {
|
||||
|
||||
BuildArena build = (BuildArena) arena;
|
||||
lines.add("&6Round: &f" + build.getRound() + "/" + build.getRounds());
|
||||
|
||||
}
|
||||
|
||||
lines.add("");
|
||||
|
||||
if (arena.getArenaType() == BaseArena.ArenaType.TEAM) {
|
||||
|
||||
lines.add("&2Teammate:");
|
||||
lines.add("&f" + TrueOGBoard.fit(teammate(player), TrueOGBoard.VALUE_WIDTH));
|
||||
|
||||
} else {
|
||||
|
||||
lines.add("&2Players: &f" + arena.getPlayers().size());
|
||||
|
||||
}
|
||||
|
||||
if (arena.getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING && arena instanceof BuildArena) {
|
||||
|
||||
Plot voting = ((BuildArena) arena).getVotingPlot();
|
||||
lines.add("");
|
||||
lines.add("&eViewing:");
|
||||
lines.add("&f"
|
||||
+ TrueOGBoard.fit(voting == null ? "???" : voting.getFormattedMembers(), TrueOGBoard.VALUE_WIDTH));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Guess The Build: who builds, what the viewer may know, the round clock and
|
||||
// the viewer's points against the leader.
|
||||
private void addGuessLines(List<String> lines, Player player, GuessArena guess) {
|
||||
|
||||
Plot buildPlot = guess.getBuildPlot();
|
||||
lines.add("&6Builder:");
|
||||
lines.add("&f" + TrueOGBoard.fit(
|
||||
buildPlot == null || buildPlot.getMembers().isEmpty() ? "???" : buildPlot.getFormattedMembers(),
|
||||
TrueOGBoard.VALUE_WIDTH));
|
||||
lines.add("");
|
||||
lines.add("&eTheme:");
|
||||
lines.add("&f" + TrueOGBoard.fit(theme(player), TrueOGBoard.VALUE_WIDTH));
|
||||
lines.add("");
|
||||
lines.add("&6Round: &f" + guess.getRound());
|
||||
lines.add("&6Time: &f" + TrueOGBoard.clock(arena.getTimer()));
|
||||
lines.add("");
|
||||
Plot own = arena.getPlotManager().getPlot(player);
|
||||
lines.add("&bPoints: &f" + TrueOGBoard.compact(own == null ? 0 : own.getPoints()));
|
||||
List<Plot> ranking = arena.getPlotManager().getTopPlotsOrder();
|
||||
if (!ranking.isEmpty() && ranking.get(0).getPoints() > 0) {
|
||||
|
||||
lines.add("&6Leader:");
|
||||
lines.add("&f" + TrueOGBoard.fit(ranking.get(0).getFormattedMembers(), TrueOGBoard.VALUE_WIDTH));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addEndingLines(List<String> lines) {
|
||||
|
||||
lines.add("&cGame over!");
|
||||
lines.add("");
|
||||
Plot winner = arena.getWinnerPlot();
|
||||
if (winner == null) {
|
||||
|
||||
List<Plot> ranking = arena.getPlotManager().getTopPlotsOrder();
|
||||
winner = ranking.isEmpty() ? null : ranking.get(0);
|
||||
|
||||
}
|
||||
|
||||
lines.add("&eWinner:");
|
||||
lines.add(
|
||||
"&f" + TrueOGBoard.fit(winner == null ? "???" : winner.getFormattedMembers(), TrueOGBoard.VALUE_WIDTH));
|
||||
lines.add("&bPoints: &f" + TrueOGBoard.compact(winner == null ? 0 : winner.getPoints()));
|
||||
|
||||
}
|
||||
|
||||
private String modeName() {
|
||||
|
||||
switch (arena.getArenaType()) {
|
||||
|
||||
case TEAM:
|
||||
return "Teams";
|
||||
case GUESS_THE_BUILD:
|
||||
return "GuessTheBuild";
|
||||
default:
|
||||
return "Solo";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String phaseName() {
|
||||
|
||||
switch (arena.getArenaInGameState()) {
|
||||
|
||||
case THEME_VOTING:
|
||||
return "Theme vote";
|
||||
case PLOT_VOTING:
|
||||
return "Plot vote";
|
||||
case BUILD_TIME:
|
||||
return "Building";
|
||||
default:
|
||||
return "Starting";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The arena placeholder hides the theme from Guess The Build guessers.
|
||||
private String theme(Player player) {
|
||||
|
||||
String theme = new MessageBuilder("%arena_theme%").arena(arena).player(player).build();
|
||||
return theme == null || theme.isEmpty() ? "???" : ChatColor.stripColor(theme);
|
||||
|
||||
}
|
||||
|
||||
private String teammate(Player player) {
|
||||
|
||||
Plot plot = arena.getPlotFromPlayer(player);
|
||||
if (plot == null) {
|
||||
|
||||
return "Nobody";
|
||||
|
||||
}
|
||||
|
||||
for (Player member : plot.getMembers()) {
|
||||
|
||||
if (!member.equals(player)) {
|
||||
|
||||
return member.getName();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "Nobody";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,320 +50,489 @@ import java.util.Map;
|
||||
*/
|
||||
public class Plot {
|
||||
|
||||
private final Map<Location, String> particles = new HashMap<>();
|
||||
private final XMaterial defaultFloor;
|
||||
private final Map<Location, String> particles = new HashMap<>();
|
||||
private final XMaterial defaultFloor;
|
||||
|
||||
private final BaseArena arena;
|
||||
private Cuboid cuboid;
|
||||
private int points = 0;
|
||||
private List<Player> members = new ArrayList<>();
|
||||
private Time time = Time.WORLD_TIME;
|
||||
private final Biome plotDefaultBiome;
|
||||
private WeatherType weatherType = WeatherType.CLEAR;
|
||||
private int entities = 0;
|
||||
private final BaseArena arena;
|
||||
private Cuboid cuboid;
|
||||
private int points = 0;
|
||||
// Points from the round being judged; guards against double counting.
|
||||
private int roundPoints = 0;
|
||||
private List<Player> members = new ArrayList<>();
|
||||
private Time time = Time.WORLD_TIME;
|
||||
private final Biome plotDefaultBiome;
|
||||
private WeatherType weatherType = WeatherType.CLEAR;
|
||||
private int entities = 0;
|
||||
|
||||
public Plot(BaseArena arena, Biome biome) {
|
||||
this.arena = arena;
|
||||
plotDefaultBiome = biome;
|
||||
defaultFloor = XMaterial.matchXMaterial(arena.getPlugin().getConfig().getString("Floor.Material", "LOG")
|
||||
.toUpperCase(java.util.Locale.ENGLISH)).orElse(XMaterial.OAK_LOG);
|
||||
}
|
||||
public Plot(BaseArena arena, Biome biome) {
|
||||
|
||||
public int getEntities() {
|
||||
return entities;
|
||||
}
|
||||
this.arena = arena;
|
||||
plotDefaultBiome = biome;
|
||||
defaultFloor = XMaterial.matchXMaterial(
|
||||
arena.getPlugin().getConfig().getString("Floor.Material", "LOG").toUpperCase(java.util.Locale.ENGLISH))
|
||||
.orElse(XMaterial.OAK_LOG);
|
||||
|
||||
public void addEntity() {
|
||||
entities++;
|
||||
}
|
||||
|
||||
public void removeEntity() {
|
||||
if(entities > 0) {
|
||||
entities--;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Location, String> getParticles() {
|
||||
return particles;
|
||||
}
|
||||
|
||||
public Biome getPlotDefaultBiome() {
|
||||
return plotDefaultBiome;
|
||||
}
|
||||
|
||||
public WeatherType getWeatherType() {
|
||||
return weatherType;
|
||||
}
|
||||
|
||||
public void setWeatherType(WeatherType weatherType) {
|
||||
if(weatherType != null) {
|
||||
this.weatherType = weatherType;
|
||||
}
|
||||
}
|
||||
|
||||
public Time getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Time time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public Cuboid getCuboid() {
|
||||
return cuboid;
|
||||
}
|
||||
|
||||
public void setCuboid(Cuboid cuboid) {
|
||||
this.cuboid = cuboid;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Player> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getFormattedMembers() {
|
||||
if(!members.isEmpty()) {
|
||||
StringBuilder member = new StringBuilder();
|
||||
members.forEach(player -> member.append(player.getName()).append(" & "));
|
||||
return member.substring(0, member.length() - 3);
|
||||
}
|
||||
|
||||
return "PLAYER_NOT_FOUND";
|
||||
}
|
||||
public int getEntities() {
|
||||
|
||||
public int getMembersSize() {
|
||||
return members.size();
|
||||
}
|
||||
return entities;
|
||||
|
||||
public boolean addMember(Player player, BaseArena playerArena, boolean silent) {
|
||||
if(playerArena == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(members.contains(player)) {
|
||||
if(!silent)
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_MEMBER").asKey().arena(arena).player(player).sendPlayer();
|
||||
return false;
|
||||
public void addEntity() {
|
||||
|
||||
entities++;
|
||||
|
||||
}
|
||||
|
||||
if(members.size() >= arena.getArenaOption("PLOT_MEMBER_SIZE")) {
|
||||
if(!silent)
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_FULL").asKey().prefix().arena(arena).player(player).sendPlayer();
|
||||
return false;
|
||||
}
|
||||
public void removeEntity() {
|
||||
|
||||
Plot plot = playerArena.getPlotManager().getPlot(player);
|
||||
if(plot != null) {
|
||||
plot.removeMember(player);
|
||||
}
|
||||
members.add(player);
|
||||
return true;
|
||||
}
|
||||
if (entities > 0) {
|
||||
|
||||
public void removeMember(Player player) {
|
||||
members.remove(player);
|
||||
}
|
||||
entities--;
|
||||
|
||||
public void fullyResetPlot() {
|
||||
resetPlot();
|
||||
points = 0;
|
||||
members.clear();
|
||||
particles.clear();
|
||||
}
|
||||
|
||||
public void resetPlot() {
|
||||
if(cuboid == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(Block block : cuboid.blockList()) {
|
||||
//to ensure 1.14 blocks support (that will be seen as air in api-version 1.13)
|
||||
//we set all blocks to air so 1.14 ones will update too
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
particles.clear();
|
||||
|
||||
for(Player p : members) {
|
||||
p.resetPlayerWeather();
|
||||
setWeatherType(p.getPlayerWeather());
|
||||
p.resetPlayerTime();
|
||||
}
|
||||
|
||||
World centerWorld = cuboid.getCenter().getWorld();
|
||||
|
||||
if(centerWorld != null) {
|
||||
boolean isCitizensEnabled = arena.getPlugin().getServer().getPluginManager().isPluginEnabled("Citizens");
|
||||
|
||||
for(Entity entity : centerWorld.getEntities()) {
|
||||
if(cuboid.isInWithMarge(entity.getLocation(), 5)) {
|
||||
//deprecated seems not to work with latest builds of citizens
|
||||
if(isCitizensEnabled && CitizensAPI.getNPCRegistry() != null && CitizensAPI.getNPCRegistry().isNPC(entity)) {
|
||||
continue;
|
||||
}
|
||||
//citizens also uses metadata, see https://wiki.citizensnpcs.co/API
|
||||
if(entity.hasMetadata("NPC")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(entity.getType() != EntityType.PLAYER) {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for(Block block : cuboid.blockList()) {
|
||||
block.setBiome(plotDefaultBiome);
|
||||
public Map<Location, String> getParticles() {
|
||||
|
||||
return particles;
|
||||
|
||||
}
|
||||
|
||||
for(Chunk chunk : cuboid.chunkList()) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
continue;
|
||||
}
|
||||
public Biome getPlotDefaultBiome() {
|
||||
|
||||
return plotDefaultBiome;
|
||||
|
||||
}
|
||||
|
||||
public WeatherType getWeatherType() {
|
||||
|
||||
return weatherType;
|
||||
|
||||
}
|
||||
|
||||
public void setWeatherType(WeatherType weatherType) {
|
||||
|
||||
if (weatherType != null) {
|
||||
|
||||
this.weatherType = weatherType;
|
||||
|
||||
for(Player p : arena.getPlugin().getServer().getOnlinePlayers()) {
|
||||
if(p.getWorld().equals(chunk.getWorld())) {
|
||||
ChunkManager.sendMapChunk(p, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
changeFloor(defaultFloor.parseMaterial());
|
||||
public Time getTime() {
|
||||
|
||||
return time;
|
||||
|
||||
}
|
||||
|
||||
public void setTime(Time time) {
|
||||
|
||||
this.time = time;
|
||||
|
||||
}
|
||||
|
||||
public Cuboid getCuboid() {
|
||||
|
||||
return cuboid;
|
||||
|
||||
}
|
||||
|
||||
public void setCuboid(Cuboid cuboid) {
|
||||
|
||||
this.cuboid = cuboid;
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Player> getMembers() {
|
||||
|
||||
return members;
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getFormattedMembers() {
|
||||
|
||||
if (!members.isEmpty()) {
|
||||
|
||||
StringBuilder member = new StringBuilder();
|
||||
members.forEach(player -> member.append(player.getName()).append(" & "));
|
||||
return member.substring(0, member.length() - 3);
|
||||
|
||||
}
|
||||
|
||||
return "PLAYER_NOT_FOUND";
|
||||
|
||||
}
|
||||
|
||||
public int getMembersSize() {
|
||||
|
||||
return members.size();
|
||||
|
||||
}
|
||||
|
||||
public boolean addMember(Player player, BaseArena playerArena, boolean silent) {
|
||||
|
||||
if (playerArena == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (members.contains(player)) {
|
||||
|
||||
if (!silent)
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_MEMBER").asKey().arena(arena).player(player)
|
||||
.sendPlayer();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (members.size() >= arena.getArenaOption("PLOT_MEMBER_SIZE")) {
|
||||
|
||||
if (!silent)
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_FULL").asKey().prefix().arena(arena).player(player)
|
||||
.sendPlayer();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = playerArena.getPlotManager().getPlot(player);
|
||||
if (plot != null) {
|
||||
|
||||
plot.removeMember(player);
|
||||
|
||||
}
|
||||
|
||||
members.add(player);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void removeMember(Player player) {
|
||||
|
||||
members.remove(player);
|
||||
|
||||
}
|
||||
|
||||
public void fullyResetPlot() {
|
||||
|
||||
resetPlot();
|
||||
points = 0;
|
||||
roundPoints = 0;
|
||||
members.clear();
|
||||
particles.clear();
|
||||
|
||||
}
|
||||
|
||||
public void resetPlot() {
|
||||
|
||||
if (cuboid == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (Block block : cuboid.blockList()) {
|
||||
|
||||
// to ensure 1.14 blocks support (that will be seen as air in api-version 1.13)
|
||||
// we set all blocks to air so 1.14 ones will update too
|
||||
block.setType(Material.AIR);
|
||||
|
||||
}
|
||||
|
||||
particles.clear();
|
||||
|
||||
for (Player p : members) {
|
||||
|
||||
p.setPlayerWeather(WeatherType.CLEAR);
|
||||
p.resetPlayerTime();
|
||||
|
||||
}
|
||||
|
||||
setTime(Time.WORLD_TIME);
|
||||
setWeatherType(WeatherType.CLEAR);
|
||||
|
||||
World centerWorld = cuboid.getCenter().getWorld();
|
||||
|
||||
if (centerWorld != null) {
|
||||
|
||||
boolean isCitizensEnabled = arena.getPlugin().getServer().getPluginManager().isPluginEnabled("Citizens");
|
||||
|
||||
for (Entity entity : centerWorld.getEntities()) {
|
||||
|
||||
if (cuboid.isInWithMarge(entity.getLocation(), 5)) {
|
||||
|
||||
// deprecated seems not to work with latest builds of citizens
|
||||
if (isCitizensEnabled && CitizensAPI.getNPCRegistry() != null
|
||||
&& CitizensAPI.getNPCRegistry().isNPC(entity))
|
||||
{
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
// citizens also uses metadata, see https://wiki.citizensnpcs.co/API
|
||||
if (entity.hasMetadata("NPC")) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (entity.getType() != EntityType.PLAYER) {
|
||||
|
||||
entity.remove();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Block block : cuboid.blockList()) {
|
||||
|
||||
block.setBiome(plotDefaultBiome);
|
||||
|
||||
}
|
||||
|
||||
for (Chunk chunk : cuboid.chunkList()) {
|
||||
|
||||
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
|
||||
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (Player p : arena.getPlugin().getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getWorld().equals(chunk.getWorld())) {
|
||||
|
||||
ChunkManager.sendMapChunk(p, chunk);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
changeFloor(defaultFloor.parseMaterial());
|
||||
|
||||
if (centerWorld != null) {
|
||||
|
||||
if (ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15)) {
|
||||
|
||||
Location min = cuboid.getMinPoint();
|
||||
Location max = cuboid.getMaxPoint();
|
||||
|
||||
centerWorld.setBiome(min.getBlockX(), Math.min(min.getBlockY(), max.getBlockY()), max.getBlockZ(),
|
||||
plotDefaultBiome);
|
||||
|
||||
} else {
|
||||
|
||||
centerWorld.setBiome(cuboid.getMinPoint().getBlockX(), cuboid.getMaxPoint().getBlockZ(),
|
||||
plotDefaultBiome);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
arena.getPlugin().getServer().getPluginManager().callEvent(new PlotResetEvent(arena, this));
|
||||
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
|
||||
return points;
|
||||
|
||||
}
|
||||
|
||||
public void setPoints(int points) {
|
||||
|
||||
this.points = points;
|
||||
|
||||
}
|
||||
|
||||
public void addPoints(int points) {
|
||||
|
||||
this.points += points;
|
||||
roundPoints += points;
|
||||
|
||||
}
|
||||
|
||||
public int getRoundPoints() {
|
||||
|
||||
return roundPoints;
|
||||
|
||||
}
|
||||
|
||||
// Match points stay; the next round's plot vote starts from zero.
|
||||
public void resetRoundPoints() {
|
||||
|
||||
roundPoints = 0;
|
||||
|
||||
}
|
||||
|
||||
private void changeFloor(Material material) {
|
||||
|
||||
if(centerWorld != null) {
|
||||
if(ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15)) {
|
||||
Location min = cuboid.getMinPoint();
|
||||
Location max = cuboid.getMaxPoint();
|
||||
|
||||
centerWorld.setBiome(min.getBlockX(), Math.min(min.getBlockY(), max.getBlockY()), max.getBlockZ(), plotDefaultBiome);
|
||||
} else {
|
||||
centerWorld.setBiome(cuboid.getMinPoint().getBlockX(), cuboid.getMaxPoint().getBlockZ(), plotDefaultBiome);
|
||||
}
|
||||
}
|
||||
int y = (int) Math.min(min.getY(), max.getY());
|
||||
|
||||
arena.getPlugin().getServer().getPluginManager().callEvent(new PlotResetEvent(arena, this));
|
||||
}
|
||||
int minBlockX = min.getBlockX();
|
||||
int maxBlockX = max.getBlockX();
|
||||
|
||||
public int getPoints() {
|
||||
return points;
|
||||
}
|
||||
int minBlockZ = min.getBlockZ();
|
||||
int maxBlockZ = max.getBlockZ();
|
||||
|
||||
public void setPoints(int points) {
|
||||
this.points = points;
|
||||
}
|
||||
World maxWorld = max.getWorld();
|
||||
|
||||
public void addPoints(int points) {
|
||||
this.points += points;
|
||||
}
|
||||
for (int x = minBlockX; x <= maxBlockX; x++) {
|
||||
|
||||
private void changeFloor(Material material) {
|
||||
Location min = cuboid.getMinPoint();
|
||||
Location max = cuboid.getMaxPoint();
|
||||
for (int z = minBlockZ; z <= maxBlockZ; z++) {
|
||||
|
||||
int y = (int) Math.min(min.getY(), max.getY());
|
||||
maxWorld.getBlockAt(x, y, z).setType(material);
|
||||
|
||||
int minBlockX = min.getBlockX();
|
||||
int maxBlockX = max.getBlockX();
|
||||
}
|
||||
|
||||
int minBlockZ = min.getBlockZ();
|
||||
int maxBlockZ = max.getBlockZ();
|
||||
|
||||
World maxWorld = max.getWorld();
|
||||
|
||||
for(int x = minBlockX; x <= maxBlockX; x++) {
|
||||
for(int z = minBlockZ; z <= maxBlockZ; z++) {
|
||||
maxWorld.getBlockAt(x, y, z).setType(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void changeFloor(Material material, byte data) {
|
||||
if(material == Material.WATER_BUCKET || material == Material.MILK_BUCKET) {
|
||||
material = Material.WATER;
|
||||
}
|
||||
if(material == Material.LAVA_BUCKET) {
|
||||
material = Material.LAVA;
|
||||
}
|
||||
|
||||
Location min = cuboid.getMinPoint();
|
||||
Location max = cuboid.getMaxPoint();
|
||||
|
||||
int y = (int) Math.min(min.getY(), max.getY());
|
||||
|
||||
int minBlockX = min.getBlockX();
|
||||
int maxBlockX = max.getBlockX();
|
||||
|
||||
int minBlockZ = min.getBlockZ();
|
||||
int maxBlockZ = max.getBlockZ();
|
||||
|
||||
World maxWorld = max.getWorld();
|
||||
|
||||
for(int x = minBlockX; x <= maxBlockX; x++) {
|
||||
for(int z = minBlockZ; z <= maxBlockZ; z++) {
|
||||
Block block = maxWorld.getBlockAt(x, y, z);
|
||||
block.setType(material);
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
try {
|
||||
Block.class.getMethod("setData", byte.class).invoke(block, data);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Location getTeleportLocation() {
|
||||
Location tploc = cuboid.getCenter();
|
||||
while(tploc.getBlock().getType() != Material.AIR || tploc.add(0, 1, 0).getBlock().getType() != Material.AIR) {
|
||||
tploc = tploc.add(0, 1, 0);
|
||||
}
|
||||
boolean enclosed = false;
|
||||
int counter = 0;
|
||||
Location location = tploc.clone();
|
||||
while(counter != 10) {
|
||||
Material type = location.getBlock().getType();
|
||||
|
||||
if(!(type == Material.BARRIER || type == Material.AIR)) {
|
||||
enclosed = true;
|
||||
tploc = location;
|
||||
counter = 9;
|
||||
}
|
||||
location.add(0, 1, 0);
|
||||
counter++;
|
||||
}
|
||||
if(enclosed) {
|
||||
while(tploc.getBlock().getType() != Material.AIR || tploc.add(0, 1, 0).getBlock().getType() != Material.AIR) {
|
||||
tploc = tploc.add(0, 1, 0);
|
||||
}
|
||||
}
|
||||
return tploc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum that represents current plot time
|
||||
*/
|
||||
public enum Time {
|
||||
WORLD_TIME(-1), DAY(1000), NOON(6000), SUNSET(12000), SUNRISE(23000), NIGHT(13000), MIDNIGHT(18000);
|
||||
|
||||
private final long ticks;
|
||||
|
||||
Time(long ticks) {
|
||||
this.ticks = ticks;
|
||||
}
|
||||
|
||||
public static long format(Time time, long currTime) {
|
||||
return time == Time.WORLD_TIME ? currTime : time.ticks;
|
||||
public void changeFloor(Material material, byte data) {
|
||||
|
||||
if (material == Material.WATER_BUCKET || material == Material.MILK_BUCKET) {
|
||||
|
||||
material = Material.WATER;
|
||||
|
||||
}
|
||||
|
||||
if (material == Material.LAVA_BUCKET) {
|
||||
|
||||
material = Material.LAVA;
|
||||
|
||||
}
|
||||
|
||||
Location min = cuboid.getMinPoint();
|
||||
Location max = cuboid.getMaxPoint();
|
||||
|
||||
int y = (int) Math.min(min.getY(), max.getY());
|
||||
|
||||
int minBlockX = min.getBlockX();
|
||||
int maxBlockX = max.getBlockX();
|
||||
|
||||
int minBlockZ = min.getBlockZ();
|
||||
int maxBlockZ = max.getBlockZ();
|
||||
|
||||
World maxWorld = max.getWorld();
|
||||
|
||||
for (int x = minBlockX; x <= maxBlockX; x++) {
|
||||
|
||||
for (int z = minBlockZ; z <= maxBlockZ; z++) {
|
||||
|
||||
Block block = maxWorld.getBlockAt(x, y, z);
|
||||
block.setType(material);
|
||||
|
||||
if (ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
|
||||
try {
|
||||
|
||||
Block.class.getMethod("setData", byte.class).invoke(block, data);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public long getTicks() {
|
||||
return ticks;
|
||||
public Location getTeleportLocation() {
|
||||
|
||||
Location tploc = cuboid.getCenter();
|
||||
while (tploc.getBlock().getType() != Material.AIR || tploc.add(0, 1, 0).getBlock().getType() != Material.AIR) {
|
||||
|
||||
tploc = tploc.add(0, 1, 0);
|
||||
|
||||
}
|
||||
|
||||
boolean enclosed = false;
|
||||
int counter = 0;
|
||||
Location location = tploc.clone();
|
||||
while (counter != 10) {
|
||||
|
||||
Material type = location.getBlock().getType();
|
||||
|
||||
if (!(type == Material.BARRIER || type == Material.AIR)) {
|
||||
|
||||
enclosed = true;
|
||||
tploc = location;
|
||||
counter = 9;
|
||||
|
||||
}
|
||||
|
||||
location.add(0, 1, 0);
|
||||
counter++;
|
||||
|
||||
}
|
||||
|
||||
if (enclosed) {
|
||||
|
||||
while (tploc.getBlock().getType() != Material.AIR
|
||||
|| tploc.add(0, 1, 0).getBlock().getType() != Material.AIR)
|
||||
{
|
||||
|
||||
tploc = tploc.add(0, 1, 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return tploc;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum that represents current plot time
|
||||
*/
|
||||
public enum Time {
|
||||
|
||||
WORLD_TIME(-1), DAY(1000), NOON(6000), SUNSET(12000), SUNRISE(23000), NIGHT(13000), MIDNIGHT(18000);
|
||||
|
||||
private final long ticks;
|
||||
|
||||
Time(long ticks) {
|
||||
|
||||
this.ticks = ticks;
|
||||
|
||||
}
|
||||
|
||||
public static long format(Time time, long currTime) {
|
||||
|
||||
return time == Time.WORLD_TIME ? currTime : time.ticks;
|
||||
|
||||
}
|
||||
|
||||
public long getTicks() {
|
||||
|
||||
return ticks;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+622
@@ -0,0 +1,622 @@
|
||||
/*
|
||||
* Derived from the EternalCombat (https://github.com/EternalCodeTeam/EternalCombat) border module
|
||||
* by the EternalCode Team, licensed under the Apache License, Version 2.0, by way of the
|
||||
* Duels-OG adaptation by the TrueOG Network.
|
||||
*
|
||||
* Modifications by the TrueOG Network for BuildBattle-OG:
|
||||
* - The legal area is a plot cuboid grown by a grace margin and the wall is the one-block
|
||||
* shell just outside it on all six faces, instead of the inner face of a PvP region.
|
||||
* - Blocks are sent with Paper's Player#sendMultiBlockChange instead of PacketEvents and
|
||||
* restored from the live world instead of a chunk-snapshot cache.
|
||||
* - EternalCombat's rainbow hue function is kept and mapped onto Bukkit materials.
|
||||
* - A builder found past the wall is pulled to the nearest legal spot at their own height,
|
||||
* or to the plot spawn when that is blocked, in place of the region eject.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*/
|
||||
|
||||
package plugily.projects.buildbattle.arena.managers.plots;
|
||||
|
||||
import io.papermc.paper.math.BlockPosition;
|
||||
import io.papermc.paper.math.Position;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.dimensional.Cuboid;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
// Per-viewer wall around the plot being built in, and the pull-back past it.
|
||||
public class PlotBorderManager implements Listener {
|
||||
|
||||
private static final long UPDATE_TICKS = 10L;
|
||||
private static final String RAINBOW_PREFIX = "RAINBOW_";
|
||||
|
||||
private final Main plugin;
|
||||
private final int grace;
|
||||
private final int distance;
|
||||
private final boolean wallEnabled;
|
||||
// Null for a rainbow wall; otherwise the block every wall point shows.
|
||||
private BlockData fixedBlock;
|
||||
// Rainbow palette: one stained block per dye colour.
|
||||
private final Map<DyeColor, BlockData> palette = new EnumMap<>(DyeColor.class);
|
||||
private final Map<UUID, Shown> shown = new HashMap<>();
|
||||
|
||||
public PlotBorderManager(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
FileConfiguration config = plugin.getConfig();
|
||||
grace = Math.max(0, config.getInt("Plot.Border.Grace", 3));
|
||||
distance = Math.max(1, config.getInt("Plot.Border.Distance", 8));
|
||||
wallEnabled = config.getBoolean("Plot.Border.Enabled", true)
|
||||
&& resolveBlock(config.getString("Plot.Border.Block", "RAINBOW_GLASS"));
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
plugin.getServer().getScheduler().runTaskTimer(plugin, this::refreshAll, UPDATE_TICKS, UPDATE_TICKS);
|
||||
|
||||
}
|
||||
|
||||
// RAINBOW_<FAMILY> builds a dye palette; anything else is a block name.
|
||||
private boolean resolveBlock(String name) {
|
||||
|
||||
String upper = name.toUpperCase(Locale.ROOT);
|
||||
if (upper.startsWith(RAINBOW_PREFIX)) {
|
||||
|
||||
String family = upper.substring(RAINBOW_PREFIX.length());
|
||||
String suffix = family.equals("GLASS") ? "_STAINED_GLASS" : "_" + family;
|
||||
for (DyeColor dye : DyeColor.values()) {
|
||||
|
||||
Material material = Material.matchMaterial(dye.name() + suffix);
|
||||
if (material == null || !material.isBlock()) {
|
||||
|
||||
plugin.getLogger().warning(
|
||||
"Plot.Border.Block " + name + " has no " + dye.name() + suffix + "; wall disabled.");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
palette.put(dye, material.createBlockData());
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Material material = Material.matchMaterial(upper);
|
||||
if (material == null || !material.isBlock()) {
|
||||
|
||||
plugin.getLogger().warning("Plot.Border.Block " + name + " is not a block; wall disabled.");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
fixedBlock = material.createBlockData();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// A move ending outside the legal box is snapped back; otherwise redraw.
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onMove(PlayerMoveEvent event) {
|
||||
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo();
|
||||
if (to == null || (from.getBlockX() == to.getBlockX() && from.getBlockY() == to.getBlockY()
|
||||
&& from.getBlockZ() == to.getBlockZ()))
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Confinement confinement = confinementOf(player);
|
||||
if (confinement == null) {
|
||||
|
||||
clear(player);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!confinement.box.contains(to)) {
|
||||
|
||||
if (confinement.box.contains(from)) {
|
||||
|
||||
// The wall failed; cancelling puts them back where they were.
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
pullBack(player, confinement);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
update(player, confinement, to);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onTeleport(PlayerTeleportEvent event) {
|
||||
|
||||
Location to = event.getTo();
|
||||
if (to == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Confinement confinement = confinementOf(player);
|
||||
if (confinement == null || !to.getWorld().equals(confinement.world)) {
|
||||
|
||||
clear(player);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
update(player, confinement, to);
|
||||
|
||||
}
|
||||
|
||||
// A world change resends chunks, so the client already lost the wall.
|
||||
@EventHandler
|
||||
public void onWorldChange(PlayerChangedWorldEvent event) {
|
||||
|
||||
shown.remove(event.getPlayer().getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent event) {
|
||||
|
||||
shown.remove(event.getPlayer().getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
// The three-second arena check: anyone beyond the wall is brought back.
|
||||
public void enforce(Player player) {
|
||||
|
||||
Confinement confinement = confinementOf(player);
|
||||
if (confinement == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Location at = player.getLocation();
|
||||
if (!at.getWorld().equals(confinement.world) || !confinement.box.contains(at)) {
|
||||
|
||||
pullBack(player, confinement);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Restores every wall still on a client; used on disable.
|
||||
public void clearAll() {
|
||||
|
||||
for (UUID uuid : new HashSet<>(shown.keySet())) {
|
||||
|
||||
Player player = plugin.getServer().getPlayer(uuid);
|
||||
if (player != null) {
|
||||
|
||||
clear(player);
|
||||
|
||||
} else {
|
||||
|
||||
shown.remove(uuid);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void refreshAll() {
|
||||
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
|
||||
Confinement confinement = confinementOf(player);
|
||||
if (confinement == null) {
|
||||
|
||||
clear(player);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
Location at = player.getLocation();
|
||||
if (!at.getWorld().equals(confinement.world)) {
|
||||
|
||||
clear(player);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
update(player, confinement, at);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The plot a player is held to right now, or null while they may roam.
|
||||
private Confinement confinementOf(Player player) {
|
||||
|
||||
if (plugin.getConfigPreferences().getOption("PLOT_MOVE_OUTSIDE")) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if (arena == null || arena.getArenaState() != IArenaState.IN_GAME
|
||||
|| arena.getArenaInGameState() != BaseArena.ArenaInGameState.BUILD_TIME
|
||||
|| !arena.getPlayersLeft().contains(player))
|
||||
{
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = arena instanceof GuessArena ? ((GuessArena) arena).getBuildPlot() : arena.getPlotFromPlayer(player);
|
||||
if (plot == null || plot.getCuboid() == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
Cuboid cuboid = plot.getCuboid();
|
||||
Location min = cuboid.getMinPoint();
|
||||
Location max = cuboid.getMaxPoint();
|
||||
if (min.getWorld() == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
Box box = new Box(min.getBlockX() - grace, min.getBlockY() - grace, min.getBlockZ() - grace,
|
||||
max.getBlockX() + grace, max.getBlockY() + grace, max.getBlockZ() + grace);
|
||||
return new Confinement(arena, plot, min.getWorld(), box);
|
||||
|
||||
}
|
||||
|
||||
// Sends nearby wall points and restores the ones left behind.
|
||||
private void update(Player player, Confinement confinement, Location at) {
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
Set<BlockPosition> next = wallEnabled ? wallPoints(confinement, at) : Collections.emptySet();
|
||||
Shown current = shown.get(uuid);
|
||||
Map<Position, BlockData> changes = new HashMap<>();
|
||||
if (current != null) {
|
||||
|
||||
for (BlockPosition point : current.points) {
|
||||
|
||||
if (!next.contains(point)) {
|
||||
|
||||
changes.put(point, restoreData(current.world, point));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (BlockPosition point : next) {
|
||||
|
||||
changes.put(point, wallData(point));
|
||||
|
||||
}
|
||||
|
||||
if (!changes.isEmpty()) {
|
||||
|
||||
player.sendMultiBlockChange(changes);
|
||||
|
||||
}
|
||||
|
||||
if (next.isEmpty()) {
|
||||
|
||||
shown.remove(uuid);
|
||||
|
||||
} else {
|
||||
|
||||
shown.put(uuid, new Shown(confinement.world, next));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void clear(Player player) {
|
||||
|
||||
Shown current = shown.remove(player.getUniqueId());
|
||||
if (current == null || !player.getWorld().equals(current.world)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Map<Position, BlockData> changes = new HashMap<>();
|
||||
for (BlockPosition point : current.points) {
|
||||
|
||||
changes.put(point, restoreData(current.world, point));
|
||||
|
||||
}
|
||||
|
||||
player.sendMultiBlockChange(changes);
|
||||
|
||||
}
|
||||
|
||||
// The shell just outside the legal box, clipped to the view range.
|
||||
private Set<BlockPosition> wallPoints(Confinement confinement, Location at) {
|
||||
|
||||
Box box = confinement.box;
|
||||
int px = at.getBlockX();
|
||||
int py = at.getBlockY();
|
||||
int pz = at.getBlockZ();
|
||||
int x0 = Math.max(box.minX - 1, px - distance);
|
||||
int x1 = Math.min(box.maxX + 1, px + distance);
|
||||
int y0 = Math.max(box.minY - 1, py - distance);
|
||||
int y1 = Math.min(box.maxY + 1, py + distance);
|
||||
int z0 = Math.max(box.minZ - 1, pz - distance);
|
||||
int z1 = Math.min(box.maxZ + 1, pz + distance);
|
||||
Set<BlockPosition> points = new HashSet<>();
|
||||
if (x0 > x1 || y0 > y1 || z0 > z1) {
|
||||
|
||||
return points;
|
||||
|
||||
}
|
||||
|
||||
for (int x : new int[] { box.minX - 1, box.maxX + 1 }) {
|
||||
|
||||
if (x < x0 || x > x1) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (int y = y0; y <= y1; y++) {
|
||||
|
||||
for (int z = z0; z <= z1; z++) {
|
||||
|
||||
addPoint(points, confinement.world, at, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int y : new int[] { box.minY - 1, box.maxY + 1 }) {
|
||||
|
||||
if (y < y0 || y > y1) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (int x = x0; x <= x1; x++) {
|
||||
|
||||
for (int z = z0; z <= z1; z++) {
|
||||
|
||||
addPoint(points, confinement.world, at, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int z : new int[] { box.minZ - 1, box.maxZ + 1 }) {
|
||||
|
||||
if (z < z0 || z > z1) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (int x = x0; x <= x1; x++) {
|
||||
|
||||
for (int y = y0; y <= y1; y++) {
|
||||
|
||||
addPoint(points, confinement.world, at, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return points;
|
||||
|
||||
}
|
||||
|
||||
// Only non-solid blocks in range become wall; real blocks stay.
|
||||
private void addPoint(Set<BlockPosition> points, World world, Location at, int x, int y, int z) {
|
||||
|
||||
double dx = x + 0.5 - at.getX();
|
||||
double dy = y + 0.5 - at.getY();
|
||||
double dz = z + 0.5 - at.getZ();
|
||||
if (dx * dx + dy * dy + dz * dz > (double) distance * distance) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (world.getBlockAt(x, y, z).getType().isSolid()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
points.add(Position.block(x, y, z));
|
||||
|
||||
}
|
||||
|
||||
private BlockData wallData(BlockPosition point) {
|
||||
|
||||
if (fixedBlock != null) {
|
||||
|
||||
return fixedBlock;
|
||||
|
||||
}
|
||||
|
||||
return palette.get(nearestDye(rainbow(point.blockX(), point.blockY(), point.blockZ())));
|
||||
|
||||
}
|
||||
|
||||
private static BlockData restoreData(World world, BlockPosition point) {
|
||||
|
||||
return world.getBlockAt(point.blockX(), point.blockY(), point.blockZ()).getBlockData();
|
||||
|
||||
}
|
||||
|
||||
// EternalCombat's hue: a slow sine over x and z, brighter with height.
|
||||
private static Color rainbow(int x, int y, int z) {
|
||||
|
||||
float hue = (float) ((Math.sin(x * 0.05) + Math.cos(z * 0.05)) * 0.5 + 0.5);
|
||||
float brightness = 0.8f + 0.2f * Math.max(0.0f, Math.min(1.0f, (float) y / 255));
|
||||
return Color.getHSBColor(hue, 1.0f, brightness);
|
||||
|
||||
}
|
||||
|
||||
private static DyeColor nearestDye(Color rgb) {
|
||||
|
||||
int best = Integer.MAX_VALUE;
|
||||
DyeColor dye = DyeColor.WHITE;
|
||||
for (DyeColor candidate : DyeColor.values()) {
|
||||
|
||||
org.bukkit.Color color = candidate.getColor();
|
||||
int delta = Math.abs(color.getRed() - rgb.getRed()) + Math.abs(color.getGreen() - rgb.getGreen())
|
||||
+ Math.abs(color.getBlue() - rgb.getBlue());
|
||||
if (delta < best) {
|
||||
|
||||
best = delta;
|
||||
dye = candidate;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return dye;
|
||||
|
||||
}
|
||||
|
||||
// Nearest legal spot at the player's height, or the plot spawn if blocked.
|
||||
private void pullBack(Player player, Confinement confinement) {
|
||||
|
||||
Box box = confinement.box;
|
||||
Location at = player.getLocation();
|
||||
double x = Math.min(Math.max(at.getX(), box.minX + 0.5), box.maxX + 0.5);
|
||||
double y = Math.min(Math.max(at.getY(), box.minY), box.maxY - 1.0);
|
||||
double z = Math.min(Math.max(at.getZ(), box.minZ + 0.5), box.maxZ + 0.5);
|
||||
Location target = new Location(confinement.world, x, y, z, at.getYaw(), at.getPitch());
|
||||
if (target.getBlock().getType().isSolid() || target.clone().add(0, 1, 0).getBlock().getType().isSolid()) {
|
||||
|
||||
target = confinement.plot.getTeleportLocation();
|
||||
|
||||
}
|
||||
|
||||
VersionUtils.teleport(player, target);
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_OUTSIDE").asKey().arena(confinement.arena).player(player)
|
||||
.sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
// Inclusive block bounds a player may occupy.
|
||||
private static final class Box {
|
||||
|
||||
private final int minX;
|
||||
private final int minY;
|
||||
private final int minZ;
|
||||
private final int maxX;
|
||||
private final int maxY;
|
||||
private final int maxZ;
|
||||
|
||||
private Box(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
|
||||
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.minZ = minZ;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
this.maxZ = maxZ;
|
||||
|
||||
}
|
||||
|
||||
private boolean contains(Location location) {
|
||||
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
return x >= minX && x <= maxX && y >= minY && y <= maxY && z >= minZ && z <= maxZ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final class Confinement {
|
||||
|
||||
private final BaseArena arena;
|
||||
private final Plot plot;
|
||||
private final World world;
|
||||
private final Box box;
|
||||
|
||||
private Confinement(BaseArena arena, Plot plot, World world, Box box) {
|
||||
|
||||
this.arena = arena;
|
||||
this.plot = plot;
|
||||
this.world = world;
|
||||
this.box = box;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final class Shown {
|
||||
|
||||
private final World world;
|
||||
private final Set<BlockPosition> points;
|
||||
|
||||
private Shown(World world, Set<BlockPosition> points) {
|
||||
|
||||
this.world = world;
|
||||
this.points = points;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +33,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -41,100 +40,142 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class PlotManager {
|
||||
|
||||
private final List<Plot> plots = new ArrayList<>();
|
||||
private final List<Plot> plotsToClear = new ArrayList<>();
|
||||
private final BaseArena arena;
|
||||
private final List<Plot> plots = new ArrayList<>();
|
||||
private final List<Plot> plotsToClear = new ArrayList<>();
|
||||
private final BaseArena arena;
|
||||
|
||||
public PlotManager(BaseArena arena) {
|
||||
this.arena = arena;
|
||||
}
|
||||
public PlotManager(BaseArena arena) {
|
||||
|
||||
public void addBuildPlot(Plot buildPlot) {
|
||||
plots.add(buildPlot);
|
||||
}
|
||||
this.arena = arena;
|
||||
|
||||
public void removeBuildPlot(Plot buildPlot) {
|
||||
plots.remove(buildPlot);
|
||||
}
|
||||
|
||||
public Plot getPlot(Player player) {
|
||||
if(player != null) {
|
||||
for(Plot buildPlot : plots) {
|
||||
if(buildPlot.getMembers().contains(player)) {
|
||||
return buildPlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void resetQueuedPlots() {
|
||||
plotsToClear.forEach(Plot::fullyResetPlot);
|
||||
plotsToClear.clear();
|
||||
}
|
||||
|
||||
public boolean isPlotsCleared() {
|
||||
return plotsToClear.isEmpty();
|
||||
}
|
||||
|
||||
public void resetPlotsGradually() {
|
||||
if(isPlotsCleared()) {
|
||||
return;
|
||||
}
|
||||
|
||||
plotsToClear.remove(0).fullyResetPlot();
|
||||
}
|
||||
public void addBuildPlot(Plot buildPlot) {
|
||||
|
||||
public void teleportToPlots() {
|
||||
for(Plot buildPlot : plots) {
|
||||
if(!buildPlot.getMembers().isEmpty()) {
|
||||
Cuboid cuboid = buildPlot.getCuboid();
|
||||
if(cuboid == null) {
|
||||
continue;
|
||||
}
|
||||
plots.add(buildPlot);
|
||||
|
||||
final Location tploc = cuboid.getCenter();
|
||||
if(tploc == null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeBuildPlot(Plot buildPlot) {
|
||||
|
||||
plots.remove(buildPlot);
|
||||
|
||||
}
|
||||
|
||||
public Plot getPlot(Player player) {
|
||||
|
||||
if (player != null) {
|
||||
|
||||
for (Plot buildPlot : plots) {
|
||||
|
||||
if (buildPlot.getMembers().contains(player)) {
|
||||
|
||||
return buildPlot;
|
||||
|
||||
}
|
||||
|
||||
// Should do this in async thread to do not cause dead for the main thread
|
||||
CompletableFuture.supplyAsync(() -> {
|
||||
Location loc = tploc;
|
||||
while(loc.getBlock().getType() != Material.AIR) {
|
||||
if(arena.getArenaInGameState() != BaseArena.ArenaInGameState.THEME_VOTING) {
|
||||
break; // Thread never ends on flat map?
|
||||
}
|
||||
loc = loc.add(0, 1, 0);
|
||||
//teleporting 1 x and z block away from center cause Y is above plot limit
|
||||
if(loc.getY() >= cuboid.getMaxPoint().getY()) {
|
||||
loc = cuboid.getCenter().clone().add(1, 0, 1);
|
||||
}
|
||||
}
|
||||
return loc;
|
||||
}).thenAccept(loc -> {
|
||||
for(Player player : buildPlot.getMembers()) {
|
||||
VersionUtils.teleport(player, loc);
|
||||
//Fix respawning bug while theme voting
|
||||
Bukkit.getScheduler().runTaskLater(arena.getPlugin(), () -> {
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
}, 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
Bukkit.getPluginManager().callEvent(new PlotPlayerReceiveEvent(arena, buildPlot));
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public List<Plot> getTopPlotsOrder() {
|
||||
List<Plot> plotRanking = plots.stream().filter(plot -> !plot.getMembers().isEmpty()).sorted(Comparator.comparingInt(Plot::getPoints)).collect(Collectors.toList());
|
||||
Collections.reverse(plotRanking);
|
||||
return plotRanking;
|
||||
}
|
||||
public void resetQueuedPlots() {
|
||||
|
||||
public List<Plot> getPlots() {
|
||||
return plots;
|
||||
}
|
||||
plotsToClear.forEach(Plot::fullyResetPlot);
|
||||
plotsToClear.clear();
|
||||
|
||||
}
|
||||
|
||||
public boolean isPlotsCleared() {
|
||||
|
||||
return plotsToClear.isEmpty();
|
||||
|
||||
}
|
||||
|
||||
public void resetPlotsGradually() {
|
||||
|
||||
if (isPlotsCleared()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plotsToClear.remove(0).fullyResetPlot();
|
||||
|
||||
}
|
||||
|
||||
public void teleportToPlots() {
|
||||
|
||||
for (Plot buildPlot : plots) {
|
||||
|
||||
if (!buildPlot.getMembers().isEmpty()) {
|
||||
|
||||
Cuboid cuboid = buildPlot.getCuboid();
|
||||
if (cuboid == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
final Location tploc = cuboid.getCenter();
|
||||
if (tploc == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
// Block reads stay on the main thread; the walk is bounded by the plot height.
|
||||
Location loc = tploc;
|
||||
int maxSteps = Math.max(1, cuboid.getMaxPoint().getBlockY() - cuboid.getMinPoint().getBlockY() + 2);
|
||||
for (int step = 0; step < maxSteps && loc.getBlock().getType() != Material.AIR; step++) {
|
||||
|
||||
loc = loc.add(0, 1, 0);
|
||||
// teleporting 1 x and z block away from center cause Y is above plot limit
|
||||
if (loc.getY() >= cuboid.getMaxPoint().getY()) {
|
||||
|
||||
loc = cuboid.getCenter().clone().add(1, 0, 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Player player : buildPlot.getMembers()) {
|
||||
|
||||
VersionUtils.teleport(player, loc);
|
||||
// Fix respawning bug while theme voting
|
||||
Bukkit.getScheduler().runTaskLater(arena.getPlugin(), () -> {
|
||||
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
|
||||
}, 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new PlotPlayerReceiveEvent(arena, buildPlot));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<Plot> getTopPlotsOrder() {
|
||||
|
||||
List<Plot> plotRanking = plots.stream().filter(plot -> !plot.getMembers().isEmpty())
|
||||
.sorted(Comparator.comparingInt(Plot::getPoints)).collect(Collectors.toList());
|
||||
Collections.reverse(plotRanking);
|
||||
return plotRanking;
|
||||
|
||||
}
|
||||
|
||||
public List<Plot> getPlots() {
|
||||
|
||||
return plots;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+148
-111
@@ -33,8 +33,6 @@ import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.items.HandlerItem;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.InventoryScheme;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.PaginatedFastInv;
|
||||
|
||||
@@ -47,122 +45,161 @@ import java.util.List;
|
||||
|
||||
public final class PlotMenuHandler {
|
||||
|
||||
private final Main plugin;
|
||||
private final ItemStack empty;
|
||||
private final ItemStack waiting;
|
||||
private final ItemStack full;
|
||||
private final ItemStack inside;
|
||||
private final SpecialItem baseItem;
|
||||
private final Main plugin;
|
||||
private final ItemStack empty;
|
||||
private final ItemStack waiting;
|
||||
private final ItemStack full;
|
||||
private final ItemStack inside;
|
||||
private final SpecialItem baseItem;
|
||||
|
||||
public PlotMenuHandler(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
this.baseItem = plugin.getSpecialItemManager().getSpecialItem("PLOT_SELECTOR");
|
||||
public PlotMenuHandler(Main plugin) {
|
||||
|
||||
empty = XMaterial.GREEN_WOOL.parseItem();
|
||||
waiting = XMaterial.YELLOW_WOOL.parseItem();
|
||||
full = XMaterial.RED_WOOL.parseItem();
|
||||
inside = XMaterial.PINK_WOOL.parseItem();
|
||||
}
|
||||
this.plugin = plugin;
|
||||
this.baseItem = plugin.getSpecialItemManager().getSpecialItem("PLOT_SELECTOR");
|
||||
|
||||
empty = XMaterial.GREEN_WOOL.parseItem();
|
||||
waiting = XMaterial.YELLOW_WOOL.parseItem();
|
||||
full = XMaterial.RED_WOOL.parseItem();
|
||||
inside = XMaterial.PINK_WOOL.parseItem();
|
||||
|
||||
private ItemStack getItemStack(Plot plot, int maxPlotMembers, Player player) {
|
||||
if(plot.getMembers().isEmpty()) {
|
||||
return empty.clone();
|
||||
}
|
||||
|
||||
if(plot.getMembers().contains(player)) {
|
||||
return inside.clone();
|
||||
private ItemStack getItemStack(Plot plot, int maxPlotMembers, Player player) {
|
||||
|
||||
if (plot.getMembers().isEmpty()) {
|
||||
|
||||
return empty.clone();
|
||||
|
||||
}
|
||||
|
||||
if (plot.getMembers().contains(player)) {
|
||||
|
||||
return inside.clone();
|
||||
|
||||
}
|
||||
|
||||
if (plot.getMembersSize() == maxPlotMembers) {
|
||||
|
||||
return full.clone();
|
||||
|
||||
}
|
||||
|
||||
return waiting.clone();
|
||||
|
||||
}
|
||||
|
||||
if(plot.getMembersSize() == maxPlotMembers) {
|
||||
return full.clone();
|
||||
public void createMenu(Player player, BaseArena arena) {
|
||||
|
||||
PaginatedFastInv gui = new PaginatedFastInv(27,
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_MENU_NAME").asKey().build());
|
||||
new InventoryScheme().mask(" 1111111 ").mask(" 1111111 ").bindPagination('1').apply(gui);
|
||||
|
||||
int plots = 0;
|
||||
int arenaPlotMemberSize = arena.getArenaOption("PLOT_MEMBER_SIZE");
|
||||
|
||||
gui.previousPageItem(20,
|
||||
p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("<- " + p + "/" + gui.lastPage()).build());
|
||||
gui.nextPageItem(24,
|
||||
p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name(p + "/" + gui.lastPage() + " ->").build());
|
||||
|
||||
gui.setItem(22, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("X").build(),
|
||||
e -> e.getWhoClicked().closeInventory());
|
||||
|
||||
for (Plot plot : arena.getPlotManager().getPlots()) {
|
||||
|
||||
ItemStack itemStack = getItemStack(plot, arenaPlotMemberSize, player);
|
||||
int plotMemberSize = plot.getMembersSize();
|
||||
|
||||
itemStack.setAmount(plotMemberSize == 0 ? 1 : plotMemberSize);
|
||||
|
||||
itemStack = new ItemBuilder(itemStack).lore(
|
||||
new MessageBuilder(plotMemberSize >= arenaPlotMemberSize ? "IN_GAME_MESSAGES_PLOT_SELECTOR_FULL"
|
||||
: "IN_GAME_MESSAGES_PLOT_SELECTOR_EMPTY").asKey().build())
|
||||
.build();
|
||||
|
||||
if (plotMemberSize != 0) {
|
||||
|
||||
List<String> players = new ArrayList<>(plotMemberSize);
|
||||
|
||||
for (Player plotMember : plot.getMembers()) {
|
||||
|
||||
players.add("- " + plotMember.getName());
|
||||
|
||||
}
|
||||
|
||||
itemStack = new ItemBuilder(itemStack).lore(players).build();
|
||||
|
||||
}
|
||||
|
||||
if (plot.getMembers().contains(player)) {
|
||||
|
||||
itemStack = new ItemBuilder(itemStack)
|
||||
.lore(new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_INSIDE").asKey().build()).build();
|
||||
|
||||
}
|
||||
|
||||
itemStack = new ItemBuilder(itemStack)
|
||||
.name(new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_NAME").asKey().integer(plots).build())
|
||||
.build();
|
||||
|
||||
new HandlerItem(itemStack).addInteractHandler(event -> {
|
||||
|
||||
if (!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!VersionUtils.getItemInHand(event.getPlayer()).equals(baseItem.getItemStack())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BaseArena baseArena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
if (baseArena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
createMenu(event.getPlayer(), baseArena);
|
||||
|
||||
});
|
||||
|
||||
int finalPlots = plots;
|
||||
gui.addContent(itemStack, event -> {
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!(event.isLeftClick() || event.isRightClick())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
PlotPlayerChooseEvent plotChooseEvent = new PlotPlayerChooseEvent(player, plot, arena);
|
||||
Bukkit.getPluginManager().callEvent(plotChooseEvent);
|
||||
|
||||
if (plotChooseEvent.isCancelled() || !plot.addMember(player, arena, false)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_PLOT_CHOOSE").asKey().player(player)
|
||||
.integer(finalPlots).sendPlayer();
|
||||
event.getWhoClicked().closeInventory();
|
||||
|
||||
});
|
||||
|
||||
plots++;
|
||||
|
||||
}
|
||||
|
||||
gui.open(player);
|
||||
|
||||
}
|
||||
|
||||
return waiting.clone();
|
||||
}
|
||||
|
||||
public void createMenu(Player player, BaseArena arena) {
|
||||
PaginatedFastInv gui = new PaginatedFastInv(27, new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_MENU_NAME").asKey().build());
|
||||
new InventoryScheme()
|
||||
.mask(" 1111111 ")
|
||||
.mask(" 1111111 ")
|
||||
.bindPagination('1').apply(gui);
|
||||
|
||||
|
||||
int plots = 0;
|
||||
int arenaPlotMemberSize = arena.getArenaOption("PLOT_MEMBER_SIZE");
|
||||
|
||||
gui.previousPageItem(20, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("<- " + p + "/" + gui.lastPage()).build());
|
||||
gui.nextPageItem(24, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name(p + "/" + gui.lastPage() + " ->").build());
|
||||
|
||||
gui.setItem(22, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("X").build(),
|
||||
e -> e.getWhoClicked().closeInventory());
|
||||
|
||||
for(Plot plot : arena.getPlotManager().getPlots()) {
|
||||
ItemStack itemStack = getItemStack(plot, arenaPlotMemberSize, player);
|
||||
int plotMemberSize = plot.getMembersSize();
|
||||
|
||||
itemStack.setAmount(plotMemberSize == 0 ? 1 : plotMemberSize);
|
||||
|
||||
itemStack = new ItemBuilder(itemStack).lore(new MessageBuilder(plotMemberSize >= arenaPlotMemberSize ? "IN_GAME_MESSAGES_PLOT_SELECTOR_FULL"
|
||||
: "IN_GAME_MESSAGES_PLOT_SELECTOR_EMPTY").asKey().build()).build();
|
||||
|
||||
if(plotMemberSize != 0) {
|
||||
List<String> players = new ArrayList<>(plotMemberSize);
|
||||
|
||||
for(Player plotMember : plot.getMembers()) {
|
||||
players.add("- " + plotMember.getName());
|
||||
}
|
||||
|
||||
itemStack = new ItemBuilder(itemStack).lore(players).build();
|
||||
}
|
||||
|
||||
if(plot.getMembers().contains(player)) {
|
||||
itemStack = new ItemBuilder(itemStack).lore(new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_INSIDE").asKey().build()).build();
|
||||
}
|
||||
|
||||
itemStack = new ItemBuilder(itemStack).name(new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_NAME").asKey().integer(plots).build()).build();
|
||||
|
||||
new HandlerItem(itemStack).addInteractHandler(event -> {
|
||||
if(!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!VersionUtils.getItemInHand(event.getPlayer()).equals(baseItem.getItemStack())) {
|
||||
return;
|
||||
}
|
||||
|
||||
BaseArena baseArena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
if(baseArena == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
createMenu(event.getPlayer(), baseArena);
|
||||
});
|
||||
|
||||
int finalPlots = plots;
|
||||
gui.addContent(itemStack, event -> {
|
||||
event.setCancelled(true);
|
||||
|
||||
if(!(event.isLeftClick() || event.isRightClick())) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlotPlayerChooseEvent plotChooseEvent = new PlotPlayerChooseEvent(player, plot, arena);
|
||||
Bukkit.getPluginManager().callEvent(plotChooseEvent);
|
||||
|
||||
if(plotChooseEvent.isCancelled() || !plot.addMember(player, arena, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_PLOT_CHOOSE").asKey().player(player).integer(finalPlots).sendPlayer();
|
||||
event.getWhoClicked().closeInventory();
|
||||
});
|
||||
|
||||
plots++;
|
||||
}
|
||||
|
||||
gui.open(player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
package plugily.projects.buildbattle.arena.states.build;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
@@ -39,265 +38,444 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>Created at 28.05.2022
|
||||
* <p>
|
||||
* Created at 28.05.2022
|
||||
*/
|
||||
public class InGameState extends PluginInGameState {
|
||||
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
super.handleCall(arena);
|
||||
BuildArena pluginArena = (BuildArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return;
|
||||
}
|
||||
switch(pluginArena.getArenaInGameState()) {
|
||||
case THEME_VOTING:
|
||||
if(arena.getTimer() <= 0 || pluginArena.getTheme() != null) {
|
||||
// may consider start to build message...
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.BUILD_TIME);
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".In-Game"));
|
||||
super.handleCall(arena);
|
||||
BuildArena pluginArena = (BuildArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if (pluginArena == null) {
|
||||
|
||||
if(pluginArena.getVotePoll() != null && pluginArena.getTheme() == null) {
|
||||
pluginArena.setTheme(pluginArena.getVotePoll().getVotedTheme());
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_NAME").asKey().arena(pluginArena).sendArena();
|
||||
}
|
||||
return;
|
||||
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
player.closeInventory();
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
VersionUtils.setCollidable(player, false);
|
||||
}
|
||||
// second time after voting as sometimes world switch causing no teleportation!
|
||||
pluginArena.getPlotManager().teleportToPlots();
|
||||
} else {
|
||||
handleThemeVoting(pluginArena);
|
||||
}
|
||||
|
||||
break;
|
||||
case BUILD_TIME:
|
||||
handleBuildTime(pluginArena);
|
||||
handleOptionsMenu(pluginArena);
|
||||
if(arena.getTimer() <= 0) {
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
switch (pluginArena.getArenaInGameState()) {
|
||||
|
||||
Plot playerPlot = pluginArena.getPlotFromPlayer(player);
|
||||
if(!pluginArena.getQueue().contains(playerPlot)) {
|
||||
pluginArena.getQueue().add(playerPlot);
|
||||
}
|
||||
player.getInventory().clear();
|
||||
pluginArena.getPlugin().getVoteItems().giveVoteItems(player);
|
||||
user.setStatistic("LOCAL_POINTS", 3);
|
||||
}
|
||||
case THEME_VOTING:
|
||||
if (pluginArena.isRandomTheme() && pluginArena.getTheme() == null) {
|
||||
|
||||
pluginArena.setTheme(pluginArena.pickRandomTheme());
|
||||
|
||||
}
|
||||
|
||||
if (arena.getTimer() <= 0 || pluginArena.getTheme() != null) {
|
||||
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.BUILD_TIME);
|
||||
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".In-Game"));
|
||||
|
||||
if (pluginArena.getVotePoll() != null && pluginArena.getTheme() == null) {
|
||||
|
||||
pluginArena.setTheme(pluginArena.getVotePoll().getVotedTheme());
|
||||
|
||||
}
|
||||
|
||||
if (pluginArena.getTheme() != null) {
|
||||
|
||||
pluginArena.getPlayedThemes().add(pluginArena.getTheme());
|
||||
|
||||
}
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_ROUND_START").asKey().arena(pluginArena).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_ROUND_TITLE").asKey().arena(pluginArena).sendArena();
|
||||
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
player.closeInventory();
|
||||
pluginArena.getPlugin().getBuilderCreativeManager().grantBuilderCreative(player);
|
||||
VersionUtils.setCollidable(player, false);
|
||||
|
||||
}
|
||||
|
||||
// second time after voting as sometimes world switch causing no teleportation!
|
||||
pluginArena.getPlotManager().teleportToPlots();
|
||||
|
||||
} else {
|
||||
|
||||
handleThemeVoting(pluginArena);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case BUILD_TIME:
|
||||
handleBuildTime(pluginArena);
|
||||
handleOptionsMenu(pluginArena);
|
||||
if (arena.getTimer() <= 0) {
|
||||
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
|
||||
Plot playerPlot = pluginArena.getPlotFromPlayer(player);
|
||||
if (!pluginArena.getQueue().contains(playerPlot)) {
|
||||
|
||||
pluginArena.getQueue().add(playerPlot);
|
||||
|
||||
}
|
||||
|
||||
player.getInventory().clear();
|
||||
pluginArena.getPlugin().getVoteItems().giveVoteItems(player);
|
||||
user.setStatistic("LOCAL_POINTS", 3);
|
||||
|
||||
}
|
||||
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
|
||||
voteForNextPlot(pluginArena);
|
||||
|
||||
}
|
||||
break;
|
||||
case PLOT_VOTING:
|
||||
handlePlotVoting(pluginArena);
|
||||
if (arena.getTimer() <= 0) {
|
||||
|
||||
calculatePlotResults(pluginArena);
|
||||
if (pluginArena.getQueue().isEmpty() && !pluginArena.isLastRound()) {
|
||||
|
||||
startNextRound(pluginArena);
|
||||
|
||||
} else if (pluginArena.getQueue().isEmpty()) {
|
||||
|
||||
pluginArena.calculateWinnerPlot();
|
||||
adjustStatistics(pluginArena);
|
||||
|
||||
pluginArena.teleportToWinnerPlot();
|
||||
getPlugin().getArenaManager().stopGame(false, arena);
|
||||
pluginArena.executeEndRewards();
|
||||
|
||||
} else {
|
||||
|
||||
voteForNextPlot(pluginArena);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
|
||||
voteForNextPlot(pluginArena);
|
||||
}
|
||||
break;
|
||||
case PLOT_VOTING:
|
||||
handlePlotVoting(pluginArena);
|
||||
if(arena.getTimer() <= 0) {
|
||||
calculatePlotResults(pluginArena);
|
||||
if(pluginArena.getQueue().isEmpty()) {
|
||||
pluginArena.calculateWinnerPlot();
|
||||
adjustStatistics(pluginArena);
|
||||
|
||||
pluginArena.teleportToWinnerPlot();
|
||||
getPlugin().getArenaManager().stopGame(false, arena);
|
||||
pluginArena.executeEndRewards();
|
||||
} else {
|
||||
voteForNextPlot(pluginArena);
|
||||
}
|
||||
// no players - stop game
|
||||
if (!pluginArena.enoughPlayersToContinue()) {
|
||||
|
||||
getPlugin().getArenaManager().stopGame(true, pluginArena);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// no players - stop game
|
||||
if(!pluginArena.enoughPlayersToContinue()) {
|
||||
getPlugin().getArenaManager().stopGame(true, pluginArena);
|
||||
}
|
||||
}
|
||||
|
||||
private void calculatePlotResults(BuildArena pluginArena) {
|
||||
Plot votingPlot = pluginArena.getVotingPlot();
|
||||
|
||||
if(votingPlot == null || votingPlot.getPoints() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hidePlotOwner = getPlugin().getConfigPreferences().getOption("PLOT_HIDE_OWNER");
|
||||
String formattedMembers = "";
|
||||
private void calculatePlotResults(BuildArena pluginArena) {
|
||||
|
||||
if(hidePlotOwner) {
|
||||
formattedMembers = votingPlot.getFormattedMembers();
|
||||
}
|
||||
List<Plot> plotsVoted = new ArrayList<>();
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
if(hidePlotOwner) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_WAS").asKey().arena(pluginArena).player(player).value(formattedMembers).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena).player(player).value(formattedMembers).sendArena();
|
||||
}
|
||||
Plot votingPlot = pluginArena.getVotingPlot();
|
||||
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
int points = user.getStatistic("LOCAL_POINTS");
|
||||
if (votingPlot == null || votingPlot.getRoundPoints() != 0) {
|
||||
|
||||
return;
|
||||
|
||||
//no vote made, in this case make it a good vote
|
||||
if(points == 0) {
|
||||
points = 3;
|
||||
}
|
||||
Plot plot = pluginArena.getPlotFromPlayer(player);
|
||||
if(!votingPlot.getMembers().contains(player)) {
|
||||
if(!plotsVoted.contains(plot)) {
|
||||
votingPlot.addPoints(points);
|
||||
plotsVoted.add(plot);
|
||||
}
|
||||
}
|
||||
|
||||
user.setStatistic("LOCAL_POINTS", 3);
|
||||
}
|
||||
}
|
||||
boolean hidePlotOwner = getPlugin().getConfigPreferences().getOption("PLOT_HIDE_OWNER");
|
||||
String formattedMembers = "";
|
||||
|
||||
if (hidePlotOwner) {
|
||||
|
||||
formattedMembers = votingPlot.getFormattedMembers();
|
||||
|
||||
private void adjustStatistics(BuildArena pluginArena) {
|
||||
for(Plot plot : pluginArena.getPlotManager().getTopPlotsOrder()) {
|
||||
plot.getMembers().forEach(player -> {
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST")) {
|
||||
user.setStatistic("POINTS_HIGHEST", plot.getPoints());
|
||||
}
|
||||
user.adjustStatistic("POINTS_TOTAL", plot.getPoints());
|
||||
if(plot == pluginArena.getWinnerPlot()) {
|
||||
user.adjustStatistic("WINS", 1);
|
||||
} else {
|
||||
user.adjustStatistic("LOSES", 1);
|
||||
}
|
||||
getPlugin().getUserManager().addExperience(player, 5);
|
||||
if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST_WIN")) {
|
||||
user.setStatistic("POINTS_HIGHEST_WIN", plot.getPoints());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void handleThemeVoting(BuildArena pluginArena) {
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
pluginArena.getVoteMenu().updateInventory(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleBuildTime(BuildArena pluginArena) {
|
||||
int timer = pluginArena.getTimer();
|
||||
for(int timers : getPlugin().getConfig().getIntegerList("Time-Manager.Time-Left-Intervals")) {
|
||||
if(timers == timer) {
|
||||
pluginArena.sendBuildLeftTimeMessage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
pluginArena.checkPlayerOutSidePlot();
|
||||
}
|
||||
|
||||
private void handleOptionsMenu(BuildArena pluginArena) {
|
||||
if(pluginArena.getTimer() % 10 != 0) {
|
||||
return;
|
||||
}
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
pluginArena.getPlugin().getSpecialItemManager().getSpecialItem("OPTIONS_MENU").setItem(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePlotVoting(BuildArena pluginArena) {
|
||||
|
||||
}
|
||||
|
||||
public void voteForNextPlot(BuildArena pluginArena) {
|
||||
Plot votingPlot = pluginArena.getVotingPlot();
|
||||
|
||||
if(votingPlot != null) {
|
||||
if(votingPlot.getPoints() == 0) {
|
||||
List<Plot> plotsVoted = new ArrayList<>();
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
Plot plot = pluginArena.getPlotFromPlayer(player);
|
||||
if(!votingPlot.getMembers().contains(player)) {
|
||||
if(!plotsVoted.contains(plot)) {
|
||||
votingPlot.addPoints(user.getStatistic("LOCAL_POINTS"));
|
||||
plotsVoted.add(plot);
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
if (hidePlotOwner) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_WAS").asKey().arena(pluginArena)
|
||||
.player(player).value(formattedMembers).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena)
|
||||
.player(player).value(formattedMembers).sendArena();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
user.setStatistic("LOCAL_POINTS", 3);
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
int points = user.getStatistic("LOCAL_POINTS");
|
||||
|
||||
VoteItems voteItems = pluginArena.getPlugin().getVoteItems();
|
||||
// no vote made, in this case make it a good vote
|
||||
if (points == 0) {
|
||||
|
||||
points = 3;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = pluginArena.getPlotFromPlayer(player);
|
||||
if (!votingPlot.getMembers().contains(player)) {
|
||||
|
||||
if (!plotsVoted.contains(plot)) {
|
||||
|
||||
votingPlot.addPoints(points);
|
||||
plotsVoted.add(plot);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
user.setStatistic("LOCAL_POINTS", 3);
|
||||
|
||||
if(!player.getInventory().contains(voteItems.getReportItem())) {
|
||||
player.getInventory().setItem(voteItems.getReportVoteItem().getSlot(), voteItems.getReportVoteItem().getItemStack());
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!votingPlot.getMembers().isEmpty() && getPlugin().getConfigPreferences().getOption("PLOT_HIDE_OWNER")) {
|
||||
String formattedMembers = votingPlot.getFormattedMembers();
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_WAS").asKey().arena(pluginArena).value(formattedMembers).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena).value(formattedMembers).sendArena();
|
||||
}
|
||||
}
|
||||
|
||||
voteRoutine(pluginArena);
|
||||
}
|
||||
private void adjustStatistics(BuildArena pluginArena) {
|
||||
|
||||
for (Plot plot : pluginArena.getPlotManager().getTopPlotsOrder()) {
|
||||
|
||||
plot.getMembers().forEach(player -> {
|
||||
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
if (plot.getPoints() > user.getStatistic("POINTS_HIGHEST")) {
|
||||
|
||||
user.setStatistic("POINTS_HIGHEST", plot.getPoints());
|
||||
|
||||
}
|
||||
|
||||
user.adjustStatistic("POINTS_TOTAL", plot.getPoints());
|
||||
if (plot == pluginArena.getWinnerPlot()) {
|
||||
|
||||
user.adjustStatistic("WINS", 1);
|
||||
|
||||
} else {
|
||||
|
||||
user.adjustStatistic("LOSES", 1);
|
||||
|
||||
}
|
||||
|
||||
getPlugin().getUserManager().addExperience(player, 5);
|
||||
if (plot.getPoints() > user.getStatistic("POINTS_HIGHEST_WIN")) {
|
||||
|
||||
user.setStatistic("POINTS_HIGHEST_WIN", plot.getPoints());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void voteRoutine(BuildArena pluginArena) {
|
||||
if(pluginArena.getQueue().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Plot"));
|
||||
// Judging is over but rounds remain: wipe the plots and send everyone home.
|
||||
private void startNextRound(BuildArena pluginArena) {
|
||||
|
||||
Plot plot = pluginArena.getQueue().poll();
|
||||
pluginArena.nextRound();
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
// Vote items would otherwise become building blocks in creative.
|
||||
player.getInventory().clear();
|
||||
player.closeInventory();
|
||||
|
||||
}
|
||||
|
||||
Location spectatorLoc = pluginArena.getSpectatorLocation();
|
||||
if (spectatorLoc != null) {
|
||||
|
||||
for (Player spectator : pluginArena.getSpectators()) {
|
||||
|
||||
VersionUtils.teleport(spectator, spectatorLoc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pluginArena.getPlotManager().teleportToPlots();
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
|
||||
while(plot == null && !pluginArena.getQueue().isEmpty()) {
|
||||
// should not happen anymore... to be removed
|
||||
System.out.print("A PLAYER HAS NO PLOT!");
|
||||
plot = pluginArena.getQueue().poll();
|
||||
}
|
||||
|
||||
if(pluginArena.getQueue().isEmpty() && plot == null) {
|
||||
pluginArena.setVotingPlot(null);
|
||||
return;
|
||||
private void handleThemeVoting(BuildArena pluginArena) {
|
||||
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
pluginArena.getVoteMenu().updateInventory(player);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pluginArena.setVotingPlot(plot);
|
||||
private void handleBuildTime(BuildArena pluginArena) {
|
||||
|
||||
int timer = pluginArena.getTimer();
|
||||
for (int timers : getPlugin().getConfig().getIntegerList("Time-Manager.Time-Left-Intervals")) {
|
||||
|
||||
if (timers == timer) {
|
||||
|
||||
pluginArena.sendBuildLeftTimeMessage();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pluginArena.checkPlayerOutSidePlot();
|
||||
|
||||
if(plot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location teleportLoc = plot.getTeleportLocation();
|
||||
String formattedMembers = plot.getFormattedMembers();
|
||||
boolean hidePlotOwner = getPlugin().getConfigPreferences().getOption("PLOT_HIDE_OWNER");
|
||||
private void handleOptionsMenu(BuildArena pluginArena) {
|
||||
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
VersionUtils.teleport(player, teleportLoc);
|
||||
player.setPlayerWeather(plot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(plot.getTime(), player.getWorld().getTime()), false);
|
||||
if (pluginArena.getTimer() % 10 != 0) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
pluginArena.getPlugin().getSpecialItemManager().getSpecialItem("OPTIONS_MENU").setItem(player);
|
||||
|
||||
}
|
||||
|
||||
if(hidePlotOwner) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT").asKey().arena(pluginArena).value("???").player(player).sendPlayer();
|
||||
} else {
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena).value(formattedMembers).player(player).sendPlayer();
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT").asKey().arena(pluginArena).value(formattedMembers).player(player).sendPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
for(Player spectator : pluginArena.getSpectators()) {
|
||||
VersionUtils.teleport(spectator, teleportLoc);
|
||||
spectator.setPlayerWeather(plot.getWeatherType());
|
||||
spectator.setPlayerTime(Plot.Time.format(plot.getTime(), spectator.getWorld().getTime()), false);
|
||||
private void handlePlotVoting(BuildArena pluginArena) {
|
||||
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena).value(formattedMembers).player(spectator).sendPlayer();
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT").asKey().arena(pluginArena).value(formattedMembers).player(spectator).sendPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
public void voteForNextPlot(BuildArena pluginArena) {
|
||||
|
||||
Plot votingPlot = pluginArena.getVotingPlot();
|
||||
|
||||
if (votingPlot != null) {
|
||||
|
||||
if (votingPlot.getRoundPoints() == 0) {
|
||||
|
||||
List<Plot> plotsVoted = new ArrayList<>();
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
Plot plot = pluginArena.getPlotFromPlayer(player);
|
||||
if (!votingPlot.getMembers().contains(player)) {
|
||||
|
||||
if (!plotsVoted.contains(plot)) {
|
||||
|
||||
votingPlot.addPoints(user.getStatistic("LOCAL_POINTS"));
|
||||
plotsVoted.add(plot);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
user.setStatistic("LOCAL_POINTS", 3);
|
||||
|
||||
VoteItems voteItems = pluginArena.getPlugin().getVoteItems();
|
||||
|
||||
if (!player.getInventory().contains(voteItems.getReportItem())) {
|
||||
|
||||
player.getInventory().setItem(voteItems.getReportVoteItem().getSlot(),
|
||||
voteItems.getReportVoteItem().getItemStack());
|
||||
player.updateInventory();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!votingPlot.getMembers().isEmpty() && getPlugin().getConfigPreferences().getOption("PLOT_HIDE_OWNER")) {
|
||||
|
||||
String formattedMembers = votingPlot.getFormattedMembers();
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_WAS").asKey().arena(pluginArena)
|
||||
.value(formattedMembers).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena)
|
||||
.value(formattedMembers).sendArena();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
voteRoutine(pluginArena);
|
||||
|
||||
}
|
||||
|
||||
public void voteRoutine(BuildArena pluginArena) {
|
||||
|
||||
if (pluginArena.getQueue().isEmpty()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Plot"));
|
||||
|
||||
Plot plot = pluginArena.getQueue().poll();
|
||||
|
||||
while (plot == null && !pluginArena.getQueue().isEmpty()) {
|
||||
|
||||
// should not happen anymore... to be removed
|
||||
getPlugin().getDebugger().debug("A PLAYER HAS NO PLOT!");
|
||||
plot = pluginArena.getQueue().poll();
|
||||
|
||||
}
|
||||
|
||||
if (pluginArena.getQueue().isEmpty() && plot == null) {
|
||||
|
||||
pluginArena.setVotingPlot(null);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
pluginArena.setVotingPlot(plot);
|
||||
|
||||
if (plot == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Location teleportLoc = plot.getTeleportLocation();
|
||||
String formattedMembers = plot.getFormattedMembers();
|
||||
boolean hidePlotOwner = getPlugin().getConfigPreferences().getOption("PLOT_HIDE_OWNER");
|
||||
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
VersionUtils.teleport(player, teleportLoc);
|
||||
player.setPlayerWeather(plot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(plot.getTime(), player.getWorld().getTime()), false);
|
||||
|
||||
if (hidePlotOwner) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT").asKey().arena(pluginArena)
|
||||
.value("???").player(player).sendPlayer();
|
||||
|
||||
} else {
|
||||
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena)
|
||||
.value(formattedMembers).player(player).sendPlayer();
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT").asKey().arena(pluginArena)
|
||||
.value(formattedMembers).player(player).sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Player spectator : pluginArena.getSpectators()) {
|
||||
|
||||
VersionUtils.teleport(spectator, teleportLoc);
|
||||
spectator.setPlayerWeather(plot.getWeatherType());
|
||||
spectator.setPlayerTime(Plot.Time.format(plot.getTime(), spectator.getWorld().getTime()), false);
|
||||
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena)
|
||||
.value(formattedMembers).player(spectator).sendPlayer();
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT").asKey().arena(pluginArena)
|
||||
.value(formattedMembers).player(spectator).sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,29 +28,40 @@ import plugily.projects.minigamesbox.classic.arena.states.PluginStartingState;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>Created at 03.06.2019
|
||||
* <p>
|
||||
* Created at 03.06.2019
|
||||
*/
|
||||
public class StartingState extends PluginStartingState {
|
||||
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
super.handleCall(arena);
|
||||
BuildArena pluginArena = (BuildArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return;
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
|
||||
super.handleCall(arena);
|
||||
BuildArena pluginArena = (BuildArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if (pluginArena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (arena.getTimer() == 0 || arena.isForceStart()) {
|
||||
|
||||
pluginArena.setParticleRefreshScheduler(new ParticleRefreshScheduler(getPlugin()));
|
||||
|
||||
if (!pluginArena.getPlotManager().isPlotsCleared()) {
|
||||
|
||||
pluginArena.getPlotManager().resetQueuedPlots();
|
||||
|
||||
}
|
||||
|
||||
pluginArena.distributePlots();
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if(arena.getTimer() == 0 || arena.isForceStart()) {
|
||||
|
||||
pluginArena.setParticleRefreshScheduler(new ParticleRefreshScheduler(getPlugin()));
|
||||
|
||||
if(!pluginArena.getPlotManager().isPlotsCleared()) {
|
||||
pluginArena.getPlotManager().resetQueuedPlots();
|
||||
}
|
||||
|
||||
pluginArena.distributePlots();
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,293 +21,469 @@
|
||||
package plugily.projects.buildbattle.arena.states.guess;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.buildbattle.handlers.themes.BBTheme;
|
||||
import plugily.projects.buildbattle.handlers.themes.GuessTheme;
|
||||
import plugily.projects.buildbattle.handlers.themes.ThemeManager;
|
||||
import plugily.projects.minigamesbox.api.user.IUser;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArenaUtils;
|
||||
import plugily.projects.minigamesbox.classic.arena.states.PluginInGameState;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.TitleBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.actionbar.ActionBar;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>Created at 28.05.2022
|
||||
* <p>
|
||||
* Created at 28.05.2022
|
||||
*/
|
||||
public class InGameState extends PluginInGameState {
|
||||
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
super.handleCall(arena);
|
||||
GuessArena pluginArena = (GuessArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return;
|
||||
}
|
||||
switch(pluginArena.getArenaInGameState()) {
|
||||
case THEME_VOTING:
|
||||
if(pluginArena.getBuildPlot() == null) {
|
||||
pluginArena.setNextPlot();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_BEING_SELECTED").asKey().arena(pluginArena).sendArena();
|
||||
openThemeSelectionInventoryToCurrentBuilder(pluginArena);
|
||||
break;
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
|
||||
super.handleCall(arena);
|
||||
GuessArena pluginArena = (GuessArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if (pluginArena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(arena.getTimer() <= 0 || pluginArena.isCurrentThemeSet()) {
|
||||
forceSetTheme(pluginArena);
|
||||
switch (pluginArena.getArenaInGameState()) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_ROUND").asKey().integer(pluginArena.getRound()).arena(pluginArena).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_TITLE").asKey().arena(pluginArena).sendArena();
|
||||
case THEME_VOTING:
|
||||
if (pluginArena.getBuildPlot() == null) {
|
||||
|
||||
pluginArena.setNextPlot();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_BEING_SELECTED").asKey().arena(pluginArena)
|
||||
.sendArena();
|
||||
openThemeSelectionInventoryToCurrentBuilder(pluginArena);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (arena.getTimer() <= 0 || pluginArena.isCurrentThemeSet()) {
|
||||
|
||||
forceSetTheme(pluginArena);
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_ROUND").asKey().integer(pluginArena.getRound())
|
||||
.arena(pluginArena).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_TITLE").asKey().arena(pluginArena)
|
||||
.sendArena();
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(getPlugin(),
|
||||
() -> pluginArena.getCurrentBuilders().forEach(player ->
|
||||
{
|
||||
|
||||
pluginArena.getPlugin().getBuilderCreativeManager().grantBuilderCreative(player);
|
||||
pluginArena.getPlayersLeft().forEach(
|
||||
ingamePlayer -> VersionUtils.hidePlayer(getPlugin(), player, ingamePlayer));
|
||||
pluginArena.getPlugin().getSpecialItemManager().getSpecialItem("OPTIONS_MENU")
|
||||
.setItem(player);
|
||||
|
||||
}), 40);
|
||||
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".In-Game"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.BUILD_TIME);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case BUILD_TIME:
|
||||
// check not needed anymore
|
||||
// if(pluginArena.isCurrentThemeSet()) {
|
||||
int timer = arena.getTimer();
|
||||
|
||||
if (timer <= 90) {
|
||||
|
||||
if (timer == 90) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_CHARS").asKey().arena(pluginArena)
|
||||
.integer(pluginArena.getCurrentBBTheme().getDefaultTheme().length()).sendArena();
|
||||
|
||||
}
|
||||
|
||||
sendThemeHints(arena, pluginArena);
|
||||
|
||||
}
|
||||
if (timer <= 0) {
|
||||
|
||||
// not all guessed
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_WAS").asKey()
|
||||
.value(pluginArena.getCurrentBBTheme().getThemesAsString()).arena(pluginArena).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_TITLE").asKey()
|
||||
.value(pluginArena.getCurrentBBTheme().getThemesAsString()).arena(pluginArena).sendArena();
|
||||
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Round-Delay"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
|
||||
|
||||
}
|
||||
// }
|
||||
handleBuildTime(pluginArena);
|
||||
handleOptionsMenu(pluginArena);
|
||||
break;
|
||||
case PLOT_VOTING:
|
||||
for (Player player : pluginArena.getPlayersLeft()) {
|
||||
|
||||
PluginArenaUtils.showPlayer(player, arena);
|
||||
|
||||
}
|
||||
if (pluginArena.getRound() + 1 > pluginArena.getPlotList().size()
|
||||
* pluginArena.getArenaOption("GTB_ROUNDS_PER_PLOT"))
|
||||
{
|
||||
|
||||
pluginArena.calculateWinnerPlot();
|
||||
adjustStatistics(pluginArena);
|
||||
|
||||
pluginArena.teleportToWinnerPlot(); // todo save built plot from winner
|
||||
pluginArena.executeEndRewards();
|
||||
getPlugin().getArenaManager().stopGame(false, arena);
|
||||
|
||||
} else if (arena.getTimer() <= 0) {
|
||||
|
||||
pluginArena.resetBuildPlot();
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// no players - stop game
|
||||
if (!pluginArena.enoughPlayersToContinue()) {
|
||||
|
||||
getPlugin().getArenaManager().stopGame(true, pluginArena);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendThemeHints(PluginArena arena, GuessArena pluginArena) {
|
||||
|
||||
for (Player player : arena.getPlayers()) {
|
||||
|
||||
if (pluginArena.getCurrentBuilders().contains(player)) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (pluginArena.getWhoGuessed().contains(player)) {
|
||||
|
||||
getPlugin().getActionBarManager().addActionBar(player,
|
||||
new ActionBar(new MessageBuilder(pluginArena.getCurrentBBTheme().getDefaultTheme()),
|
||||
ActionBar.ActionBarType.DISPLAY));
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
int themeLength = pluginArena.getCurrentBBTheme().getDefaultTheme().length();
|
||||
List<Integer> charsAt = new ArrayList<>(themeLength);
|
||||
|
||||
for (int i = 0; i < themeLength; i++) {
|
||||
|
||||
if (!pluginArena.getRemovedCharsAt().contains(i)) {
|
||||
|
||||
charsAt.add(i);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (themeLength - pluginArena.getRemovedCharsAt().size() > 2) {
|
||||
|
||||
int timer = arena.getTimer();
|
||||
|
||||
if (timer % 10 == 0 && timer <= 70) {
|
||||
|
||||
pluginArena.getRemovedCharsAt().add(charsAt.get(
|
||||
charsAt.size() == 1 ? 0 : pluginArena.getPlugin().getRandom().nextInt(charsAt.size())));
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StringBuilder actionbar = new StringBuilder();
|
||||
for (int i = 0; i < themeLength; i++) {
|
||||
|
||||
char charAt = pluginArena.getCurrentBBTheme().getDefaultTheme().charAt(i);
|
||||
|
||||
if (Character.isWhitespace(charAt)) {
|
||||
|
||||
actionbar.append(" ");
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (pluginArena.getRemovedCharsAt().contains(i)) {
|
||||
|
||||
actionbar.append(charAt).append(' ');
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
actionbar.append("_ ");
|
||||
|
||||
}
|
||||
|
||||
getPlugin().getActionBarManager().addActionBar(player,
|
||||
new ActionBar(new MessageBuilder(actionbar.toString()), ActionBar.ActionBarType.DISPLAY));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void forceSetTheme(GuessArena pluginArena) {
|
||||
|
||||
if (pluginArena.isCurrentThemeSet()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
GuessTheme.Difficulty difficulty = GuessTheme.Difficulty.EASY;
|
||||
switch (pluginArena.getPlugin().getRandom().nextInt(2 + 1)) {
|
||||
|
||||
case 1:
|
||||
difficulty = GuessTheme.Difficulty.MEDIUM;
|
||||
break;
|
||||
case 2:
|
||||
difficulty = GuessTheme.Difficulty.HARD;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
setChosenTheme(pluginArena, getThemeByDifficulty(pluginArena, difficulty));
|
||||
|
||||
}
|
||||
|
||||
private void handleOptionsMenu(GuessArena pluginArena) {
|
||||
|
||||
if (pluginArena.getTimer() % 10 != 0) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (Player player : pluginArena.getCurrentBuilders()) {
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> pluginArena.getCurrentBuilders().forEach(player -> {
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
pluginArena.getPlugin().getSpecialItemManager().getSpecialItem("OPTIONS_MENU").setItem(player);
|
||||
} ), 40);
|
||||
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".In-Game"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.BUILD_TIME);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BUILD_TIME:
|
||||
// check not needed anymore
|
||||
// if(pluginArena.isCurrentThemeSet()) {
|
||||
int timer = arena.getTimer();
|
||||
|
||||
if(timer <= 90) {
|
||||
if(timer == 90) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_CHARS").asKey().arena(pluginArena).integer(pluginArena.getCurrentBBTheme().getTheme().length()).sendArena();
|
||||
}
|
||||
sendThemeHints(arena, pluginArena);
|
||||
}
|
||||
if(timer <= 0) {
|
||||
//not all guessed
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_WAS").asKey().value(pluginArena.getCurrentBBTheme().getTheme()).arena(pluginArena).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_TITLE").asKey().value(pluginArena.getCurrentBBTheme().getTheme()).arena(pluginArena).sendArena();
|
||||
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Round-Delay"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
|
||||
}
|
||||
//}
|
||||
handleBuildTime(pluginArena);
|
||||
handleOptionsMenu(pluginArena);
|
||||
break;
|
||||
case PLOT_VOTING:
|
||||
if(pluginArena.getRound() + 1 > pluginArena.getPlotList().size() * pluginArena.getArenaOption("GTB_ROUNDS_PER_PLOT")) {
|
||||
pluginArena.calculateWinnerPlot();
|
||||
adjustStatistics(pluginArena);
|
||||
|
||||
pluginArena.teleportToWinnerPlot(); //todo save built plot from winner
|
||||
pluginArena.executeEndRewards();
|
||||
getPlugin().getArenaManager().stopGame(false, arena);
|
||||
} else if (arena.getTimer() <= 0) {
|
||||
pluginArena.resetBuildPlot();
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// no players - stop game
|
||||
if(!pluginArena.enoughPlayersToContinue()) {
|
||||
getPlugin().getArenaManager().stopGame(true, pluginArena);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendThemeHints(PluginArena arena, GuessArena pluginArena) {
|
||||
for(Player player : arena.getPlayers()) {
|
||||
if(pluginArena.getCurrentBuilders().contains(player)) {
|
||||
continue;
|
||||
}
|
||||
if(pluginArena.getWhoGuessed().contains(player)) {
|
||||
getPlugin().getActionBarManager().addActionBar(player, new ActionBar(new MessageBuilder(pluginArena.getCurrentBBTheme().getTheme()), ActionBar.ActionBarType.DISPLAY));
|
||||
continue;
|
||||
}
|
||||
int themeLength = pluginArena.getCurrentBBTheme().getTheme().length();
|
||||
List<Integer> charsAt = new ArrayList<>(themeLength);
|
||||
|
||||
for(int i = 0; i < themeLength; i++) {
|
||||
if(!pluginArena.getRemovedCharsAt().contains(i)) {
|
||||
charsAt.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(themeLength - pluginArena.getRemovedCharsAt().size() > 2) {
|
||||
int timer = arena.getTimer();
|
||||
|
||||
if(timer % 10 == 0 && timer <= 70) {
|
||||
pluginArena.getRemovedCharsAt().add(charsAt.get(charsAt.size() == 1 ? 0 : pluginArena.getPlugin().getRandom().nextInt(charsAt.size())));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder actionbar = new StringBuilder();
|
||||
for(int i = 0; i < themeLength; i++) {
|
||||
char charAt = pluginArena.getCurrentBBTheme().getTheme().charAt(i);
|
||||
|
||||
if(Character.isWhitespace(charAt)) {
|
||||
actionbar.append(" ");
|
||||
continue;
|
||||
}
|
||||
if(pluginArena.getRemovedCharsAt().contains(i)) {
|
||||
actionbar.append(charAt).append(' ');
|
||||
continue;
|
||||
}
|
||||
actionbar.append("_ ");
|
||||
}
|
||||
getPlugin().getActionBarManager().addActionBar(player, new ActionBar(new MessageBuilder(actionbar.toString()), ActionBar.ActionBarType.DISPLAY));
|
||||
}
|
||||
}
|
||||
|
||||
private void forceSetTheme(GuessArena pluginArena) {
|
||||
if(pluginArena.isCurrentThemeSet()) {
|
||||
return;
|
||||
}
|
||||
BBTheme.Difficulty difficulty = BBTheme.Difficulty.EASY;
|
||||
switch(pluginArena.getPlugin().getRandom().nextInt(2 + 1)) {
|
||||
case 1:
|
||||
difficulty = BBTheme.Difficulty.MEDIUM;
|
||||
break;
|
||||
case 2:
|
||||
difficulty = BBTheme.Difficulty.HARD;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
setChosenTheme(pluginArena, getThemeByDifficulty(pluginArena, difficulty));
|
||||
}
|
||||
|
||||
private void handleOptionsMenu(GuessArena pluginArena) {
|
||||
if(pluginArena.getTimer() % 10 != 0) {
|
||||
return;
|
||||
}
|
||||
for(Player player : pluginArena.getCurrentBuilders()) {
|
||||
pluginArena.getPlugin().getSpecialItemManager().getSpecialItem("OPTIONS_MENU").setItem(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void setChosenTheme(GuessArena pluginArena, BBTheme bbTheme) {
|
||||
setTheme(pluginArena, bbTheme);
|
||||
pluginArena.getCurrentBuilders().forEach(HumanEntity::closeInventory);
|
||||
pluginArena.getCurrentBuilders().forEach(player ->
|
||||
getPlugin().getActionBarManager().addActionBar(player, new ActionBar(new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_NAME").asKey().player(player).arena(pluginArena),
|
||||
ActionBar.ActionBarType.DISPLAY)));
|
||||
}
|
||||
|
||||
|
||||
private void openThemeSelectionInventoryToCurrentBuilder(GuessArena pluginArena) {
|
||||
if(pluginArena.getCurrentBuilders().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pluginArena.getCurrentBuilders().forEach(HumanEntity::closeInventory);
|
||||
private void setChosenTheme(GuessArena pluginArena, GuessTheme guessTheme) {
|
||||
|
||||
NormalFastInv gui = new NormalFastInv(9 * 3, new MessageBuilder("MENU_THEME_GTB_INVENTORY").asKey().build());
|
||||
gui.addClickHandler(inventoryClickEvent -> inventoryClickEvent.setCancelled(true));
|
||||
gui.addCloseHandler(event -> {
|
||||
if(!pluginArena.isCurrentThemeSet()) {
|
||||
Bukkit.getScheduler().runTask(getPlugin(), () -> event.getPlayer().openInventory(event.getInventory()));
|
||||
}
|
||||
});
|
||||
setTheme(pluginArena, guessTheme);
|
||||
pluginArena.getCurrentBuilders().forEach(HumanEntity::closeInventory);
|
||||
pluginArena.getCurrentBuilders()
|
||||
.forEach(
|
||||
player -> getPlugin().getActionBarManager()
|
||||
.addActionBar(player,
|
||||
new ActionBar(
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_NAME").asKey()
|
||||
.player(player).arena(pluginArena),
|
||||
ActionBar.ActionBarType.DISPLAY)));
|
||||
|
||||
|
||||
BBTheme easy = getThemeByDifficulty(pluginArena, BBTheme.Difficulty.EASY);
|
||||
gui.setItem(11, new SimpleClickableItem(new ItemBuilder(Material.PAPER).name(getThemeItemName(pluginArena).value(easy.getTheme()).build())
|
||||
.lore(getThemeItemLore(pluginArena).value(new MessageBuilder("MENU_THEME_GTB_DIFFICULTIES_EASY").asKey().build()).integer(easy.getDifficulty().getPointsReward()).build().split(";")).build(), event -> {
|
||||
setChosenTheme(pluginArena, easy);
|
||||
}));
|
||||
|
||||
BBTheme medium = getThemeByDifficulty(pluginArena, BBTheme.Difficulty.MEDIUM);
|
||||
gui.setItem(13, new SimpleClickableItem(new ItemBuilder(Material.PAPER).name(getThemeItemName(pluginArena).value(medium.getTheme()).build())
|
||||
.lore(getThemeItemLore(pluginArena).value(new MessageBuilder("MENU_THEME_GTB_DIFFICULTIES_MEDIUM").asKey().build()).integer(medium.getDifficulty().getPointsReward()).build().split(";")).build(), event -> {
|
||||
setChosenTheme(pluginArena, medium);
|
||||
}));
|
||||
|
||||
BBTheme hard = getThemeByDifficulty(pluginArena, BBTheme.Difficulty.HARD);
|
||||
gui.setItem(15, new SimpleClickableItem(new ItemBuilder(Material.PAPER).name(getThemeItemName(pluginArena).value(hard.getTheme()).build())
|
||||
.lore(getThemeItemLore(pluginArena).value(new MessageBuilder("MENU_THEME_GTB_DIFFICULTIES_HARD").asKey().build()).integer(hard.getDifficulty().getPointsReward()).build().split(";")).build(), event -> {
|
||||
setChosenTheme(pluginArena, hard);
|
||||
}));
|
||||
|
||||
getPlugin().getDebugger().debug("Opened Theme Selector for {0}", pluginArena.getCurrentBuilders().toString());
|
||||
pluginArena.getCurrentBuilders().forEach(gui::open);
|
||||
}
|
||||
|
||||
public MessageBuilder getThemeItemName(GuessArena pluginArena) {
|
||||
return new MessageBuilder("MENU_THEME_GTB_ITEM_NAME").asKey().arena(pluginArena);
|
||||
}
|
||||
|
||||
public MessageBuilder getThemeItemLore(GuessArena pluginArena) {
|
||||
return new MessageBuilder("MENU_THEME_GTB_ITEM_LORE").asKey().arena(pluginArena);
|
||||
}
|
||||
|
||||
|
||||
private BBTheme getThemeByDifficulty(GuessArena pluginArena, BBTheme.Difficulty difficulty) {
|
||||
List<String> themes = pluginArena.getPlugin().getThemeManager().getThemes(ThemeManager.GameThemes.getByDifficulty(difficulty));
|
||||
List<String> themesFilter = new ArrayList<>(themes);
|
||||
themesFilter.removeAll(pluginArena.getPlayedThemes());
|
||||
if(themesFilter.isEmpty()) {
|
||||
themesFilter = themes;
|
||||
}
|
||||
String themeName = themesFilter.get(getPlugin().getRandom().nextInt(themesFilter.size()));
|
||||
BBTheme theme = new BBTheme(themeName, difficulty);
|
||||
pluginArena.getPlayedThemes().add(themeName);
|
||||
return theme;
|
||||
}
|
||||
|
||||
private void setTheme(GuessArena pluginArena, BBTheme theme) {
|
||||
pluginArena.setCurrentTheme(theme);
|
||||
}
|
||||
private void openThemeSelectionInventoryToCurrentBuilder(GuessArena pluginArena) {
|
||||
|
||||
if (pluginArena.getCurrentBuilders().isEmpty()) {
|
||||
|
||||
return;
|
||||
|
||||
private void adjustStatistics(GuessArena pluginArena) {
|
||||
for(Plot plot : pluginArena.getPlotManager().getTopPlotsOrder()) {
|
||||
plot.getMembers().forEach(player -> {
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
/*
|
||||
//ToDo GTB stats
|
||||
if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST")) {
|
||||
user.setStatistic("POINTS_HIGHEST", plot.getPoints());
|
||||
}
|
||||
*/
|
||||
user.adjustStatistic("POINTS_TOTAL", plot.getPoints());
|
||||
if(plot == pluginArena.getWinnerPlot()) {
|
||||
user.adjustStatistic("WINS", 1);
|
||||
} else {
|
||||
user.adjustStatistic("LOSES", 1);
|
||||
}
|
||||
getPlugin().getUserManager().addExperience(player, 5);
|
||||
/*
|
||||
if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST_WIN")) {
|
||||
user.setStatistic("POINTS_HIGHEST_WIN", plot.getPoints());
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
pluginArena.getCurrentBuilders().forEach(HumanEntity::closeInventory);
|
||||
|
||||
NormalFastInv gui = new NormalFastInv(9 * 3, new MessageBuilder("MENU_THEME_GTB_INVENTORY").asKey().build());
|
||||
gui.addClickHandler(inventoryClickEvent -> inventoryClickEvent.setCancelled(true));
|
||||
gui.addCloseHandler(event -> {
|
||||
|
||||
if (!pluginArena.isCurrentThemeSet()) {
|
||||
|
||||
Bukkit.getScheduler().runTask(getPlugin(), () -> event.getPlayer().openInventory(event.getInventory()));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
GuessTheme easy = getThemeByDifficulty(pluginArena, GuessTheme.Difficulty.EASY);
|
||||
gui.setItem(11,
|
||||
new SimpleClickableItem(
|
||||
new ItemBuilder(Material.PAPER)
|
||||
.name(getThemeItemName(pluginArena).value(easy.getThemesAsString()).build())
|
||||
.lore(getThemeItemLore(pluginArena)
|
||||
.value(new MessageBuilder("MENU_THEME_GTB_DIFFICULTIES_EASY").asKey().build())
|
||||
.integer(easy.getDifficulty().getPointsReward()).build().split(";"))
|
||||
.build(),
|
||||
event ->
|
||||
{
|
||||
|
||||
setChosenTheme(pluginArena, easy);
|
||||
|
||||
}));
|
||||
|
||||
GuessTheme medium = getThemeByDifficulty(pluginArena, GuessTheme.Difficulty.MEDIUM);
|
||||
gui.setItem(13,
|
||||
new SimpleClickableItem(
|
||||
new ItemBuilder(Material.PAPER)
|
||||
.name(getThemeItemName(pluginArena).value(medium.getThemesAsString()).build())
|
||||
.lore(getThemeItemLore(pluginArena)
|
||||
.value(new MessageBuilder("MENU_THEME_GTB_DIFFICULTIES_MEDIUM").asKey().build())
|
||||
.integer(medium.getDifficulty().getPointsReward()).build().split(";"))
|
||||
.build(),
|
||||
event ->
|
||||
{
|
||||
|
||||
setChosenTheme(pluginArena, medium);
|
||||
|
||||
}));
|
||||
|
||||
GuessTheme hard = getThemeByDifficulty(pluginArena, GuessTheme.Difficulty.HARD);
|
||||
gui.setItem(15,
|
||||
new SimpleClickableItem(
|
||||
new ItemBuilder(Material.PAPER)
|
||||
.name(getThemeItemName(pluginArena).value(hard.getThemesAsString()).build())
|
||||
.lore(getThemeItemLore(pluginArena)
|
||||
.value(new MessageBuilder("MENU_THEME_GTB_DIFFICULTIES_HARD").asKey().build())
|
||||
.integer(hard.getDifficulty().getPointsReward()).build().split(";"))
|
||||
.build(),
|
||||
event ->
|
||||
{
|
||||
|
||||
setChosenTheme(pluginArena, hard);
|
||||
|
||||
}));
|
||||
|
||||
getPlugin().getDebugger().debug("Opened Theme Selector for {0}", pluginArena.getCurrentBuilders().toString());
|
||||
pluginArena.getCurrentBuilders().forEach(gui::open);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void handleBuildTime(GuessArena pluginArena) {
|
||||
int timer = pluginArena.getTimer();
|
||||
public MessageBuilder getThemeItemName(GuessArena pluginArena) {
|
||||
|
||||
return new MessageBuilder("MENU_THEME_GTB_ITEM_NAME").asKey().arena(pluginArena);
|
||||
|
||||
for(int timers : getPlugin().getConfig().getIntegerList("Time-Manager.Time-Left-Intervals")) {
|
||||
if(timers == timer) {
|
||||
pluginArena.sendBuildLeftTimeMessage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
pluginArena.checkPlayerOutSidePlot();
|
||||
}
|
||||
|
||||
public MessageBuilder getThemeItemLore(GuessArena pluginArena) {
|
||||
|
||||
return new MessageBuilder("MENU_THEME_GTB_ITEM_LORE").asKey().arena(pluginArena);
|
||||
|
||||
}
|
||||
|
||||
private GuessTheme getThemeByDifficulty(GuessArena pluginArena, GuessTheme.Difficulty difficulty) {
|
||||
|
||||
List<String> themes = pluginArena.getPlugin().getThemeManager()
|
||||
.getThemes(ThemeManager.GameThemes.getByDifficulty(difficulty));
|
||||
List<String> themesFilter = new ArrayList<>(themes);
|
||||
themesFilter.removeAll(pluginArena.getPlayedThemes());
|
||||
if (themesFilter.isEmpty()) {
|
||||
|
||||
themesFilter = themes;
|
||||
|
||||
}
|
||||
|
||||
String unmatchedThemes = themesFilter.get(getPlugin().getRandom().nextInt(themesFilter.size()));
|
||||
ArrayList<String> themeNames = new ArrayList<>(Arrays.asList(unmatchedThemes.split("\\s*,\\s*")));
|
||||
if (themeNames.isEmpty()) {
|
||||
|
||||
pluginArena.getPlugin().getDebugger().debug(Level.WARNING,
|
||||
"&cThemes.yml broken. Th following line was found " + unmatchedThemes
|
||||
+ " ! Please remove empty lines!");
|
||||
|
||||
}
|
||||
|
||||
GuessTheme theme = new GuessTheme(themeNames, difficulty);
|
||||
pluginArena.getPlayedThemes().add(unmatchedThemes);
|
||||
return theme;
|
||||
|
||||
}
|
||||
|
||||
private void setTheme(GuessArena pluginArena, GuessTheme theme) {
|
||||
|
||||
pluginArena.setCurrentTheme(theme);
|
||||
|
||||
}
|
||||
|
||||
private void adjustStatistics(GuessArena pluginArena) {
|
||||
|
||||
for (Plot plot : pluginArena.getPlotManager().getTopPlotsOrder()) {
|
||||
|
||||
plot.getMembers().forEach(player -> {
|
||||
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
/*
|
||||
* //ToDo GTB stats if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST")) {
|
||||
* user.setStatistic("POINTS_HIGHEST", plot.getPoints()); }
|
||||
*/
|
||||
user.adjustStatistic("POINTS_TOTAL", plot.getPoints());
|
||||
if (plot == pluginArena.getWinnerPlot()) {
|
||||
|
||||
user.adjustStatistic("WINS", 1);
|
||||
|
||||
} else {
|
||||
|
||||
user.adjustStatistic("LOSES", 1);
|
||||
|
||||
}
|
||||
|
||||
getPlugin().getUserManager().addExperience(player, 5);
|
||||
|
||||
/*
|
||||
* if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST_WIN")) {
|
||||
* user.setStatistic("POINTS_HIGHEST_WIN", plot.getPoints()); }
|
||||
*/
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleBuildTime(GuessArena pluginArena) {
|
||||
|
||||
int timer = pluginArena.getTimer();
|
||||
|
||||
for (int timers : getPlugin().getConfig().getIntegerList("Time-Manager.Time-Left-Intervals")) {
|
||||
|
||||
if (timers == timer) {
|
||||
|
||||
pluginArena.sendBuildLeftTimeMessage();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pluginArena.checkPlayerOutSidePlot();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,30 +28,39 @@ import plugily.projects.minigamesbox.classic.arena.states.PluginStartingState;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>Created at 03.06.2019
|
||||
* <p>
|
||||
* Created at 03.06.2019
|
||||
*/
|
||||
public class StartingState extends PluginStartingState {
|
||||
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
super.handleCall(arena);
|
||||
GuessArena pluginArena = (GuessArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if (pluginArena == null) {
|
||||
return;
|
||||
@Override
|
||||
public void handleCall(PluginArena arena) {
|
||||
|
||||
super.handleCall(arena);
|
||||
GuessArena pluginArena = (GuessArena) getPlugin().getArenaRegistry().getArena(arena.getId());
|
||||
if (pluginArena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (arena.getTimer() == 0 || arena.isForceStart()) {
|
||||
|
||||
pluginArena.setParticleRefreshScheduler(new ParticleRefreshScheduler(getPlugin()));
|
||||
if (!pluginArena.getPlotManager().isPlotsCleared()) {
|
||||
|
||||
pluginArena.getPlotManager().resetQueuedPlots();
|
||||
|
||||
}
|
||||
|
||||
pluginArena.distributePlots();
|
||||
|
||||
setArenaTimer(getPlugin().getConfig()
|
||||
.getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (arena.getTimer() == 0 || arena.isForceStart()) {
|
||||
pluginArena.setParticleRefreshScheduler(new ParticleRefreshScheduler(getPlugin()));
|
||||
if(!pluginArena.getPlotManager().isPlotsCleared()) {
|
||||
pluginArena.getPlotManager().resetQueuedPlots();
|
||||
}
|
||||
|
||||
pluginArena.distributePlots();
|
||||
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -37,88 +37,131 @@ import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPla
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class VoteEvents implements Listener {
|
||||
|
||||
private final Main plugin;
|
||||
private final Main plugin;
|
||||
|
||||
public VoteEvents(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
public VoteEvents(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
@EventHandler
|
||||
public void onVote(PlugilyPlayerInteractEvent event) {
|
||||
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.PHYSICAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(VersionUtils.checkOffHand(event.getHand())) {
|
||||
return;
|
||||
}
|
||||
@EventHandler
|
||||
public void onVote(PlugilyPlayerInteractEvent event) {
|
||||
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME || arena instanceof GuessArena) {
|
||||
return;
|
||||
}
|
||||
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK
|
||||
|| event.getAction() == Action.PHYSICAL)
|
||||
{
|
||||
|
||||
BuildArena solo = (BuildArena) arena;
|
||||
if(solo.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
Plot plot = solo.getVotingPlot();
|
||||
|
||||
if(plugin.getVoteItems().getReportItem().equals(event.getItem())) {
|
||||
IUser user = plugin.getUserManager().getUser(event.getPlayer());
|
||||
|
||||
user.adjustStatistic("REPORTS_TRIGGERED", 1);
|
||||
|
||||
if(plot != null && plugin.getConfigPreferences().getOption("REPORT_COMMANDS")) {
|
||||
int reportsAmountNeeded = plugin.getConfig().getInt("Report.Amount", -1);
|
||||
|
||||
if(reportsAmountNeeded == -1 || user.getStatistic("REPORTS_TRIGGERED") >= reportsAmountNeeded) {
|
||||
String reportCommand = plugin.getConfig().getString("Report.Execute", "kick %reported%");
|
||||
reportCommand = reportCommand.replace("%reporter%", event.getPlayer().getName());
|
||||
|
||||
for(org.bukkit.entity.Player player : plot.getMembers()) {
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
|
||||
reportCommand.replace("%reported%", player.getName()));
|
||||
}
|
||||
|
||||
event.getPlayer().getInventory().remove(event.getItem());
|
||||
event.getPlayer().updateInventory();
|
||||
|
||||
plugin.getRewardsHandler().performReward(event.getPlayer(), arena, plugin.getRewardsHandler().getRewardType("REPORT"));
|
||||
}
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (VersionUtils.checkOffHand(event.getHand())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
if (arena == null || arena.getArenaState() != IArenaState.IN_GAME || arena instanceof GuessArena) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BuildArena solo = (BuildArena) arena;
|
||||
if (solo.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = solo.getVotingPlot();
|
||||
|
||||
if (plugin.getVoteItems().getReportItem().equals(event.getItem())) {
|
||||
|
||||
IUser user = plugin.getUserManager().getUser(event.getPlayer());
|
||||
|
||||
user.adjustStatistic("REPORTS_TRIGGERED", 1);
|
||||
|
||||
if (plot != null && plugin.getConfigPreferences().getOption("REPORT_COMMANDS")) {
|
||||
|
||||
int reportsAmountNeeded = plugin.getConfig().getInt("Report.Amount", -1);
|
||||
|
||||
if (reportsAmountNeeded == -1 || user.getStatistic("REPORTS_TRIGGERED") >= reportsAmountNeeded) {
|
||||
|
||||
String reportCommand = plugin.getConfig().getString("Report.Execute", "kick %reported%");
|
||||
reportCommand = reportCommand.replace("%reporter%", event.getPlayer().getName());
|
||||
|
||||
for (org.bukkit.entity.Player player : plot.getMembers()) {
|
||||
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
|
||||
reportCommand.replace("%reported%", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
event.getPlayer().getInventory().remove(event.getItem());
|
||||
event.getPlayer().updateInventory();
|
||||
|
||||
plugin.getRewardsHandler().performReward(event.getPlayer(), arena,
|
||||
plugin.getRewardsHandler().getRewardType("REPORT"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (plot != null && plot.getMembers().contains(event.getPlayer())) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_OWN").asKey().arena(arena)
|
||||
.player(event.getPlayer()).sendPlayer();
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
VoteItems.VoteItem voteItem = plugin.getVoteItems().getVoteItem(event.getItem());
|
||||
if (voteItem != null) {
|
||||
|
||||
plugin.getUserManager().getUser(event.getPlayer()).setStatistic("LOCAL_POINTS",
|
||||
plugin.getVoteItems().getPointsAndPlayVoteSound(event.getPlayer(), voteItem));
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_SUCCESS").asKey()
|
||||
.value(ComplementAccessor.getComplement().getDisplayName(voteItem.getItemStack().getItemMeta()))
|
||||
.arena(arena).player(event.getPlayer()).sendPlayer();
|
||||
if (arena.getArenaType() == BaseArena.ArenaType.TEAM) {
|
||||
|
||||
plot.getMembers().forEach(player -> {
|
||||
|
||||
plugin.getUserManager().getUser(player).setStatistic("LOCAL_POINTS",
|
||||
plugin.getVoteItems().getPointsAndPlayVoteSound(player, voteItem));
|
||||
if (player != event.getPlayer()) {
|
||||
|
||||
// todo add by who
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_SUCCESS").asKey()
|
||||
.value(ComplementAccessor.getComplement()
|
||||
.getDisplayName(voteItem.getItemStack().getItemMeta()))
|
||||
.arena(arena).player(event.getPlayer()).send(player);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
if(plot != null && plot.getMembers().contains(event.getPlayer())) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_OWN").asKey().arena(arena).player(event.getPlayer()).sendPlayer();
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
VoteItems.VoteItem voteItem = plugin.getVoteItems().getVoteItem(event.getItem());
|
||||
if(voteItem != null) {
|
||||
plugin.getUserManager().getUser(event.getPlayer()).setStatistic("LOCAL_POINTS", plugin.getVoteItems().getPointsAndPlayVoteSound(event.getPlayer(), voteItem));
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_SUCCESS").asKey().value(ComplementAccessor.getComplement().getDisplayName(voteItem.getItemStack().getItemMeta())).arena(arena).player(event.getPlayer()).sendPlayer();
|
||||
if(arena.getArenaType() == BaseArena.ArenaType.TEAM) {
|
||||
plot.getMembers().forEach(player -> {
|
||||
plugin.getUserManager().getUser(player).setStatistic("LOCAL_POINTS", plugin.getVoteItems().getPointsAndPlayVoteSound(player, voteItem));
|
||||
if(player != event.getPlayer()) {
|
||||
//todo add by who
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_VOTING_SUCCESS").asKey().value(ComplementAccessor.getComplement().getDisplayName(voteItem.getItemStack().getItemMeta())).arena(arena).player(event.getPlayer()).send(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,159 +41,232 @@ import java.util.Set;
|
||||
*/
|
||||
public class VoteItems {
|
||||
|
||||
private final Set<VoteItem> voteItems = new HashSet<>();
|
||||
private final FileConfiguration config;
|
||||
private final Main plugin;
|
||||
private final Set<VoteItem> voteItems = new HashSet<>();
|
||||
private final FileConfiguration config;
|
||||
private final Main plugin;
|
||||
|
||||
private ItemStack reportItem = new ItemStack(Material.BEDROCK, 32);
|
||||
private VoteItem reportVoteItem = new VoteItem(new ItemStack(Material.BEDROCK, 32), 8, 8 + 1, XSound.ENTITY_ARROW_HIT.parseSound());
|
||||
private ItemStack reportItem = new ItemStack(Material.BEDROCK, 32);
|
||||
private VoteItem reportVoteItem = new VoteItem(new ItemStack(Material.BEDROCK, 32), 8, 8 + 1,
|
||||
XSound.ENTITY_ARROW_HIT.parseSound());
|
||||
|
||||
public VoteItems(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
config = ConfigUtils.getConfig(plugin, "vote_items");
|
||||
public VoteItems(Main plugin) {
|
||||
|
||||
updateVoteItemsConfig();
|
||||
loadVoteItems();
|
||||
}
|
||||
this.plugin = plugin;
|
||||
config = ConfigUtils.getConfig(plugin, "vote_items");
|
||||
|
||||
private void loadVoteItems() {
|
||||
for(String key : config.getKeys(false)) {
|
||||
String displayName = config.getString(key + ".displayname", null);
|
||||
updateVoteItemsConfig();
|
||||
loadVoteItems();
|
||||
|
||||
if(displayName == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemBuilder(XMaterial.matchXMaterial(config.getString(key + ".material-name", "BEDROCK")
|
||||
.toUpperCase(java.util.Locale.ENGLISH)).orElse(XMaterial.BEDROCK).parseItem())
|
||||
.name(new MessageBuilder(displayName).build())
|
||||
.build();
|
||||
|
||||
Sound sound = XSound.matchXSound(config.getString(key + ".sound", "")).orElse(XSound.BLOCK_ANVIL_HIT).parseSound();
|
||||
|
||||
int slot;
|
||||
try {
|
||||
slot = Integer.parseInt(key);
|
||||
} catch(NumberFormatException e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
VoteItem voteItem = new VoteItem(stack, slot, slot + 1, sound);
|
||||
|
||||
if(config.getBoolean(key + ".report-item-function", false)) {
|
||||
reportItem = stack;
|
||||
reportVoteItem = voteItem;
|
||||
}
|
||||
|
||||
voteItems.add(voteItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVoteItemsConfig() {
|
||||
for(String key : config.getKeys(false)) {
|
||||
if(!config.isSet(key + ".displayname") || config.isSet(key + ".material-name")) {
|
||||
continue;
|
||||
}
|
||||
config.set(key + ".material-name", XMaterial.GREEN_TERRACOTTA.name());
|
||||
plugin.getDebugger().debug("Found outdated item in vote_items.yml! We've converted it to the newest version!");
|
||||
}
|
||||
ConfigUtils.saveConfig(plugin, config, "vote_items");
|
||||
}
|
||||
private void loadVoteItems() {
|
||||
|
||||
public void giveVoteItems(Player player) {
|
||||
for(VoteItem voteItem : voteItems) {
|
||||
player.getInventory().setItem(voteItem.slot, voteItem.itemStack);
|
||||
}
|
||||
player.updateInventory();
|
||||
}
|
||||
for (String key : config.getKeys(false)) {
|
||||
|
||||
String displayName = config.getString(key + ".displayname", null);
|
||||
|
||||
if (displayName == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemBuilder(XMaterial
|
||||
.matchXMaterial(
|
||||
config.getString(key + ".material-name", "BEDROCK").toUpperCase(java.util.Locale.ENGLISH))
|
||||
.orElse(XMaterial.BEDROCK).parseItem()).name(new MessageBuilder(displayName).build()).build();
|
||||
|
||||
Sound sound = XSound.matchXSound(config.getString(key + ".sound", "")).orElse(XSound.BLOCK_ANVIL_HIT)
|
||||
.parseSound();
|
||||
|
||||
int slot;
|
||||
try {
|
||||
|
||||
slot = Integer.parseInt(key);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
VoteItem voteItem = new VoteItem(stack, slot, slot + 1, sound);
|
||||
|
||||
if (config.getBoolean(key + ".report-item-function", false)) {
|
||||
|
||||
reportItem = stack;
|
||||
reportVoteItem = voteItem;
|
||||
|
||||
}
|
||||
|
||||
voteItems.add(voteItem);
|
||||
|
||||
public void playVoteSound(Player player, ItemStack itemStack) {
|
||||
for(VoteItem item : voteItems) {
|
||||
if(item.itemStack.isSimilar(itemStack)) {
|
||||
if(item.sound == null) {
|
||||
return;
|
||||
}
|
||||
player.playSound(player.getLocation(), item.sound, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get points value of target vote item stack
|
||||
*
|
||||
* @param itemStack item stack to get points value from
|
||||
* @return points
|
||||
*/
|
||||
public int getPoints(ItemStack itemStack) {
|
||||
for(VoteItem item : voteItems) {
|
||||
if(item.itemStack.isSimilar(itemStack)) {
|
||||
return item.points;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getPointsAndPlayVoteSound(Player player, VoteItem voteItem) {
|
||||
if(voteItem.sound == null) {
|
||||
return voteItem.points;
|
||||
}
|
||||
player.playSound(player.getLocation(), voteItem.sound, 1, 1);
|
||||
return voteItem.points;
|
||||
}
|
||||
|
||||
public VoteItem getVoteItem(ItemStack itemStack) {
|
||||
for(VoteItem item : voteItems) {
|
||||
if(item.itemStack.isSimilar(itemStack)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return itemStack that represents report building function
|
||||
*/
|
||||
public ItemStack getReportItem() {
|
||||
return reportItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return itemStack that represents report building function
|
||||
*/
|
||||
public VoteItem getReportVoteItem() {
|
||||
return reportVoteItem;
|
||||
}
|
||||
|
||||
public static class VoteItem {
|
||||
|
||||
private final ItemStack itemStack;
|
||||
private final int slot;
|
||||
private final int points;
|
||||
private final Sound sound;
|
||||
|
||||
public VoteItem(ItemStack itemStack, int slot, int points, Sound sound) {
|
||||
this.itemStack = itemStack;
|
||||
this.slot = slot;
|
||||
this.points = points;
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
private void updateVoteItemsConfig() {
|
||||
|
||||
for (String key : config.getKeys(false)) {
|
||||
|
||||
if (!config.isSet(key + ".displayname") || config.isSet(key + ".material-name")) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
config.set(key + ".material-name", XMaterial.GREEN_TERRACOTTA.name());
|
||||
plugin.getDebugger()
|
||||
.debug("Found outdated item in vote_items.yml! We've converted it to the newest version!");
|
||||
|
||||
}
|
||||
|
||||
ConfigUtils.saveConfig(plugin, config, "vote_items");
|
||||
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
public void giveVoteItems(Player player) {
|
||||
|
||||
for (VoteItem voteItem : voteItems) {
|
||||
|
||||
player.getInventory().setItem(voteItem.slot, voteItem.itemStack);
|
||||
|
||||
}
|
||||
|
||||
player.updateInventory();
|
||||
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points;
|
||||
public void playVoteSound(Player player, ItemStack itemStack) {
|
||||
|
||||
for (VoteItem item : voteItems) {
|
||||
|
||||
if (item.itemStack.isSimilar(itemStack)) {
|
||||
|
||||
if (item.sound == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), item.sound, 1, 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Sound getSound() {
|
||||
return sound;
|
||||
/**
|
||||
* Get points value of target vote item stack
|
||||
*
|
||||
* @param itemStack item stack to get points value from
|
||||
* @return points
|
||||
*/
|
||||
public int getPoints(ItemStack itemStack) {
|
||||
|
||||
for (VoteItem item : voteItems) {
|
||||
|
||||
if (item.itemStack.isSimilar(itemStack)) {
|
||||
|
||||
return item.points;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
public int getPointsAndPlayVoteSound(Player player, VoteItem voteItem) {
|
||||
|
||||
if (voteItem.sound == null) {
|
||||
|
||||
return voteItem.points;
|
||||
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), voteItem.sound, 1, 1);
|
||||
return voteItem.points;
|
||||
|
||||
}
|
||||
|
||||
public VoteItem getVoteItem(ItemStack itemStack) {
|
||||
|
||||
for (VoteItem item : voteItems) {
|
||||
|
||||
if (item.itemStack.isSimilar(itemStack)) {
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return itemStack that represents report building function
|
||||
*/
|
||||
public ItemStack getReportItem() {
|
||||
|
||||
return reportItem;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return itemStack that represents report building function
|
||||
*/
|
||||
public VoteItem getReportVoteItem() {
|
||||
|
||||
return reportVoteItem;
|
||||
|
||||
}
|
||||
|
||||
public static class VoteItem {
|
||||
|
||||
private final ItemStack itemStack;
|
||||
private final int slot;
|
||||
private final int points;
|
||||
private final Sound sound;
|
||||
|
||||
public VoteItem(ItemStack itemStack, int slot, int points, Sound sound) {
|
||||
|
||||
this.itemStack = itemStack;
|
||||
this.slot = slot;
|
||||
this.points = points;
|
||||
this.sound = sound;
|
||||
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
|
||||
return itemStack;
|
||||
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
|
||||
return slot;
|
||||
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
|
||||
return points;
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Sound getSound() {
|
||||
|
||||
return sound;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,79 +35,104 @@ import plugily.projects.minigamesbox.classic.preferences.ConfigOption;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 15.10.2022
|
||||
* <p>
|
||||
* Created at 15.10.2022
|
||||
*/
|
||||
public class AdditionalValueInitializer {
|
||||
|
||||
private final Main plugin;
|
||||
private final Main plugin;
|
||||
|
||||
public AdditionalValueInitializer(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
registerConfigOptions();
|
||||
registerStatistics();
|
||||
registerPermission();
|
||||
registerRewards();
|
||||
registerSpecialItems();
|
||||
registerArenaOptions();
|
||||
}
|
||||
public AdditionalValueInitializer(Main plugin) {
|
||||
|
||||
private void registerConfigOptions() {
|
||||
IConfigPreferences configPreferences = plugin.getConfigPreferences();
|
||||
this.plugin = plugin;
|
||||
registerConfigOptions();
|
||||
registerStatistics();
|
||||
registerPermission();
|
||||
registerRewards();
|
||||
registerSpecialItems();
|
||||
registerArenaOptions();
|
||||
|
||||
configPreferences.registerOption("MOB_SPAWN", new ConfigOption("Mob.Spawn", false));
|
||||
configPreferences.registerOption("HEAD_MENU_CUSTOM", new ConfigOption("Head-Menu.Custom", false));
|
||||
configPreferences.registerOption("REPORT_COMMANDS", new ConfigOption("Report.Commands", false));
|
||||
configPreferences.registerOption("PLOT_HIDE_OWNER", new ConfigOption("Plot.Hide-Owner", false));
|
||||
configPreferences.registerOption("PLOT_MOVE_OUTSIDE", new ConfigOption("Plot.Move-Outside", false));
|
||||
configPreferences.registerOption("SUPER_VOTES", new ConfigOption("Super-Votes", true));
|
||||
}
|
||||
}
|
||||
|
||||
private void registerStatistics() {
|
||||
StatsStorage statsStorage = plugin.getStatsStorage();
|
||||
private void registerConfigOptions() {
|
||||
|
||||
statsStorage.registerStatistic("BLOCKS_PLACED", new StatisticType("blocks_placed", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("BLOCKS_BROKEN", new StatisticType("blocks_broken", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("POINTS_HIGHEST", new StatisticType("points_highest", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("POINTS_HIGHEST_WIN", new StatisticType("points_highest_win", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("POINTS_TOTAL", new StatisticType("points_total", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("PARTICLES_USED", new StatisticType("particles_used", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("SUPER_VOTES", new StatisticType("super_votes", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("LOCAL_POINTS", new StatisticType("local_points", false, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("LOCAL_POINTS_GTB", new StatisticType("local_points_gtb", false, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("REPORTS_TRIGGERED", new StatisticType("reports_triggered", false, "int(11) NOT NULL DEFAULT '0'"));
|
||||
}
|
||||
IConfigPreferences configPreferences = plugin.getConfigPreferences();
|
||||
|
||||
private void registerPermission() {
|
||||
PermissionsManager permissionsManager = plugin.getPermissionsManager();
|
||||
configPreferences.registerOption("MOB_SPAWN", new ConfigOption("Mob.Spawn", false));
|
||||
configPreferences.registerOption("HEAD_MENU_CUSTOM", new ConfigOption("Head-Menu.Custom", false));
|
||||
configPreferences.registerOption("REPORT_COMMANDS", new ConfigOption("Report.Commands", false));
|
||||
configPreferences.registerOption("PLOT_HIDE_OWNER", new ConfigOption("Plot.Hide-Owner", false));
|
||||
configPreferences.registerOption("PLOT_MOVE_OUTSIDE", new ConfigOption("Plot.Move-Outside", false));
|
||||
configPreferences.registerOption("SUPER_VOTES", new ConfigOption("Super-Votes", true));
|
||||
|
||||
permissionsManager.registerPermissionCategory("POINTS_BOOSTER", new PermissionCategory("Points-Boost", null));
|
||||
permissionsManager.registerPermissionCategory("VOTING_BOOSTER", new PermissionCategory("Voting-Boost", null));
|
||||
}
|
||||
}
|
||||
|
||||
private void registerRewards() {
|
||||
RewardsFactory rewardsFactory = plugin.getRewardsHandler();
|
||||
private void registerStatistics() {
|
||||
|
||||
rewardsFactory.registerRewardType("GUESS", new RewardType("guessed"));
|
||||
rewardsFactory.registerRewardType("GUESS_ALL", new RewardType("guessed-all"));
|
||||
rewardsFactory.registerRewardType("VOTE", new RewardType("voted"));
|
||||
rewardsFactory.registerRewardType("VOTE_ALL", new RewardType("voted-all"));
|
||||
rewardsFactory.registerRewardType("REPORT", new RewardType("report"));
|
||||
rewardsFactory.registerRewardType("PLACE", new RewardType("place", RewardType.ExecutorType.NUMBER, false));
|
||||
}
|
||||
StatsStorage statsStorage = plugin.getStatsStorage();
|
||||
|
||||
private void registerSpecialItems() {
|
||||
SpecialItemManager specialItemManager = plugin.getSpecialItemManager();
|
||||
statsStorage.registerStatistic("BLOCKS_PLACED",
|
||||
new StatisticType("blocks_placed", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("BLOCKS_BROKEN",
|
||||
new StatisticType("blocks_broken", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("POINTS_HIGHEST",
|
||||
new StatisticType("points_highest", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("POINTS_HIGHEST_WIN",
|
||||
new StatisticType("points_highest_win", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("POINTS_TOTAL",
|
||||
new StatisticType("points_total", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("PARTICLES_USED",
|
||||
new StatisticType("particles_used", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("SUPER_VOTES",
|
||||
new StatisticType("super_votes", true, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("LOCAL_POINTS",
|
||||
new StatisticType("local_points", false, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("LOCAL_POINTS_GTB",
|
||||
new StatisticType("local_points_gtb", false, "int(11) NOT NULL DEFAULT '0'"));
|
||||
statsStorage.registerStatistic("REPORTS_TRIGGERED",
|
||||
new StatisticType("reports_triggered", false, "int(11) NOT NULL DEFAULT '0'"));
|
||||
|
||||
specialItemManager.registerSpecialItem("OPTIONS_MENU", "Options-Menu");
|
||||
specialItemManager.registerSpecialItem("PLOT_SELECTOR", "Plot-Selector");
|
||||
}
|
||||
}
|
||||
|
||||
private void registerArenaOptions() {
|
||||
ArenaOptionManager arenaOptionManager = plugin.getArenaOptionManager();
|
||||
private void registerPermission() {
|
||||
|
||||
PermissionsManager permissionsManager = plugin.getPermissionsManager();
|
||||
|
||||
permissionsManager.registerPermissionCategory("POINTS_BOOSTER", new PermissionCategory("Points-Boost", null));
|
||||
permissionsManager.registerPermissionCategory("VOTING_BOOSTER", new PermissionCategory("Voting-Boost", null));
|
||||
|
||||
}
|
||||
|
||||
private void registerRewards() {
|
||||
|
||||
RewardsFactory rewardsFactory = plugin.getRewardsHandler();
|
||||
|
||||
rewardsFactory.registerRewardType("GUESS", new RewardType("guessed"));
|
||||
rewardsFactory.registerRewardType("GUESS_ALL", new RewardType("guessed-all"));
|
||||
rewardsFactory.registerRewardType("VOTE", new RewardType("voted"));
|
||||
rewardsFactory.registerRewardType("VOTE_ALL", new RewardType("voted-all"));
|
||||
rewardsFactory.registerRewardType("REPORT", new RewardType("report"));
|
||||
rewardsFactory.registerRewardType("PLACE", new RewardType("place", RewardType.ExecutorType.NUMBER, false));
|
||||
|
||||
}
|
||||
|
||||
private void registerSpecialItems() {
|
||||
|
||||
SpecialItemManager specialItemManager = plugin.getSpecialItemManager();
|
||||
|
||||
specialItemManager.registerSpecialItem("OPTIONS_MENU", "Options-Menu");
|
||||
specialItemManager.registerSpecialItem("PLOT_SELECTOR", "Plot-Selector");
|
||||
|
||||
}
|
||||
|
||||
private void registerArenaOptions() {
|
||||
|
||||
ArenaOptionManager arenaOptionManager = plugin.getArenaOptionManager();
|
||||
|
||||
arenaOptionManager.registerArenaOption("IN_PLOT_CHECKER", new ArenaOption("null", 0, true));
|
||||
arenaOptionManager.registerArenaOption("PLOT_MEMBER_SIZE", new ArenaOption("plotmembersize", 1, true));
|
||||
arenaOptionManager.registerArenaOption("GTB_ROUNDS_PER_PLOT", new ArenaOption("roundsperplot", 2, true));
|
||||
|
||||
}
|
||||
|
||||
arenaOptionManager.registerArenaOption("IN_PLOT_CHECKER", new ArenaOption("null", 0, true));
|
||||
arenaOptionManager.registerArenaOption("PLOT_MEMBER_SIZE", new ArenaOption("plotmembersize", 1, true));
|
||||
arenaOptionManager.registerArenaOption("GTB_ROUNDS_PER_PLOT", new ArenaOption("roundsperplot", 2, true));
|
||||
}
|
||||
}
|
||||
@@ -23,151 +23,262 @@ package plugily.projects.buildbattle.boot;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.Message;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageManager;
|
||||
import plugily.projects.minigamesbox.classic.utils.services.locale.Locale;
|
||||
import plugily.projects.minigamesbox.classic.utils.services.locale.LocaleRegistry;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 15.10.2022
|
||||
* <p>
|
||||
* Created at 15.10.2022
|
||||
*/
|
||||
public class MessageInitializer {
|
||||
private final Main plugin;
|
||||
|
||||
public MessageInitializer(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
private final Main plugin;
|
||||
|
||||
public void registerMessages() {
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
public MessageInitializer(Main plugin) {
|
||||
|
||||
messageManager.registerMessage("COMMANDS_THEME_BLACKLISTED", new Message("Commands.Theme-Blacklisted", ""));
|
||||
messageManager.registerMessage("COMMANDS_ADMIN_ADDED_PLOT", new Message("Commands.Admin.Added-Plot", ""));
|
||||
messageManager.registerMessage("SCOREBOARD_THEME_UNKNOWN", new Message("Scoreboard.Theme-Unknown", ""));
|
||||
// scoreboard ingame classic/teams/guess-the-build/guess-the-build-waiting | ending classic/guess-the-build
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_GAME_END_PLACEHOLDERS_WINNER", new Message("In-Game.Messages.Game-End.Placeholders.Winner", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_GAME_END_PLACEHOLDERS_PLACE", new Message("In-Game.Messages.Game-End.Placeholders.Place", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_GAME_END_PLACEHOLDERS_OWN", new Message("In-Game.Messages.Game-End.Placeholders.Own", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_ADMIN_CHANGED_THEME", new Message("In-Game.Messages.Admin.Changed-Theme", ""));
|
||||
this.plugin = plugin;
|
||||
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_", new Message("In-Game.Messages.Plot.", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NOBODY", new Message("In-Game.Messages.Plot.Nobody", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_TIME_LEFT_TITLE", new Message("In-Game.Messages.Plot.Time-Left.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_TIME_LEFT_CHAT", new Message("In-Game.Messages.Plot.Time-Left.Chat", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_LIMIT_ENTITIES", new Message("In-Game.Messages.Plot.Limit.Entities", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_LIMIT_PARTICLES", new Message("In-Game.Messages.Plot.Limit.Particles", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_HEAD", new Message("In-Game.Messages.Plot.Permission.Head", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_PARTICLE", new Message("In-Game.Messages.Plot.Permission.Particle", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_BIOME", new Message("In-Game.Messages.Plot.Permission.Biome", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_OUTSIDE", new Message("In-Game.Messages.Plot.Permission.Outside", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_FLOOR_ITEM", new Message("In-Game.Messages.Plot.Permission.Floor-Item", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_FULL", new Message("In-Game.Messages.Plot.Selector.Full", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_EMPTY", new Message("In-Game.Messages.Plot.Selector.Empty", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_INSIDE", new Message("In-Game.Messages.Plot.Selector.Inside", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_NAME", new Message("In-Game.Messages.Plot.Selector.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_MENU_NAME", new Message("In-Game.Messages.Plot.Selector.Menu-Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_PLOT_CHOOSE", new Message("In-Game.Messages.Plot.Selector.Plot-Choose", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_MEMBER", new Message("In-Game.Messages.Plot.Selector.Member", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_NAME", new Message("In-Game.Messages.Plot.Voting.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_CHAT", new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Chat", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE", new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT", new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Next", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_WAS", new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Was", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_OWN", new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Own", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_SUCCESS", new Message("In-Game.Messages.Plot.Voting.Success", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_WINNER", new Message("In-Game.Messages.Plot.Voting.Winner", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_BUILDER", new Message("In-Game.Messages.Plot.Guess-The-Build.Builder", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_ROUND", new Message("In-Game.Messages.Plot.Guess-The-Build.Round", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_CHARS", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Chars", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_NAME", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_WAS", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Was", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_TITLE", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESSED", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guessed", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_BEING_SELECTED", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Being-Selected", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_TITLE", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_POINTS", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Points", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_GUESSED", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Guessed", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_CANT_TALK", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Cant-Talk", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_BUILDER", new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Builder", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NPC_NAME", new Message("In-Game.Messages.Plot.NPC.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NPC_CREATED", new Message("In-Game.Messages.Plot.NPC.Created", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NPC_CITIZENS", new Message("In-Game.Messages.Plot.NPC.Install-Citizens", ""));
|
||||
}
|
||||
|
||||
public void registerMessages() {
|
||||
|
||||
messageManager.registerMessage("MENU_PERMISSION", new Message("Menu.Permission", ""));
|
||||
messageManager.registerMessage("MENU_BUTTONS_BACK_ITEM_NAME", new Message("Menu.Buttons.Back.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_BUTTONS_BACK_ITEM_LORE", new Message("Menu.Buttons.Back.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_LOCATION", new Message("Menu.Location", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_INVENTORY", new Message("Menu.Option.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_INVENTORY", new Message("Menu.Option.Content.Particle.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_NAME", new Message("Menu.Option.Content.Particle.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_LORE", new Message("Menu.Option.Content.Particle.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_NAME", new Message("Menu.Option.Content.Particle.Item.Remove.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_LORE", new Message("Menu.Option.Content.Particle.Item.Remove.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ADDED", new Message("Menu.Option.Content.Particle.Added", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_REMOVED", new Message("Menu.Option.Content.Particle.Removed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_HEADS_INVENTORY", new Message("Menu.Option.Content.Heads.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_HEADS_ITEM_NAME", new Message("Menu.Option.Content.Heads.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_HEADS_ITEM_LORE", new Message("Menu.Option.Content.Heads.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_FLOOR_ITEM_NAME", new Message("Menu.Option.Content.Floor.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_FLOOR_ITEM_LORE", new Message("Menu.Option.Content.Floor.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_FLOOR_CHANGED", new Message("Menu.Option.Content.Floor.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_INVENTORY", new Message("Menu.Option.Content.Time.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_ITEM_NAME", new Message("Menu.Option.Content.Time.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_ITEM_LORE", new Message("Menu.Option.Content.Time.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_WORLD", new Message("Menu.Option.Content.Time.Type.World", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_DAY", new Message("Menu.Option.Content.Time.Type.Day", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_NOON", new Message("Menu.Option.Content.Time.Type.Noon", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_SUNSET", new Message("Menu.Option.Content.Time.Type.Sunset", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_NIGHT", new Message("Menu.Option.Content.Time.Type.Night", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_MIDNIGHT", new Message("Menu.Option.Content.Time.Type.MidNight", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_SUNRISE", new Message("Menu.Option.Content.Time.Type.Sunrise", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_CHANGED", new Message("Menu.Option.Content.Time.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_INVENTORY", new Message("Menu.Option.Content.Biome.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_ITEM_NAME", new Message("Menu.Option.Content.Biome.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_ITEM_LORE", new Message("Menu.Option.Content.Biome.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_CHANGED", new Message("Menu.Option.Content.Biome.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_INVENTORY", new Message("Menu.Option.Content.Weather.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_ITEM_NAME", new Message("Menu.Option.Content.Weather.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_ITEM_LORE", new Message("Menu.Option.Content.Weather.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_TYPE_DOWNFALL", new Message("Menu.Option.Content.Weather.Type.Downfall", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_TYPE_CLEAR", new Message("Menu.Option.Content.Weather.Type.Clear", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_CHANGED", new Message("Menu.Option.Content.Weather.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_INVENTORY_COLOR", new Message("Menu.Option.Content.Banner.Inventory.Color", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER", new Message("Menu.Option.Content.Banner.Inventory.Layer", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER_COLOR", new Message("Menu.Option.Content.Banner.Inventory.Layer-Color", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_NAME", new Message("Menu.Option.Content.Banner.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_LORE", new Message("Menu.Option.Content.Banner.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_NAME", new Message("Menu.Option.Content.Banner.Item.Create.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_LORE", new Message("Menu.Option.Content.Banner.Item.Create.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_CHANGED", new Message("Menu.Option.Content.Banner.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_RESET_ITEM_NAME", new Message("Menu.Option.Content.Reset.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_RESET_ITEM_LORE", new Message("Menu.Option.Content.Reset.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_RESET_CHAT", new Message("Menu.Option.Content.Reset.Chat", ""));
|
||||
messageManager.registerMessage("MENU_THEME_INVENTORY", new Message("Menu.Theme.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_THEME_ITEM_NAME", new Message("Menu.Theme.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_THEME_ITEM_LORE", new Message("Menu.Theme.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUCCESS", new Message("Menu.Theme.Vote.Success", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_ALREADY", new Message("Menu.Theme.Vote.Already", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUPER_ITEM_NAME", new Message("Menu.Theme.Vote.Super.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUPER_ITEM_LORE", new Message("Menu.Theme.Vote.Super.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUPER_USED", new Message("Menu.Theme.Vote.Super.Used", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_INVENTORY", new Message("Menu.Theme.Guess-The-Build.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_ITEM_NAME", new Message("Menu.Theme.Guess-The-Build.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_ITEM_LORE", new Message("Menu.Theme.Guess-The-Build.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_DIFFICULTIES_EASY", new Message("Menu.Theme.Guess-The-Build.Difficulties.Easy", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_DIFFICULTIES_MEDIUM", new Message("Menu.Theme.Guess-The-Build.Difficulties.Medium", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_DIFFICULTIES_HARD", new Message("Menu.Theme.Guess-The-Build.Difficulties.Hard", ""));
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_POINTS_HIGHEST_WIN", new Message("Leaderboard.Statistics.Highest-Win", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_POINTS_HIGHEST", new Message("Leaderboard.Statistics.Highest-Points", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_POINTS_TOTAL", new Message("Leaderboard.Statistics.Total-Points-Earned", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_BLOCKS_PLACED", new Message("Leaderboard.Statistics.Blocks-Placed", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_BLOCKS_BROKEN", new Message("Leaderboard.Statistics.Blocks-Broken", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_PARTICLES_USED", new Message("Leaderboard.Statistics.Particles-Placed", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_SUPER_VOTES", new Message("Leaderboard.Statistics.Super-Votes", ""));
|
||||
}
|
||||
messageManager.registerMessage("COMMANDS_THEME_BLACKLISTED", new Message("Commands.Theme-Blacklisted", ""));
|
||||
messageManager.registerMessage("COMMANDS_ADMIN_ADDED_PLOT", new Message("Commands.Admin.Added-Plot", ""));
|
||||
messageManager.registerMessage("SCOREBOARD_THEME_UNKNOWN", new Message("Scoreboard.Theme-Unknown", ""));
|
||||
// scoreboard ingame classic/teams/guess-the-build/guess-the-build-waiting |
|
||||
// ending classic/guess-the-build
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_GAME_END_PLACEHOLDERS_WINNER",
|
||||
new Message("In-Game.Messages.Game-End.Placeholders.Winner", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_GAME_END_PLACEHOLDERS_PLACE",
|
||||
new Message("In-Game.Messages.Game-End.Placeholders.Place", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_GAME_END_PLACEHOLDERS_OWN",
|
||||
new Message("In-Game.Messages.Game-End.Placeholders.Own", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_ADMIN_CHANGED_THEME",
|
||||
new Message("In-Game.Messages.Admin.Changed-Theme", ""));
|
||||
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_", new Message("In-Game.Messages.Plot.", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NOBODY", new Message("In-Game.Messages.Plot.Nobody", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_TIME_LEFT_TITLE",
|
||||
new Message("In-Game.Messages.Plot.Time-Left.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_TIME_LEFT_CHAT",
|
||||
new Message("In-Game.Messages.Plot.Time-Left.Chat", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_LIMIT_ENTITIES",
|
||||
new Message("In-Game.Messages.Plot.Limit.Entities", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_LIMIT_PARTICLES",
|
||||
new Message("In-Game.Messages.Plot.Limit.Particles", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_HEAD",
|
||||
new Message("In-Game.Messages.Plot.Permission.Head", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_PARTICLE",
|
||||
new Message("In-Game.Messages.Plot.Permission.Particle", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_BIOME",
|
||||
new Message("In-Game.Messages.Plot.Permission.Biome", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_OUTSIDE",
|
||||
new Message("In-Game.Messages.Plot.Permission.Outside", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_PERMISSION_FLOOR_ITEM",
|
||||
new Message("In-Game.Messages.Plot.Permission.Floor-Item", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_FULL",
|
||||
new Message("In-Game.Messages.Plot.Selector.Full", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_EMPTY",
|
||||
new Message("In-Game.Messages.Plot.Selector.Empty", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_INSIDE",
|
||||
new Message("In-Game.Messages.Plot.Selector.Inside", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_NAME",
|
||||
new Message("In-Game.Messages.Plot.Selector.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_MENU_NAME",
|
||||
new Message("In-Game.Messages.Plot.Selector.Menu-Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_PLOT_CHOOSE",
|
||||
new Message("In-Game.Messages.Plot.Selector.Plot-Choose", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_SELECTOR_MEMBER",
|
||||
new Message("In-Game.Messages.Plot.Selector.Member", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_NAME",
|
||||
new Message("In-Game.Messages.Plot.Voting.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_CHAT",
|
||||
new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Chat", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE",
|
||||
new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_NEXT",
|
||||
new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Next", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_WAS",
|
||||
new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Was", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_OWN",
|
||||
new Message("In-Game.Messages.Plot.Voting.Plot-Owner.Own", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_SUCCESS",
|
||||
new Message("In-Game.Messages.Plot.Voting.Success", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_VOTING_WINNER",
|
||||
new Message("In-Game.Messages.Plot.Voting.Winner", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_ROUND_START",
|
||||
new Message("In-Game.Messages.Plot.Round.Start", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_ROUND_TITLE",
|
||||
new Message("In-Game.Messages.Plot.Round.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_BUILDER",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Builder", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_ROUND",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Round", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_CHARS",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Chars", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_NAME",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_WAS",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Was", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_TITLE",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESSED",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guessed", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_BEING_SELECTED",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Being-Selected", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_TITLE",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Title", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_POINTS",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Points", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_GUESSED",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Guessed", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_CANT_TALK",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Cant-Talk", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_BUILDER",
|
||||
new Message("In-Game.Messages.Plot.Guess-The-Build.Theme.Guess.Builder", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NPC_NAME",
|
||||
new Message("In-Game.Messages.Plot.NPC.Name", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NPC_CREATED",
|
||||
new Message("In-Game.Messages.Plot.NPC.Created", ""));
|
||||
messageManager.registerMessage("IN_GAME_MESSAGES_PLOT_NPC_CITIZENS",
|
||||
new Message("In-Game.Messages.Plot.NPC.Install-Citizens", ""));
|
||||
|
||||
messageManager.registerMessage("MENU_PERMISSION", new Message("Menu.Permission", ""));
|
||||
messageManager.registerMessage("MENU_BUTTONS_BACK_ITEM_NAME", new Message("Menu.Buttons.Back.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_BUTTONS_BACK_ITEM_LORE", new Message("Menu.Buttons.Back.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_LOCATION", new Message("Menu.Location", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_INVENTORY", new Message("Menu.Option.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_INVENTORY",
|
||||
new Message("Menu.Option.Content.Particle.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Particle.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Particle.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_NAME",
|
||||
new Message("Menu.Option.Content.Particle.Item.Remove.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_LORE",
|
||||
new Message("Menu.Option.Content.Particle.Item.Remove.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_ADDED",
|
||||
new Message("Menu.Option.Content.Particle.Added", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_PARTICLE_REMOVED",
|
||||
new Message("Menu.Option.Content.Particle.Removed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_HEADS_INVENTORY",
|
||||
new Message("Menu.Option.Content.Heads.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_HEADS_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Heads.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_HEADS_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Heads.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_HEADS_DATABASE_LORE",
|
||||
new Message("Menu.Option.Content.Heads.Database.Lore", "Get Head %value%"));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_FLOOR_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Floor.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_FLOOR_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Floor.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_FLOOR_CHANGED",
|
||||
new Message("Menu.Option.Content.Floor.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_INVENTORY",
|
||||
new Message("Menu.Option.Content.Time.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Time.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Time.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_WORLD",
|
||||
new Message("Menu.Option.Content.Time.Type.World", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_DAY",
|
||||
new Message("Menu.Option.Content.Time.Type.Day", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_NOON",
|
||||
new Message("Menu.Option.Content.Time.Type.Noon", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_SUNSET",
|
||||
new Message("Menu.Option.Content.Time.Type.Sunset", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_NIGHT",
|
||||
new Message("Menu.Option.Content.Time.Type.Night", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_MIDNIGHT",
|
||||
new Message("Menu.Option.Content.Time.Type.MidNight", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_TYPE_SUNRISE",
|
||||
new Message("Menu.Option.Content.Time.Type.Sunrise", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_TIME_CHANGED",
|
||||
new Message("Menu.Option.Content.Time.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_INVENTORY",
|
||||
new Message("Menu.Option.Content.Biome.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Biome.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Biome.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BIOME_CHANGED",
|
||||
new Message("Menu.Option.Content.Biome.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_INVENTORY",
|
||||
new Message("Menu.Option.Content.Weather.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Weather.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Weather.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_TYPE_DOWNFALL",
|
||||
new Message("Menu.Option.Content.Weather.Type.Downfall", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_TYPE_CLEAR",
|
||||
new Message("Menu.Option.Content.Weather.Type.Clear", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_WEATHER_CHANGED",
|
||||
new Message("Menu.Option.Content.Weather.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_INVENTORY_COLOR",
|
||||
new Message("Menu.Option.Content.Banner.Inventory.Color", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER",
|
||||
new Message("Menu.Option.Content.Banner.Inventory.Layer", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER_COLOR",
|
||||
new Message("Menu.Option.Content.Banner.Inventory.Layer-Color", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Banner.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Banner.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_NAME",
|
||||
new Message("Menu.Option.Content.Banner.Item.Create.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_LORE",
|
||||
new Message("Menu.Option.Content.Banner.Item.Create.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_BANNER_CHANGED",
|
||||
new Message("Menu.Option.Content.Banner.Changed", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_RESET_ITEM_NAME",
|
||||
new Message("Menu.Option.Content.Reset.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_RESET_ITEM_LORE",
|
||||
new Message("Menu.Option.Content.Reset.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_OPTION_CONTENT_RESET_CHAT",
|
||||
new Message("Menu.Option.Content.Reset.Chat", ""));
|
||||
messageManager.registerMessage("MENU_THEME_INVENTORY", new Message("Menu.Theme.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_THEME_ITEM_NAME", new Message("Menu.Theme.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_THEME_ITEM_LORE", new Message("Menu.Theme.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUCCESS", new Message("Menu.Theme.Vote.Success", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_ALREADY", new Message("Menu.Theme.Vote.Already", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUPER_ITEM_NAME",
|
||||
new Message("Menu.Theme.Vote.Super.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUPER_ITEM_LORE",
|
||||
new Message("Menu.Theme.Vote.Super.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_THEME_VOTE_SUPER_USED", new Message("Menu.Theme.Vote.Super.Used", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_INVENTORY",
|
||||
new Message("Menu.Theme.Guess-The-Build.Inventory", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_ITEM_NAME",
|
||||
new Message("Menu.Theme.Guess-The-Build.Item.Name", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_ITEM_LORE",
|
||||
new Message("Menu.Theme.Guess-The-Build.Item.Lore", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_DIFFICULTIES_EASY",
|
||||
new Message("Menu.Theme.Guess-The-Build.Difficulties.Easy", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_DIFFICULTIES_MEDIUM",
|
||||
new Message("Menu.Theme.Guess-The-Build.Difficulties.Medium", ""));
|
||||
messageManager.registerMessage("MENU_THEME_GTB_DIFFICULTIES_HARD",
|
||||
new Message("Menu.Theme.Guess-The-Build.Difficulties.Hard", ""));
|
||||
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_POINTS_HIGHEST_WIN",
|
||||
new Message("Leaderboard.Statistics.Highest-Win", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_POINTS_HIGHEST",
|
||||
new Message("Leaderboard.Statistics.Highest-Points", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_POINTS_TOTAL",
|
||||
new Message("Leaderboard.Statistics.Total-Points-Earned", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_BLOCKS_PLACED",
|
||||
new Message("Leaderboard.Statistics.Blocks-Placed", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_BLOCKS_BROKEN",
|
||||
new Message("Leaderboard.Statistics.Blocks-Broken", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_PARTICLES_USED",
|
||||
new Message("Leaderboard.Statistics.Particles-Placed", ""));
|
||||
messageManager.registerMessage("LEADERBOARD_STATISTICS_SUPER_VOTES",
|
||||
new Message("Leaderboard.Statistics.Super-Votes", ""));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
+12
-27
@@ -18,38 +18,23 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package plugily.projects.buildbattle.handlers.themes;
|
||||
package plugily.projects.buildbattle.boot;
|
||||
|
||||
public class BBTheme {
|
||||
import org.bukkit.entity.Player;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import plugily.projects.buildbattle.handlers.stats.BuildBattleScores;
|
||||
|
||||
private final String theme;
|
||||
private final Difficulty difficulty;
|
||||
// Registers the bb_score and bb_rank MiniPlaceholders through Utilities-OG.
|
||||
// Only constructed when Utilities-OG is installed, so its classes stay unloaded otherwise.
|
||||
public class TrueOGPlaceholderInitializer {
|
||||
|
||||
public BBTheme(String theme, Difficulty difficulty) {
|
||||
this.theme = theme == null ? "" : theme;
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
public TrueOGPlaceholderInitializer(BuildBattleScores scores) {
|
||||
|
||||
public String getTheme() {
|
||||
return theme;
|
||||
}
|
||||
UtilitiesOG.registerAudiencePlaceholder("bb_score",
|
||||
(Player player) -> String.valueOf(scores.getPoints(player.getUniqueId())));
|
||||
UtilitiesOG.registerAudiencePlaceholder("bb_rank",
|
||||
(Player player) -> scores.getRank(player.getUniqueId()).getDisplay());
|
||||
|
||||
public Difficulty getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public enum Difficulty {
|
||||
EASY(1), MEDIUM(2), HARD(3);
|
||||
|
||||
private final int pointsReward;
|
||||
|
||||
Difficulty(int pointsReward) {
|
||||
this.pointsReward = pointsReward;
|
||||
}
|
||||
|
||||
public int getPointsReward() {
|
||||
return pointsReward;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package plugily.projects.buildbattle.chat;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.JoinConfiguration;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import nl.skbotnl.chatog.api.WorldChatFormatter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
|
||||
// Renders BuildBattle chat now that Chat-OG owns delivery and the Discord relay.
|
||||
//
|
||||
// The arena is resolved from the sender rather than the lobby id Chat-OG passes, so a spectator or
|
||||
// a staff member standing in an arena world without having joined still falls through to Chat-OG's
|
||||
// default format instead of being labelled as a competitor.
|
||||
//
|
||||
// The theme is never rendered for Guess the Build: it is the answer, and Discord relays this line.
|
||||
//
|
||||
// The name segment mirrors TheHerobrine-OG's formatter: the standard TrueOG
|
||||
// union bracket tag, display name, and LuckPerms suffix, expanded through
|
||||
// MiniPlaceholders with the sender as the audience so the same content reaches
|
||||
// the in-game view and the Discord relay.
|
||||
public class BuildBattleChatFormatter implements WorldChatFormatter {
|
||||
|
||||
private static final String NAME_SEGMENT = "<simpleclans_union_bracket_tag><player_display_name><luckperms_suffix> ";
|
||||
|
||||
private final Main plugin;
|
||||
|
||||
public BuildBattleChatFormatter(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component format(Player sender, Component message, String worldName, String lobbyId) {
|
||||
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(sender);
|
||||
if (arena == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
final Component prefix = UtilitiesOG.trueogExpand(buildPrefix(sender, arena), sender);
|
||||
|
||||
// The caret never inherits bold or colors from the prefix.
|
||||
final Component caret = UtilitiesOG.trueogExpand(getCaretColor(sender) + "> &r", sender)
|
||||
.decoration(TextDecoration.BOLD, false);
|
||||
|
||||
// The message is already sanitised by Chat-OG, so it is composed with rather
|
||||
// than re-parsed.
|
||||
return Component.join(JoinConfiguration.noSeparators(), prefix, caret, message);
|
||||
|
||||
}
|
||||
|
||||
private String buildPrefix(Player player, BaseArena arena) {
|
||||
|
||||
if (arena.getSpectators().contains(player)) {
|
||||
|
||||
return "&4SPEC &8▏ " + NAME_SEGMENT;
|
||||
|
||||
}
|
||||
|
||||
IArenaState state = arena.getArenaState();
|
||||
if (state == IArenaState.WAITING_FOR_PLAYERS || state == IArenaState.STARTING
|
||||
|| state == IArenaState.FULL_GAME)
|
||||
{
|
||||
|
||||
return "&e" + arena.getPlayers().size() + "&7/&e" + arena.getMaximumPlayers() + "&8 ▏ " + NAME_SEGMENT;
|
||||
|
||||
}
|
||||
|
||||
if (state != IArenaState.IN_GAME) {
|
||||
|
||||
return NAME_SEGMENT;
|
||||
|
||||
}
|
||||
|
||||
switch (arena.getArenaInGameState()) {
|
||||
|
||||
case THEME_VOTING:
|
||||
return "&6VOTE &8▏ " + NAME_SEGMENT;
|
||||
case PLOT_VOTING:
|
||||
return "&6JUDGING &8▏ " + NAME_SEGMENT;
|
||||
case BUILD_TIME:
|
||||
// Only a classic/team arena has a theme worth showing; leaking a Guess the
|
||||
// Build theme here would hand the answer to the world and to Discord.
|
||||
String theme = arena instanceof BuildArena ? arena.getTheme() : null;
|
||||
return theme == null || theme.isEmpty() ? NAME_SEGMENT : "&a" + theme + " &8▏ " + NAME_SEGMENT;
|
||||
default:
|
||||
return NAME_SEGMENT;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Expose PlayerUtils.getMessageColor in Chat-OG as a supported API.
|
||||
private String getCaretColor(Player player) {
|
||||
|
||||
try {
|
||||
|
||||
final net.kyori.adventure.text.format.TextColor color = nl.skbotnl.chatog.util.PlayerUtils.INSTANCE
|
||||
.getMessageColor(player.getUniqueId());
|
||||
if (color != null) {
|
||||
|
||||
if (color.equals(NamedTextColor.WHITE)) {
|
||||
|
||||
return "&f";
|
||||
|
||||
} else if (color.equals(NamedTextColor.GRAY)) {
|
||||
|
||||
return "&7";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Throwable ignored) {
|
||||
|
||||
// Chat-OG internals moved or are absent -- fall back to dark gray.
|
||||
|
||||
}
|
||||
|
||||
return "&8";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package plugily.projects.buildbattle.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArenaUtils;
|
||||
|
||||
// Starts the arena the sender is in even when the minimum player count is unmet.
|
||||
// PluginArenaUtils.arenaForceStart owns the permission, state, and timer checks.
|
||||
public class ForceStartCommand implements CommandExecutor {
|
||||
|
||||
private final Main plugin;
|
||||
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
|
||||
|
||||
public ForceStartCommand(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player player)) {
|
||||
|
||||
sender.sendMessage("Only players can use this command.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
int startTime = 0;
|
||||
if (args.length > 0) {
|
||||
|
||||
try {
|
||||
|
||||
startTime = Integer.parseInt(args[0]);
|
||||
|
||||
} catch (NumberFormatException error) {
|
||||
|
||||
send(player, "&cCorrect Usage: /bbforcestart [time]");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PluginArenaUtils.arenaForceStart(player, Math.max(0, startTime));
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private void send(Player player, String message) {
|
||||
|
||||
player.sendMessage(LEGACY_SERIALIZER.deserialize(plugin.getPluginMessagePrefix() + message));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package plugily.projects.buildbattle.commands;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.minigamesbox.classic.utils.serialization.InventorySerializer;
|
||||
|
||||
// /hub and /lobby. Leaves the arena the player is in and sends them back where
|
||||
// they came from, or to main spawn. HubCommandListener routes /hub, /lobby and
|
||||
// /spawn here for anyone inside BuildBattle territory, whichever plugin owns
|
||||
// the bare label.
|
||||
public class HubCommand implements CommandExecutor {
|
||||
|
||||
private final Main plugin;
|
||||
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
|
||||
|
||||
public HubCommand(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player player)) {
|
||||
|
||||
sender.sendMessage("Only players can use this command.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
handle(player);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void handle(Player player) {
|
||||
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if (arena != null) {
|
||||
|
||||
plugin.getArenaManager().hubLeaveAttempt(player, arena);
|
||||
// The MiniGamesBox snapshot belongs to the arena world's MyWorlds inventory,
|
||||
// so it goes back before the teleport home, not over the survival one.
|
||||
InventorySerializer.loadInventory(plugin, player);
|
||||
|
||||
}
|
||||
|
||||
Location savedLoc = plugin.getAndRemovePreJoinLocation(player.getUniqueId());
|
||||
if (savedLoc != null && savedLoc.getWorld() != null) {
|
||||
|
||||
if (!player.teleport(savedLoc)) {
|
||||
|
||||
send(player, "&cUnable to return you to your previous location.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plugin.getBuilderCreativeManager().revoke(player);
|
||||
send(player, "&aReturned to your previous location.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// MyWorlds' main world spawn is what Spawn-OG's /setspawn writes, so this
|
||||
// lands on the server spawn.
|
||||
World mainWorld = findMainWorld();
|
||||
if (mainWorld == null) {
|
||||
|
||||
send(player, "&cNo main world is available.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Location destination = mainWorld.getSpawnLocation();
|
||||
if (!player.teleport(destination)) {
|
||||
|
||||
send(player, "&cUnable to return you to the hub.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plugin.getBuilderCreativeManager().revoke(player);
|
||||
send(player, "&aReturned to the hub.");
|
||||
|
||||
}
|
||||
|
||||
private World findMainWorld() {
|
||||
|
||||
return plugin.getMyWorldsManager().getMainWorld();
|
||||
|
||||
}
|
||||
|
||||
private void send(Player player, String message) {
|
||||
|
||||
player.sendMessage(LEGACY_SERIALIZER.deserialize(plugin.getPluginMessagePrefix() + message));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package plugily.projects.buildbattle.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import plugily.projects.buildbattle.Main;
|
||||
|
||||
// Claims /hub, /lobby and /spawn for arena members and anyone standing in a
|
||||
// configured BuildBattle world. BuildBattle-OG, Splegg-OG and TheHerobrine-OG
|
||||
// all declare /hub, and Bukkit hands the bare label to whichever registered
|
||||
// first, so without this a BuildBattle player's /hub could run another
|
||||
// minigame's command and teleport them out while the arena still counted them;
|
||||
// /spawn from Spawn-OG did the same. Everywhere else the event is left alone.
|
||||
public class HubCommandListener implements Listener {
|
||||
|
||||
private final Main plugin;
|
||||
private final HubCommand hubCommand;
|
||||
|
||||
public HubCommandListener(Main plugin, HubCommand hubCommand) {
|
||||
|
||||
this.plugin = plugin;
|
||||
this.hubCommand = hubCommand;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
|
||||
final String label = commandLabel(event.getMessage());
|
||||
if (!label.equals("hub") && !label.equals("lobby") && !label.equals("spawn")) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
if (plugin.getArenaRegistry().getArena(player) == null
|
||||
&& !plugin.getMyWorldsManager().isConfiguredArenaWorld(player.getWorld().getName()))
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
hubCommand.handle(player);
|
||||
|
||||
}
|
||||
|
||||
// The bare command name in lower case, without the leading slash or a
|
||||
// plugin namespace such as buildbattle-og:hub.
|
||||
static String commandLabel(String message) {
|
||||
|
||||
if (message == null || message.length() < 2 || message.charAt(0) != '/') {
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
final String[] parts = message.substring(1).trim().split("\\s+");
|
||||
if (parts.length == 0) {
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
String label = parts[0].toLowerCase(Locale.ROOT);
|
||||
final int colon = label.indexOf(':');
|
||||
if (colon >= 0) {
|
||||
|
||||
label = label.substring(colon + 1);
|
||||
|
||||
}
|
||||
|
||||
return label;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package plugily.projects.buildbattle.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
|
||||
// Joins a BuildBattle lobby by its id (BB1 or 1); with no id the lobby list is
|
||||
// shown. Maps and themes are not accepted.
|
||||
public class JoinLobbyCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private final Main plugin;
|
||||
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
|
||||
|
||||
public JoinLobbyCommand(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player player)) {
|
||||
|
||||
sender.sendMessage("Only players can use this command.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
|
||||
LobbyList.send(plugin, player);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
final BaseArena arena = LobbyResolver.resolve(plugin, args[0]);
|
||||
if (arena == null) {
|
||||
|
||||
send(player, "&cLobby &e" + args[0] + " &cdoes not exist.");
|
||||
LobbyList.send(plugin, player);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
plugin.getArenaManager().joinAttempt(player, arena);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
|
||||
if (args.length != 1) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
final String prefix = LobbyResolver.normalize(args[0]);
|
||||
final List<String> completions = new ArrayList<>();
|
||||
for (String id : LobbyResolver.lobbyIds(plugin)) {
|
||||
|
||||
if (LobbyResolver.normalize(id).startsWith(prefix)) {
|
||||
|
||||
completions.add(id);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return completions;
|
||||
|
||||
}
|
||||
|
||||
private void send(Player player, String message) {
|
||||
|
||||
player.sendMessage(LEGACY_SERIALIZER.deserialize(plugin.getPluginMessagePrefix() + message));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package plugily.projects.buildbattle.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
|
||||
// The lobby list players see from /bb join and /bbjoin with no lobby named,
|
||||
// TheHerobrine-OG style: one clickable line per arena with its state and fill.
|
||||
public final class LobbyList {
|
||||
|
||||
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
|
||||
|
||||
private LobbyList() {
|
||||
|
||||
}
|
||||
|
||||
public static void send(Main plugin, Player player) {
|
||||
|
||||
final List<IPluginArena> arenas = plugin.getArenaRegistry().getArenas();
|
||||
if (arenas.isEmpty()) {
|
||||
|
||||
send(player, plugin, "&cThere are no BuildBattle lobbies. Create one with /bba setup create <BB1>.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
send(player, plugin, "&6Join a lobby with /bb join <id>.");
|
||||
send(player, plugin, "&6Lobbies available to join:");
|
||||
|
||||
final boolean overfill = player.hasPermission("buildbattle.fullgames");
|
||||
for (IPluginArena arena : arenas) {
|
||||
|
||||
final String id = arena.getId();
|
||||
final int fill = arena.getPlayers().size();
|
||||
final int max = arena.getMaximumPlayers();
|
||||
final String line;
|
||||
final String hover;
|
||||
switch (arena.getArenaState()) {
|
||||
|
||||
case WAITING_FOR_PLAYERS, STARTING, FULL_GAME -> {
|
||||
|
||||
final boolean room = fill < max;
|
||||
final String state = arena.getArenaState() == IArenaState.WAITING_FOR_PLAYERS ? "&e&lWAITING "
|
||||
: "&d&lSTARTING ";
|
||||
line = "&b" + id + ": &e" + fill + "/" + max + "&7 - &r"
|
||||
+ (room ? state + "&r&a(JOIN)" : "&c&lFULL &r" + (overfill ? "&a(JOIN)" : ""));
|
||||
hover = room || overfill ? "&6Click here to join &b" + id : null;
|
||||
|
||||
}
|
||||
case IN_GAME -> {
|
||||
|
||||
line = "&b" + id + ": &e" + fill + " playing&8 - &b&lLIVE &2(SPECTATE)";
|
||||
hover = "&6Click here to spectate &b" + id;
|
||||
|
||||
}
|
||||
case ENDING -> {
|
||||
|
||||
line = "&b" + id + ": &8&lENDING";
|
||||
hover = null;
|
||||
|
||||
}
|
||||
default -> {
|
||||
|
||||
line = "&b" + id + ": &8&lRESTARTING";
|
||||
hover = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TextComponent component = LEGACY_SERIALIZER.deserialize(plugin.getPluginMessagePrefix() + line);
|
||||
if (hover != null) {
|
||||
|
||||
component = component
|
||||
.hoverEvent(HoverEvent.hoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
LEGACY_SERIALIZER.deserialize(hover)))
|
||||
.clickEvent(ClickEvent.runCommand("/bb join " + id));
|
||||
|
||||
} else {
|
||||
|
||||
component = component.hoverEvent(HoverEvent.hoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
LEGACY_SERIALIZER.deserialize("&cThis lobby cannot be joined right now.")));
|
||||
|
||||
}
|
||||
|
||||
player.sendMessage(component);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void send(Player player, Main plugin, String message) {
|
||||
|
||||
player.sendMessage(LEGACY_SERIALIZER.deserialize(plugin.getPluginMessagePrefix() + message));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package plugily.projects.buildbattle.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
|
||||
// Resolves the lobby id a player typed (BB1) to an arena. Bare numbers are
|
||||
// accepted so /bbjoin 1 matches BB1, and matching is case-insensitive.
|
||||
// Map names and themes are never resolvable -- only lobby ids.
|
||||
public final class LobbyResolver {
|
||||
|
||||
private LobbyResolver() {
|
||||
|
||||
}
|
||||
|
||||
public static BaseArena resolve(Main plugin, String input) {
|
||||
|
||||
if (input == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
final String query = input.trim();
|
||||
if (query.isEmpty()) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
for (IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
|
||||
if (arena.getId().equalsIgnoreCase(query)) {
|
||||
|
||||
return plugin.getArenaRegistry().getArena(arena.getId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!isNumber(query)) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
// Bare number: match the trailing digits of a lobby id so "1" finds BB1
|
||||
// whatever prefix the server configured. Ambiguity is a miss, not a guess.
|
||||
final int wanted = Integer.parseInt(query);
|
||||
BaseArena match = null;
|
||||
for (IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
|
||||
if (trailingNumber(arena.getId()) != wanted) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (match != null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
match = plugin.getArenaRegistry().getArena(arena.getId());
|
||||
|
||||
}
|
||||
|
||||
return match;
|
||||
|
||||
}
|
||||
|
||||
public static List<String> lobbyIds(Main plugin) {
|
||||
|
||||
final List<String> ids = new ArrayList<>();
|
||||
for (IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
|
||||
ids.add(arena.getId());
|
||||
|
||||
}
|
||||
|
||||
return ids;
|
||||
|
||||
}
|
||||
|
||||
// Returns the number a lobby id ends with, or -1 when it ends in a letter.
|
||||
private static int trailingNumber(String id) {
|
||||
|
||||
int index = id.length();
|
||||
while (index > 0 && Character.isDigit(id.charAt(index - 1))) {
|
||||
|
||||
index--;
|
||||
|
||||
}
|
||||
|
||||
if (index == id.length()) {
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
return Integer.parseInt(id.substring(index));
|
||||
|
||||
} catch (NumberFormatException error) {
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean isNumber(String value) {
|
||||
|
||||
if (value.length() > 9) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
|
||||
if (!Character.isDigit(value.charAt(i))) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static String normalize(String value) {
|
||||
|
||||
return value == null ? "" : value.toLowerCase(Locale.ROOT);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package plugily.projects.buildbattle.commands;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.handlers.themes.vote.VotePoll;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
|
||||
// Routes /v and /vote to the arena's existing theme poll inside BuildBattle
|
||||
// worlds only. BuildBattle has no map pool, so this drives the poll the vote
|
||||
// menu already owns -- it exists so VotingPlugin cannot own /vote in a lobby.
|
||||
public class VoteCommandListener implements Listener {
|
||||
|
||||
private final Main plugin;
|
||||
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
|
||||
|
||||
public VoteCommandListener(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
|
||||
final String message = event.getMessage();
|
||||
if (message == null || message.length() < 2 || message.charAt(0) != '/') {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final String[] parts = message.substring(1).trim().split("\\s+");
|
||||
if (parts.length == 0 || parts[0].isEmpty()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Drop any namespace prefix (e.g. votingplugin:v) before matching.
|
||||
String label = parts[0].toLowerCase(Locale.ROOT);
|
||||
final int colon = label.indexOf(':');
|
||||
if (colon >= 0) {
|
||||
|
||||
label = label.substring(colon + 1);
|
||||
|
||||
}
|
||||
|
||||
if (!label.equals("v") && !label.equals("vote")) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
final BaseArena arena = resolveArena(player);
|
||||
if (arena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
handleVote(player, arena, parts.length > 1 ? parts[1] : null);
|
||||
|
||||
}
|
||||
|
||||
// Claims the command for an arena member, or for anyone standing in a
|
||||
// configured BuildBattle world. Defers everywhere else.
|
||||
private BaseArena resolveArena(Player player) {
|
||||
|
||||
final BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if (arena != null) {
|
||||
|
||||
return arena;
|
||||
|
||||
}
|
||||
|
||||
return plugin.getMyWorldsManager().isConfiguredArenaWorld(player.getWorld().getName()) ? findWorldArena(player)
|
||||
: null;
|
||||
|
||||
}
|
||||
|
||||
private BaseArena findWorldArena(Player player) {
|
||||
|
||||
final String worldName = player.getWorld().getName();
|
||||
for (String id : LobbyResolver.lobbyIds(plugin)) {
|
||||
|
||||
final BaseArena candidate = plugin.getArenaRegistry().getArena(id);
|
||||
if (candidate == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (matchesWorld(candidate.getLobbyLocation(), worldName)
|
||||
|| matchesWorld(candidate.getStartLocation(), worldName))
|
||||
{
|
||||
|
||||
return candidate;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private boolean matchesWorld(org.bukkit.Location location, String worldName) {
|
||||
|
||||
return location != null && location.getWorld() != null && location.getWorld().getName().equals(worldName);
|
||||
|
||||
}
|
||||
|
||||
private void handleVote(Player player, BaseArena arena, String argument) {
|
||||
|
||||
if (!(arena instanceof BuildArena buildArena)) {
|
||||
|
||||
send(player, "&cThere is nothing to vote for in this game mode.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (arena.getArenaState() != IArenaState.IN_GAME
|
||||
|| arena.getArenaInGameState() != BaseArena.ArenaInGameState.THEME_VOTING)
|
||||
{
|
||||
|
||||
send(player, "&cYou cannot run this command right now.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final VotePoll votePoll = buildArena.getVotePoll();
|
||||
final List<String> themes = buildArena.getVoteMenu().getThemeSelection();
|
||||
if (votePoll == null || themes.isEmpty()) {
|
||||
|
||||
send(player, "&cThere is nothing to vote for right now.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (argument == null) {
|
||||
|
||||
sendThemeList(player, votePoll, themes);
|
||||
buildArena.getVoteMenu().updateInventory(player);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final int choice;
|
||||
try {
|
||||
|
||||
choice = Integer.parseInt(argument);
|
||||
|
||||
} catch (NumberFormatException error) {
|
||||
|
||||
send(player, "&cCorrect Usage: /vote <theme number>");
|
||||
sendThemeList(player, votePoll, themes);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (choice < 1 || choice > themes.size()) {
|
||||
|
||||
send(player, "&cInvalid theme!");
|
||||
sendThemeList(player, votePoll, themes);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final String theme = themes.get(choice - 1);
|
||||
new MessageBuilder(votePoll.addVote(player, theme) ? "MENU_THEME_VOTE_SUCCESS" : "MENU_THEME_VOTE_ALREADY")
|
||||
.asKey().player(player).value(theme).sendPlayer();
|
||||
buildArena.getVoteMenu().updateInventory(player);
|
||||
|
||||
}
|
||||
|
||||
private void sendThemeList(Player player, VotePoll votePoll, List<String> themes) {
|
||||
|
||||
send(player, "&6Vote for a theme with /v #.");
|
||||
send(player, "&6Theme choices up for voting:");
|
||||
for (int i = 0; i < themes.size(); i++) {
|
||||
|
||||
final String theme = themes.get(i);
|
||||
send(player, "&6&l" + (i + 1) + ". &6" + theme + " (&b" + votePoll.getVoteAmount(theme) + "&6 votes)");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void send(Player player, String message) {
|
||||
|
||||
player.sendMessage(LEGACY_SERIALIZER.deserialize(plugin.getPluginMessagePrefix() + message));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+44
-29
@@ -26,11 +26,13 @@ import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.buildbattle.commands.arguments.admin.ThemeArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.admin.arena.AddNpcArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.admin.arena.ForcePlayArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.admin.arena.SetThemeArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.admin.plot.AddPlotArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.admin.plot.RemovePlotArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.admin.plot.SelectPlotArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.game.GuessArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.game.JoinArgument;
|
||||
import plugily.projects.buildbattle.commands.arguments.game.MenuArgument;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.PluginArgumentsRegistry;
|
||||
@@ -41,39 +43,52 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>Created at 24.11.2018
|
||||
* <p>
|
||||
* Created at 24.11.2018
|
||||
*/
|
||||
public class ArgumentsRegistry extends PluginArgumentsRegistry {
|
||||
|
||||
public ArgumentsRegistry(Main plugin) {
|
||||
super(plugin);
|
||||
new AddNpcArgument(this);
|
||||
new SetThemeArgument(this);
|
||||
new AddPlotArgument(this);
|
||||
new RemovePlotArgument(this);
|
||||
new SelectPlotArgument(this);
|
||||
new MenuArgument(this);
|
||||
new GuessArgument(this);
|
||||
new ThemeArgument(this);
|
||||
}
|
||||
public ArgumentsRegistry(Main plugin) {
|
||||
|
||||
super(plugin);
|
||||
new AddNpcArgument(this);
|
||||
new ForcePlayArgument(this);
|
||||
new SetThemeArgument(this);
|
||||
new AddPlotArgument(this);
|
||||
new RemovePlotArgument(this);
|
||||
new SelectPlotArgument(this);
|
||||
new MenuArgument(this);
|
||||
new GuessArgument(this);
|
||||
new ThemeArgument(this);
|
||||
// Replaces the bundled /bb join so a bare /bb join lists the lobbies.
|
||||
new JoinArgument(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IPluginArena> getSpecificFilteredArenas(List<IPluginArena> arenas, String filter) {
|
||||
|
||||
switch (filter.toLowerCase(Locale.ENGLISH)) {
|
||||
|
||||
case "gtb":
|
||||
case "guessthebuild":
|
||||
case "guess_the_build":
|
||||
return arenas.stream().filter(GuessArena.class::isInstance).collect(Collectors.toList());
|
||||
case "team":
|
||||
return arenas.stream().filter(BuildArena.class::isInstance)
|
||||
.filter(arena -> ((BuildArena) arena).getArenaType().equals(BaseArena.ArenaType.TEAM))
|
||||
.collect(Collectors.toList());
|
||||
case "classic":
|
||||
case "solo":
|
||||
return arenas.stream().filter(BuildArena.class::isInstance)
|
||||
.filter(arena -> ((BuildArena) arena).getArenaType().equals(BaseArena.ArenaType.SOLO))
|
||||
.collect(Collectors.toList());
|
||||
case "build":
|
||||
default:
|
||||
return arenas.stream().filter(BuildArena.class::isInstance).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IPluginArena> getSpecificFilteredArenas(List<IPluginArena> arenas, String filter) {
|
||||
switch(filter.toLowerCase(Locale.ENGLISH)) {
|
||||
case "gtb":
|
||||
case "guessthebuild":
|
||||
case "guess_the_build":
|
||||
return arenas.stream().filter(GuessArena.class::isInstance).collect(Collectors.toList());
|
||||
case "team":
|
||||
return arenas.stream().filter(BuildArena.class::isInstance).filter(arena -> ((BuildArena) arena).getArenaType().equals(BaseArena.ArenaType.TEAM)).collect(Collectors.toList());
|
||||
case "classic":
|
||||
case "solo":
|
||||
return arenas.stream().filter(BuildArena.class::isInstance).filter(arena -> ((BuildArena) arena).getArenaType().equals(BaseArena.ArenaType.SOLO)).collect(Collectors.toList());
|
||||
case "build":
|
||||
default:
|
||||
return arenas.stream().filter(BuildArena.class::isInstance).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+140
-102
@@ -22,7 +22,8 @@ package plugily.projects.buildbattle.commands.arguments.admin;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import plugily.projects.buildbattle.Main;
|
||||
@@ -35,121 +36,158 @@ import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
|
||||
public final class ThemeArgument {
|
||||
|
||||
private String printGameTypes() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int length = ThemeManager.GameThemes.VALUES.length;
|
||||
private String printGameTypes() {
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int length = ThemeManager.GameThemes.VALUES.length;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
||||
stringBuilder.append(
|
||||
ThemeManager.GameThemes.VALUES[i].strip.toLowerCase(Locale.ENGLISH) + (i + 1 < length ? ", " : ""));
|
||||
|
||||
}
|
||||
|
||||
return stringBuilder.toString();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
stringBuilder.append(ThemeManager.GameThemes.VALUES[i].strip.toLowerCase(Locale.ENGLISH) + (i + 1 < length ? ", " : ""));
|
||||
}
|
||||
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
public ThemeArgument(ArgumentsRegistry registry) {
|
||||
|
||||
public ThemeArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("theme", "buildbattle.admin.theme", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba theme &c[add/remove] [gameType] [theme]", "/bba theme",
|
||||
"&7Theme commands to add or remove themes for the specified game type\n&6Permission: &7buildbattle.admin.theme")) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if(args.length < 4) {
|
||||
new MessageBuilder("COMMANDS_WRONG_USAGE").asKey().value("/" + registry.getPlugin().getCommandAdminPrefix() + " &c[add/remove] [gameType] [theme]").send(sender);
|
||||
return;
|
||||
}
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("theme", "buildbattle.admin.theme",
|
||||
CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba theme &c[add/remove] [gameType] [theme]", "/bba theme",
|
||||
"&7Theme commands to add or remove themes for the specified game type\n&6Permission: &7buildbattle.admin.theme"))
|
||||
{
|
||||
|
||||
String gameType = args[2];
|
||||
ThemeManager.GameThemes theme = null;
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
for(ThemeManager.GameThemes gameTheme : ThemeManager.GameThemes.VALUES) {
|
||||
if(gameTheme.strip.equalsIgnoreCase(gameType)) {
|
||||
theme = gameTheme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (args.length < 4) {
|
||||
|
||||
if(theme == null) {
|
||||
new MessageBuilder("&cThere is no game type with this name. Possible types: " + printGameTypes()).prefix().send(sender);
|
||||
return;
|
||||
}
|
||||
new MessageBuilder("COMMANDS_WRONG_USAGE").asKey().value(
|
||||
"/" + registry.getPlugin().getCommandAdminPrefix() + " &c[add/remove] [gameType] [theme]")
|
||||
.send(sender);
|
||||
return;
|
||||
|
||||
String themeName = ChatColor.stripColor(args[3]);
|
||||
ThemeManager themeManager = ((Main) registry.getPlugin()).getThemeManager();
|
||||
}
|
||||
|
||||
switch(args[1].toLowerCase(Locale.ENGLISH)) {
|
||||
case "add":
|
||||
if(themeManager.isThemeBlacklisted(themeName)) {
|
||||
new MessageBuilder("COMMANDS_THEME_BLACKLISTED").asKey().prefix().send(sender);
|
||||
return;
|
||||
}
|
||||
String gameType = args[2];
|
||||
ThemeManager.GameThemes theme = null;
|
||||
|
||||
if(themeManager.getThemes(theme).contains(themeName)) {
|
||||
new MessageBuilder("&cThe given theme already exists.").prefix().send(sender);
|
||||
return;
|
||||
}
|
||||
for (ThemeManager.GameThemes gameTheme : ThemeManager.GameThemes.VALUES) {
|
||||
|
||||
switch(theme) {
|
||||
case SOLO:
|
||||
case CLASSIC:
|
||||
themeManager.classicThemes.add(themeName);
|
||||
break;
|
||||
case TEAM:
|
||||
case TEAMS:
|
||||
themeManager.teamsThemes.add(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_EASY:
|
||||
themeManager.GTBThemesEasy.add(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_MEDIUM:
|
||||
themeManager.GTBThemesMedium.add(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_HARD:
|
||||
themeManager.GTBThemesHard.add(themeName);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (gameTheme.strip.equalsIgnoreCase(gameType)) {
|
||||
|
||||
themeManager.loadThemes(true);
|
||||
themeManager.saveThemesToConfig();
|
||||
break;
|
||||
case "remove":
|
||||
boolean contained = false;
|
||||
theme = gameTheme;
|
||||
break;
|
||||
|
||||
switch(theme) {
|
||||
case SOLO:
|
||||
case CLASSIC:
|
||||
contained = themeManager.classicThemes.remove(themeName);
|
||||
break;
|
||||
case TEAM:
|
||||
case TEAMS:
|
||||
contained = themeManager.teamsThemes.remove(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_EASY:
|
||||
contained = themeManager.GTBThemesEasy.remove(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_MEDIUM:
|
||||
contained = themeManager.GTBThemesMedium.remove(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_HARD:
|
||||
contained = themeManager.GTBThemesHard.remove(themeName);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!contained) {
|
||||
new MessageBuilder("&cThe given theme doesn't exists.").prefix().send(sender);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
themeManager.loadThemes(true);
|
||||
themeManager.saveThemesToConfig();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (theme == null) {
|
||||
|
||||
new MessageBuilder("&cThere is no game type with this name. Possible types: " + printGameTypes())
|
||||
.prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
String themeName = PlainTextComponentSerializer.plainText()
|
||||
.serialize(LegacyComponentSerializer.legacySection().deserialize(args[3]));
|
||||
ThemeManager themeManager = ((Main) registry.getPlugin()).getThemeManager();
|
||||
|
||||
switch (args[1].toLowerCase(Locale.ENGLISH)) {
|
||||
|
||||
case "add":
|
||||
if (themeManager.isThemeBlacklisted(themeName)) {
|
||||
|
||||
new MessageBuilder("COMMANDS_THEME_BLACKLISTED").asKey().prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (themeManager.getThemes(theme).contains(themeName)) {
|
||||
|
||||
new MessageBuilder("&cThe given theme already exists.").prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
switch (theme) {
|
||||
|
||||
case SOLO:
|
||||
case CLASSIC:
|
||||
themeManager.classicThemes.add(themeName);
|
||||
break;
|
||||
case TEAM:
|
||||
case TEAMS:
|
||||
themeManager.teamsThemes.add(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_EASY:
|
||||
themeManager.GTBThemesEasy.add(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_MEDIUM:
|
||||
themeManager.GTBThemesMedium.add(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_HARD:
|
||||
themeManager.GTBThemesHard.add(themeName);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
themeManager.loadThemes(true);
|
||||
themeManager.saveThemesToConfig();
|
||||
break;
|
||||
case "remove":
|
||||
boolean contained = false;
|
||||
|
||||
switch (theme) {
|
||||
|
||||
case SOLO:
|
||||
case CLASSIC:
|
||||
contained = themeManager.classicThemes.remove(themeName);
|
||||
break;
|
||||
case TEAM:
|
||||
case TEAMS:
|
||||
contained = themeManager.teamsThemes.remove(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_EASY:
|
||||
contained = themeManager.GTBThemesEasy.remove(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_MEDIUM:
|
||||
contained = themeManager.GTBThemesMedium.remove(themeName);
|
||||
break;
|
||||
case GUESS_THE_BUILD_HARD:
|
||||
contained = themeManager.GTBThemesHard.remove(themeName);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!contained) {
|
||||
|
||||
new MessageBuilder("&cThe given theme doesn't exists.").prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
themeManager.loadThemes(true);
|
||||
themeManager.saveThemesToConfig();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+33
-20
@@ -33,28 +33,41 @@ import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
*/
|
||||
public class AddNpcArgument {
|
||||
|
||||
public AddNpcArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("addnpc", "buildbattle.admin.addnpc", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba addnpc", "/bba addnpc",
|
||||
"&7Deletes specified arena\n&6Permission: &7buildbattle.admin.addnpc")) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if(registry.getPlugin().getServer().getPluginManager().isPluginEnabled("Citizens")) {
|
||||
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.VILLAGER, new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_NAME").asKey().build());
|
||||
npc.spawn(((Player) sender).getLocation());
|
||||
npc.setProtected(true);
|
||||
npc.setName(new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_NAME").asKey().build());
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_CREATED").asKey().send(sender);
|
||||
} else {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_CITIZENS").asKey().send(sender);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public AddNpcArgument(ArgumentsRegistry registry) {
|
||||
|
||||
registry.mapArgument("buildbattleadmin",
|
||||
new LabeledCommandArgument("addnpc", "buildbattle.admin.addnpc", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba addnpc", "/bba addnpc",
|
||||
"&7Deletes specified arena\n&6Permission: &7buildbattle.admin.addnpc"))
|
||||
{
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
if (registry.getPlugin().getServer().getPluginManager().isPluginEnabled("Citizens")) {
|
||||
|
||||
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.VILLAGER,
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_NAME").asKey().build());
|
||||
npc.spawn(((Player) sender).getLocation());
|
||||
npc.setProtected(true);
|
||||
npc.setName(new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_NAME").asKey().build());
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_CREATED").asKey().send(sender);
|
||||
|
||||
} else {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_NPC_CITIZENS").asKey().send(sender);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
*
|
||||
* BuildBattle - Ultimate building competition minigame
|
||||
* Copyright (C) 2022 Plugily Projects - maintained by Tigerpanzer_02 and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package plugily.projects.buildbattle.commands.arguments.admin.arena;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgument;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.LabelData;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.LabeledCommandArgument;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
*/
|
||||
public class ForcePlayArgument {
|
||||
|
||||
public ForcePlayArgument(ArgumentsRegistry registry) {
|
||||
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("forceplay", "buildbattle.admin.forceplay",
|
||||
CommandArgument.ExecutorType.BOTH,
|
||||
new LabelData("/bba forceplay <arena> <theme>", "/bba forceplay <arena> <theme>",
|
||||
"&7Start a arena by command \n&6Permission: &7buildbattle.admin.forceplay\n&cNOT FOR PRODUCTION!"))
|
||||
{
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
new MessageBuilder("&cPlease type arena theme!").prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BaseArena arena;
|
||||
int themeArgStart = 1;
|
||||
if (!(sender instanceof Player)) {
|
||||
|
||||
arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(args[1]);
|
||||
if (args.length == 2 && arena != null) {
|
||||
|
||||
BaseArena finalArena = arena;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
|
||||
registry.getPlugin().getArenaManager().joinAttempt(player, finalArena);
|
||||
|
||||
});
|
||||
arena.setForceStart(true);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
themeArgStart = 2;
|
||||
|
||||
} else {
|
||||
|
||||
arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena((Player) sender);
|
||||
if (arena == null) {
|
||||
|
||||
arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(args[1]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (arena == null) {
|
||||
|
||||
new MessageBuilder("COMMANDS_NOT_PLAYING").asKey().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!(arena instanceof BuildArena)) {
|
||||
|
||||
new MessageBuilder("&cCan't set theme on this arena type!").prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
StringJoiner themeName = new StringJoiner(" ");
|
||||
|
||||
for (int i = themeArgStart; i < args.length; i++)
|
||||
themeName.add(args[i]);
|
||||
if (arena.getArenaInGameState() == BaseArena.ArenaInGameState.BUILD_TIME
|
||||
|| arena.getArenaState() == IArenaState.WAITING_FOR_PLAYERS
|
||||
|| arena.getArenaState() == IArenaState.STARTING
|
||||
|| arena.getArenaState() == IArenaState.FULL_GAME
|
||||
|| arena.getArenaInGameState() == BaseArena.ArenaInGameState.THEME_VOTING)
|
||||
{
|
||||
|
||||
if (arena.getPlugin().getThemeManager().isThemeBlacklisted(themeName.toString())) {
|
||||
|
||||
new MessageBuilder("COMMANDS_THEME_BLACKLISTED").asKey().prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BaseArena finalArena1 = arena;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
|
||||
registry.getPlugin().getArenaManager().joinAttempt(player, finalArena1);
|
||||
|
||||
});
|
||||
arena.setForceStart(true);
|
||||
arena.setTheme(themeName.toString());
|
||||
new MessageBuilder("IN_GAME_MESSAGES_ADMIN_CHANGED_THEME").asKey().prefix()
|
||||
.value(themeName.toString()).arena(arena).sendArena();
|
||||
|
||||
} else {
|
||||
|
||||
new MessageBuilder("&cWrong state to force theme!").prefix().send(sender);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+88
-39
@@ -35,47 +35,96 @@ import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
*/
|
||||
public class SetThemeArgument {
|
||||
|
||||
public SetThemeArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("settheme", "buildbattle.admin.settheme", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba settheme &6<theme>", "/bba settheme",
|
||||
"&7Set new arena theme\n&6Permission: &7buildbattle.admin.settheme\n&6You can set arena theme only when it started\n&6and only for 20 seconds after start!")) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena((Player) sender);
|
||||
if(arena == null) {
|
||||
new MessageBuilder("COMMANDS_NOT_PLAYING").asKey().send(sender);
|
||||
return;
|
||||
}
|
||||
if(!(arena instanceof BuildArena)) {
|
||||
//todo translatable
|
||||
new MessageBuilder("&cCan't set theme on this arena type!").prefix().send(sender);
|
||||
return;
|
||||
}
|
||||
if(args.length == 1) {
|
||||
//todo translatable
|
||||
new MessageBuilder("&cPlease type arena theme!").prefix().send(sender);
|
||||
return;
|
||||
}
|
||||
StringJoiner themeName = new StringJoiner(" ");
|
||||
for(int i = 1; i < args.length; i++)
|
||||
themeName.add(args[i]);
|
||||
if(arena.getArenaInGameState() == BaseArena.ArenaInGameState.BUILD_TIME || arena.getArenaState() == IArenaState.STARTING) {
|
||||
if(arena.getPlugin().getThemeManager().isThemeBlacklisted(themeName.toString())) {
|
||||
new MessageBuilder("COMMANDS_THEME_BLACKLISTED").asKey().prefix().send(sender);
|
||||
return;
|
||||
}
|
||||
arena.setTheme(themeName.toString());
|
||||
new MessageBuilder("IN_GAME_MESSAGES_ADMIN_CHANGED_THEME").asKey().prefix().value(themeName.toString()).arena(arena).sendArena();
|
||||
} else {
|
||||
new MessageBuilder("&cWrong state to force theme!").prefix().send(sender);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public SetThemeArgument(ArgumentsRegistry registry) {
|
||||
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("settheme", "buildbattle.admin.settheme",
|
||||
CommandArgument.ExecutorType.BOTH,
|
||||
new LabelData("/bba settheme &6<theme>",
|
||||
"/bba settheme <theme> || Console /bba settheme <arena> <theme>",
|
||||
"&7Set new arena theme\n&6Permission: &7buildbattle.admin.settheme\n&6You can set arena theme only when it started\n&6and only for 20 seconds after start!"))
|
||||
{
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
// todo translatable
|
||||
new MessageBuilder("&cPlease type arena theme!").prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BaseArena arena;
|
||||
int themeArgStart = 1;
|
||||
if (!(sender instanceof Player)) {
|
||||
|
||||
if (args.length == 2) {
|
||||
|
||||
// todo translatable
|
||||
new MessageBuilder("&cPlease type arena name!").prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(args[1]);
|
||||
themeArgStart = 2;
|
||||
|
||||
} else {
|
||||
|
||||
arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena((Player) sender);
|
||||
|
||||
}
|
||||
|
||||
if (arena == null) {
|
||||
|
||||
new MessageBuilder("COMMANDS_NOT_PLAYING").asKey().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!(arena instanceof BuildArena)) {
|
||||
|
||||
// todo translatable
|
||||
new MessageBuilder("&cCan't set theme on this arena type!").prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
StringJoiner themeName = new StringJoiner(" ");
|
||||
|
||||
for (int i = themeArgStart; i < args.length; i++)
|
||||
themeName.add(args[i]);
|
||||
if (arena.getArenaInGameState() == BaseArena.ArenaInGameState.BUILD_TIME
|
||||
|| arena.getArenaState() == IArenaState.STARTING)
|
||||
{
|
||||
|
||||
if (arena.getPlugin().getThemeManager().isThemeBlacklisted(themeName.toString())) {
|
||||
|
||||
new MessageBuilder("COMMANDS_THEME_BLACKLISTED").asKey().prefix().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
arena.setTheme(themeName.toString());
|
||||
new MessageBuilder("IN_GAME_MESSAGES_ADMIN_CHANGED_THEME").asKey().prefix()
|
||||
.value(themeName.toString()).arena(arena).sendArena();
|
||||
|
||||
} else {
|
||||
|
||||
new MessageBuilder("&cWrong state to force theme!").prefix().send(sender);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+88
-36
@@ -24,6 +24,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgument;
|
||||
@@ -36,44 +37,95 @@ import plugily.projects.minigamesbox.classic.utils.serialization.LocationSeriali
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
*/
|
||||
public class AddPlotArgument {
|
||||
|
||||
public AddPlotArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("addplot", "buildbattle.admin.addplot", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba addplot &6<arena>", "/bba addplot <arena>",
|
||||
"&7Add new game plot to the arena\n&6Permission: &7buildbattle.admin.addplot")) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if(args.length == 1) {
|
||||
new MessageBuilder("COMMANDS_TYPE_ARENA_NAME").asKey().send(sender);
|
||||
return;
|
||||
}
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(args[1]);
|
||||
if(arena == null) {
|
||||
new MessageBuilder("COMMANDS_NO_ARENA_LIKE_THAT").asKey().send(sender);
|
||||
return;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
CuboidSelector.Selection selection = registry.getPlugin().getCuboidSelector().getSelection(player);
|
||||
if(selection == null || selection.getFirstPos() == null || selection.getSecondPos() == null) {
|
||||
new MessageBuilder("&cPlease select both corners before adding a plot!").send(sender);
|
||||
return;
|
||||
}
|
||||
FileConfiguration config = ConfigUtils.getConfig(registry.getPlugin(), "arenas");
|
||||
int id = 0;
|
||||
ConfigurationSection section = config.getConfigurationSection("instances." + arena.getId() + ".plots");
|
||||
if(section != null) {
|
||||
id = section.getKeys(false).size() + 1;
|
||||
}
|
||||
LocationSerializer.saveLoc(registry.getPlugin(), config, "arenas", "instances." + arena.getId() + ".plots." + id + ".1", selection.getFirstPos());
|
||||
LocationSerializer.saveLoc(registry.getPlugin(), config, "arenas", "instances." + arena.getId() + ".plots." + id + ".2", selection.getSecondPos());
|
||||
new MessageBuilder("&aPlot with ID &e" + id + "&a added to arena instance &e" + arena.getId()).send(sender);
|
||||
registry.getPlugin().getCuboidSelector().removeSelection(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
public AddPlotArgument(ArgumentsRegistry registry) {
|
||||
|
||||
registry.mapArgument("buildbattleadmin",
|
||||
new LabeledCommandArgument("addplot", "buildbattle.admin.addplot", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba addplot &6<arena>", "/bba addplot <arena>",
|
||||
"&7Add new game plot to the arena\n&6Permission: &7buildbattle.admin.addplot"))
|
||||
{
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
new MessageBuilder("COMMANDS_TYPE_ARENA_NAME").asKey().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(args[1]);
|
||||
if (arena == null) {
|
||||
|
||||
new MessageBuilder("COMMANDS_NO_ARENA_LIKE_THAT").asKey().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
CuboidSelector.Selection selection = registry.getPlugin().getCuboidSelector()
|
||||
.getSelection(player);
|
||||
if (selection == null || selection.getFirstPos() == null || selection.getSecondPos() == null) {
|
||||
|
||||
new MessageBuilder("&cPlease select both corners before adding a plot!").send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (selection.getFirstPos().getWorld() == null || selection.getSecondPos().getWorld() == null) {
|
||||
|
||||
new MessageBuilder("&cBoth plot corners must be inside a loaded MyWorlds game world!")
|
||||
.send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!selection.getFirstPos().getWorld().equals(selection.getSecondPos().getWorld())) {
|
||||
|
||||
new MessageBuilder("&cBoth plot corners must be in the same MyWorlds game world!")
|
||||
.send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Main plugin = (Main) registry.getPlugin();
|
||||
|
||||
if (plugin.getMyWorldsManager().isProtectedWorld(selection.getFirstPos().getWorld())) {
|
||||
|
||||
new MessageBuilder("&cBuildBattle plots are blocked from protected main worlds: &e"
|
||||
+ plugin.getMyWorldsManager().getProtectedWorldsDescription()).send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
FileConfiguration config = ConfigUtils.getConfig(registry.getPlugin(), "arenas");
|
||||
int id = 0;
|
||||
ConfigurationSection section = config
|
||||
.getConfigurationSection("instances." + arena.getId() + ".plots");
|
||||
if (section != null) {
|
||||
|
||||
id = section.getKeys(false).size() + 1;
|
||||
|
||||
}
|
||||
|
||||
LocationSerializer.saveLoc(registry.getPlugin(), config, "arenas",
|
||||
"instances." + arena.getId() + ".plots." + id + ".1", selection.getFirstPos());
|
||||
LocationSerializer.saveLoc(registry.getPlugin(), config, "arenas",
|
||||
"instances." + arena.getId() + ".plots." + id + ".2", selection.getSecondPos());
|
||||
new MessageBuilder("&aPlot with ID &e" + id + "&a added to arena instance &e" + arena.getId())
|
||||
.send(sender);
|
||||
registry.getPlugin().getCuboidSelector().removeSelection(player);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+48
-30
@@ -32,41 +32,59 @@ import plugily.projects.minigamesbox.classic.utils.configuration.ConfigUtils;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
* <p>
|
||||
* Created at 11.01.2019
|
||||
*/
|
||||
public class RemovePlotArgument {
|
||||
|
||||
public RemovePlotArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("removeplot", "buildbattle.admin.removeplot", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba removeplot &6<arena> <plot ID>", "/bba removeplot <arena> <plot ID>",
|
||||
"&7Removes game plot of the arena (only in arenas.yml!)\n&6Permission: &7buildbattle.admin.removeplot")) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if(args.length < 3) {
|
||||
new MessageBuilder("COMMANDS_TYPE_ARENA_NAME").asKey().send(sender);
|
||||
new MessageBuilder("COMMANDS_WRONG_USAGE").asKey().value("/bba removeplot <arena> <plot ID>").send(sender);
|
||||
return;
|
||||
}
|
||||
public RemovePlotArgument(ArgumentsRegistry registry) {
|
||||
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(args[1]);
|
||||
if(arena == null) {
|
||||
new MessageBuilder("COMMANDS_NO_ARENA_LIKE_THAT").asKey().send(sender);
|
||||
return;
|
||||
}
|
||||
registry.mapArgument("buildbattleadmin", new LabeledCommandArgument("removeplot",
|
||||
"buildbattle.admin.removeplot", CommandArgument.ExecutorType.PLAYER,
|
||||
new LabelData("/bba removeplot &6<arena> <plot ID>", "/bba removeplot <arena> <plot ID>",
|
||||
"&7Removes game plot of the arena (only in arenas.yml!)\n&6Permission: &7buildbattle.admin.removeplot"))
|
||||
{
|
||||
|
||||
String plot = args[2];
|
||||
FileConfiguration config = ConfigUtils.getConfig(registry.getPlugin(), "arenas");
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
if(config.contains("instances." + arena.getId() + ".plots." + plot)) {
|
||||
config.set("instances." + arena.getId() + ".plots." + plot, null);
|
||||
ConfigUtils.saveConfig(registry.getPlugin(), config, "arenas");
|
||||
new MessageBuilder("&aPlot with ID &e" + plot + "&a removed from arena &e" + arena.getId()).send(sender);
|
||||
} else {
|
||||
new MessageBuilder("&cPlot with that ID doesn't exist!").send(sender);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (args.length < 3) {
|
||||
|
||||
new MessageBuilder("COMMANDS_TYPE_ARENA_NAME").asKey().send(sender);
|
||||
new MessageBuilder("COMMANDS_WRONG_USAGE").asKey().value("/bba removeplot <arena> <plot ID>")
|
||||
.send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(args[1]);
|
||||
if (arena == null) {
|
||||
|
||||
new MessageBuilder("COMMANDS_NO_ARENA_LIKE_THAT").asKey().send(sender);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
String plot = args[2];
|
||||
FileConfiguration config = ConfigUtils.getConfig(registry.getPlugin(), "arenas");
|
||||
|
||||
if (config.contains("instances." + arena.getId() + ".plots." + plot)) {
|
||||
|
||||
config.set("instances." + arena.getId() + ".plots." + plot, null);
|
||||
ConfigUtils.saveConfig(registry.getPlugin(), config, "arenas");
|
||||
new MessageBuilder("&aPlot with ID &e" + plot + "&a removed from arena &e" + arena.getId())
|
||||
.send(sender);
|
||||
|
||||
} else {
|
||||
|
||||
new MessageBuilder("&cPlot with that ID doesn't exist!").send(sender);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+23
-13
@@ -29,22 +29,32 @@ import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgu
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 27.12.2020
|
||||
* <p>
|
||||
* Created at 27.12.2020
|
||||
*/
|
||||
public class SelectPlotArgument {
|
||||
|
||||
public SelectPlotArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattle", new CommandArgument("selectplot", "buildbattle.command.selectplot", CommandArgument.ExecutorType.PLAYER) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
public SelectPlotArgument(ArgumentsRegistry registry) {
|
||||
|
||||
if(arena != null && (arena.getArenaState() == IArenaState.WAITING_FOR_PLAYERS || arena.getArenaState() == IArenaState.STARTING))
|
||||
arena.getPlugin().getPlotMenuHandler().createMenu(player, arena);
|
||||
}
|
||||
});
|
||||
}
|
||||
registry.mapArgument("buildbattle",
|
||||
new CommandArgument("selectplot", "buildbattle.command.selectplot", CommandArgument.ExecutorType.PLAYER)
|
||||
{
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
|
||||
if (arena != null && (arena.getArenaState() == IArenaState.WAITING_FOR_PLAYERS
|
||||
|| arena.getArenaState() == IArenaState.STARTING
|
||||
|| arena.getArenaState() == IArenaState.FULL_GAME))
|
||||
arena.getPlugin().getPlotMenuHandler().createMenu(player, arena);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+58
-36
@@ -33,53 +33,75 @@ import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 30.05.2021
|
||||
* <p>
|
||||
* Created at 30.05.2021
|
||||
*/
|
||||
public class GuessArgument {
|
||||
|
||||
public GuessArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattle", new CommandArgument("guess", "", CommandArgument.ExecutorType.PLAYER) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if(args.length < 2) {
|
||||
new MessageBuilder("COMMANDS_WRONG_USAGE").asKey().value("/bb guess <word>").send(sender);
|
||||
return;
|
||||
}
|
||||
public GuessArgument(ArgumentsRegistry registry) {
|
||||
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
registry.mapArgument("buildbattle", new CommandArgument("guess", "", CommandArgument.ExecutorType.PLAYER) {
|
||||
|
||||
if(!(arena instanceof GuessArena) || arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
new MessageBuilder("COMMANDS_NOT_PLAYING").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
GuessArena gameArena = (GuessArena) arena;
|
||||
if (args.length < 2) {
|
||||
|
||||
if(gameArena.getArenaInGameState() != BaseArena.ArenaInGameState.BUILD_TIME) {
|
||||
new MessageBuilder("COMMANDS_NOT_PLAYING").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
new MessageBuilder("COMMANDS_WRONG_USAGE").asKey().value("/bb guess <word>").send(sender);
|
||||
return;
|
||||
|
||||
if(gameArena.getWhoGuessed().contains(player)) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_CANT_TALK").asKey().arena(gameArena).player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(gameArena.getCurrentBuilders().contains(player)) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_BUILDER").asKey().arena(gameArena).player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
|
||||
if(gameArena.getCurrentBBTheme() == null || !gameArena.getCurrentBBTheme().getTheme().equalsIgnoreCase(Arrays.toString(args).split(" ", 2)[1].replace(",", "").replace("]", ""))) {
|
||||
return;
|
||||
}
|
||||
if (!(arena instanceof GuessArena) || arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
|
||||
gameArena.broadcastPlayerGuessed(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
new MessageBuilder("COMMANDS_NOT_PLAYING").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
GuessArena gameArena = (GuessArena) arena;
|
||||
|
||||
if (gameArena.getArenaInGameState() != BaseArena.ArenaInGameState.BUILD_TIME) {
|
||||
|
||||
new MessageBuilder("COMMANDS_NOT_PLAYING").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (gameArena.getWhoGuessed().contains(player)) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_CANT_TALK").asKey().arena(gameArena)
|
||||
.player(player).sendPlayer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (gameArena.getCurrentBuilders().contains(player)) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_BUILDER").asKey().arena(gameArena)
|
||||
.player(player).sendPlayer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (gameArena.getCurrentBBTheme() == null
|
||||
|| gameArena.getCurrentBBTheme().getThemes().stream().noneMatch(theme -> theme.equalsIgnoreCase(
|
||||
Arrays.toString(args).split(" ", 2)[1].replace(",", "").replace("]", ""))))
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
gameArena.broadcastPlayerGuessed(player);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package plugily.projects.buildbattle.commands.arguments.game;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.commands.LobbyList;
|
||||
import plugily.projects.buildbattle.commands.LobbyResolver;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgument;
|
||||
|
||||
// Replaces MiniGamesBox's /bb join. With no lobby it lists the lobbies with
|
||||
// clickable join lines like /hbjoin; with one it accepts BB1, bb1 or a bare 1.
|
||||
// "maxplayers" still joins the fullest open arena.
|
||||
public class JoinArgument {
|
||||
|
||||
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
|
||||
|
||||
public JoinArgument(ArgumentsRegistry registry) {
|
||||
|
||||
// MiniGamesBox runs the first mapped argument whose name matches, so the
|
||||
// bundled join has to go before ours is mapped.
|
||||
final List<CommandArgument> mapped = registry.getMappedArguments().get("buildbattle");
|
||||
if (mapped != null) {
|
||||
|
||||
mapped.removeIf(argument -> "join".equalsIgnoreCase(argument.getArgumentName()));
|
||||
|
||||
}
|
||||
|
||||
registry.mapArgument("buildbattle", new CommandArgument("join", "", CommandArgument.ExecutorType.PLAYER) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
final Player player = (Player) sender;
|
||||
final Main plugin = (Main) registry.getPlugin();
|
||||
|
||||
if (args.length < 2 || args[1].isBlank()) {
|
||||
|
||||
LobbyList.send(plugin, player);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("maxplayers")) {
|
||||
|
||||
joinFullest(plugin, player);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final BaseArena arena = LobbyResolver.resolve(plugin, args[1]);
|
||||
if (arena == null) {
|
||||
|
||||
player.sendMessage(LEGACY_SERIALIZER.deserialize(
|
||||
plugin.getPluginMessagePrefix() + "&cLobby &e" + args[1] + " &cdoes not exist."));
|
||||
LobbyList.send(plugin, player);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plugin.getArenaManager().joinAttempt(player, arena);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private static void joinFullest(Main plugin, Player player) {
|
||||
|
||||
IPluginArena best = null;
|
||||
for (IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
|
||||
if (arena.getPlayers().size() >= arena.getMaximumPlayers()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (best == null || arena.getPlayers().size() > best.getPlayers().size()) {
|
||||
|
||||
best = arena;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (best == null) {
|
||||
|
||||
LobbyList.send(plugin, player);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plugin.getArenaManager().joinAttempt(player, plugin.getArenaRegistry().getArena(best.getId()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+19
-13
@@ -29,22 +29,28 @@ import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgu
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 27.12.2020
|
||||
* <p>
|
||||
* Created at 27.12.2020
|
||||
*/
|
||||
public class MenuArgument {
|
||||
|
||||
public MenuArgument(ArgumentsRegistry registry) {
|
||||
registry.mapArgument("buildbattle", new CommandArgument("menu", "", CommandArgument.ExecutorType.PLAYER) {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
public MenuArgument(ArgumentsRegistry registry) {
|
||||
|
||||
if(arena != null && (arena.getArenaState() == IArenaState.IN_GAME))
|
||||
arena.getPlugin().getOptionsRegistry().getOptionsGui().open(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
registry.mapArgument("buildbattle", new CommandArgument("menu", "", CommandArgument.ExecutorType.PLAYER) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
|
||||
if (arena != null && (arena.getArenaState() == IArenaState.IN_GAME))
|
||||
arena.getPlugin().getOptionsRegistry().getOptionsGui().open(player);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* MiniGamesBox - Library box with massive content that could be seen as minigames core.
|
||||
* Copyright (C) 2023 Plugily Projects - maintained by Tigerpanzer_02 and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package plugily.projects.buildbattle.handlers;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.minigamesbox.classic.utils.configuration.ConfigUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.migrator.MigratorUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/*
|
||||
NOTE FOR CONTRIBUTORS - Please do not touch this class if you don't know how it works! You can break migrator modifying these values!
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 07.2025
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class LanguageMigrator {
|
||||
|
||||
public enum PluginFileVersion {
|
||||
/* ARENA_SELECTOR(0), */ BUNGEE(1), CONFIG(2), LANGUAGE(4), /* LEADERBOARDS(0), */ MYSQL(1), PERMISSIONS(1),
|
||||
/* SIGNS(0), */ SPECIAL_ITEMS(1), SPECTATOR(1)/* , STATS(0) */, MAIN_MENU(1);
|
||||
|
||||
private final int version;
|
||||
|
||||
PluginFileVersion(int version) {
|
||||
|
||||
this.version = version;
|
||||
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
|
||||
return version;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final Main plugin;
|
||||
|
||||
public LanguageMigrator(Main plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
updatePluginFiles();
|
||||
|
||||
}
|
||||
|
||||
private void updatePluginFiles() {
|
||||
|
||||
for (PluginFileVersion pluginFileVersion : PluginFileVersion.values()) {
|
||||
|
||||
String fileName = pluginFileVersion.name().toLowerCase();
|
||||
if (fileName.equalsIgnoreCase(PluginFileVersion.MAIN_MENU.name())) {
|
||||
|
||||
fileName = "heads/mainmenu";
|
||||
|
||||
}
|
||||
|
||||
int newVersion = pluginFileVersion.getVersion();
|
||||
File file = new File(plugin.getDataFolder() + "/" + fileName + ".yml");
|
||||
FileConfiguration configuration = ConfigUtils.getConfig(plugin, fileName, false);
|
||||
if (configuration == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
int oldVersion = configuration.getInt("Do-Not-Edit.File-Version", 0);
|
||||
if (oldVersion == newVersion) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info("[System notify] The " + fileName + " file is outdated! Updating...");
|
||||
for (int i = oldVersion; i < newVersion; i++) {
|
||||
|
||||
executeUpdate(file, pluginFileVersion, i);
|
||||
|
||||
}
|
||||
|
||||
updatePluginFileVersion(file, configuration, oldVersion, newVersion);
|
||||
Bukkit.getLogger().info("[System notify] " + fileName + " updated, no comments were removed :)");
|
||||
Bukkit.getLogger().info("[System notify] You're using latest " + fileName + " file now! Nice!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void executeUpdate(File file, PluginFileVersion pluginFileVersion, int version) {
|
||||
|
||||
switch (pluginFileVersion) {
|
||||
|
||||
case CONFIG:
|
||||
switch (version) {
|
||||
|
||||
case 1:
|
||||
// Round keys only; shorten In-Game by hand.
|
||||
for (String mode : new String[] { " Classic:", " Teams:" }) {
|
||||
|
||||
MigratorUtils.insertAfterLine(file, mode,
|
||||
" # Build rounds per match; each round gets its own theme and plot vote, points add up.\n"
|
||||
+ " Rounds: 3\n"
|
||||
+ " # Pick each round's theme at random from themes.yml instead of holding a vote.\n"
|
||||
+ " Random-Theme: true");
|
||||
|
||||
}
|
||||
|
||||
MigratorUtils.insertAfterLine(file, "Move-Outside: false",
|
||||
" # Wall around the plot a player is building in, shown only to them; the world is never changed.\n"
|
||||
+ " Border:\n"
|
||||
+ " # Draw the wall. Off, the limit below still holds and a builder past it is pulled back.\n"
|
||||
+ " Enabled: true\n"
|
||||
+ " # Blocks a builder may step outside the plot before the wall.\n"
|
||||
+ " Grace: 3\n"
|
||||
+ " # Wall blocks within this many blocks of the builder are drawn.\n"
|
||||
+ " Distance: 8\n"
|
||||
+ " # RAINBOW_GLASS, RAINBOW_WOOL, RAINBOW_TERRACOTTA, RAINBOW_CONCRETE or any block name.\n"
|
||||
+ " Block: RAINBOW_GLASS");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case LANGUAGE:
|
||||
switch (version) {
|
||||
|
||||
case 1:
|
||||
MigratorUtils.insertAfterLine(file, " Heads:",
|
||||
" Database:\n" + " Lore: \"Get Head %value%\"");
|
||||
break;
|
||||
case 2:
|
||||
// Herobrine-OG-style join signs: gold map name, black
|
||||
// player counts, and bold JOIN/STARTING/LIVE/FULL/ENDING
|
||||
// state labels. removeLineFromFile drops every line
|
||||
// containing the needle, so the Starting/Restarting
|
||||
// removals also clear the identical Motd entries, which
|
||||
// are re-inserted unchanged below.
|
||||
MigratorUtils.removeLineFromFile(file, "- \"%arena_name%\"");
|
||||
MigratorUtils.removeLineFromFile(file, "- \"[%arena_players_size%/%arena_max_players%]\"");
|
||||
MigratorUtils.insertAfterLine(file, "- \"&4BuildBattle-OG\"", " - \"&6%arena_name%\"");
|
||||
MigratorUtils.insertAfterLine(file, "- \"%arena_state_placeholder%\"",
|
||||
" - \"&0%arena_players_size%&8/&0%arena_max_players%\"");
|
||||
MigratorUtils.removeLineFromFile(file, "Waiting: \"&lWaiting for players...\"");
|
||||
MigratorUtils.removeLineFromFile(file, "Starting: \"&6&lStarting\"");
|
||||
MigratorUtils.removeLineFromFile(file, "Full-Game: \"&4&lFULL\"");
|
||||
MigratorUtils.removeLineFromFile(file, "In-Game: \"&lIn-game\"");
|
||||
MigratorUtils.removeLineFromFile(file, "Ending: \"&lEnding\"");
|
||||
MigratorUtils.removeLineFromFile(file, "Restarting: \"&4&lRestarting\"");
|
||||
MigratorUtils.insertAfterLine(file, "Game-States:",
|
||||
" Waiting: \"&2&lJOIN\"\n" + " Starting: \"&5&lSTARTING\"\n"
|
||||
+ " Full-Game: \"&4&lFULL\"\n" + " In-Game: \"&3&lLIVE\"\n"
|
||||
+ " Ending: \"&8&lENDING\"\n" + " Restarting: \"&8&lRESTARTING\"");
|
||||
MigratorUtils.insertAfterLine(file, "Motd:",
|
||||
" Starting: \"&6&lStarting\"\n" + " Restarting: \"&4&lRestarting\"");
|
||||
break;
|
||||
case 3:
|
||||
MigratorUtils.insertAfterLine(file, "Winner: \"5,20,5;%plugin_prefix% WINNER: %value%\"",
|
||||
" Round:\n"
|
||||
+ " Start: \"%plugin_prefix% Round %arena_round%/%arena_rounds%! The theme is %arena_theme%\"\n"
|
||||
+ " Title: \"5,40,5;Round %arena_round%/%arena_rounds%;Theme: %arena_theme%\"");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case MAIN_MENU:
|
||||
switch (version) {
|
||||
|
||||
case 0:
|
||||
MigratorUtils.addNewLines(file, "# Use HeadDatabase in addition to the configured ones\n"
|
||||
+ "# You can remove categories from the catalog which shouldn't be loaded!\n"
|
||||
+ "# Catalog:\n" + "# - alphabet\n" + "# - animals\n" + "# - blocks\n"
|
||||
+ "# - decoration\n" + "# - food-drinks\n" + "# - humanoid\n"
|
||||
+ "# - humans\n" + "# - miscellaneous\n" + "# - monsters\n"
|
||||
+ "# - plants\n" + "database-alphabet:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzI1MDhlMmNhNjUwMGJjZTMwNTM5YzM4ODg0MmE1NjcyYjdiYzI5YTY4NzZkZDZhNTAyNTY3MmUyNTJkMjVkYSJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: alphabet\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-animals:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTQyYjllYzM0OTYwNjRiMDg1ZjdkMzBjZTkwYTBjOGY3NjM2YzhlZjUzMDNiMjBjMjVjYTEwYTk5N2JkNzQzMyJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: animals\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-blocks:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzViNDQ4ZmQ5NWM4NzRjOTVmZTc0ODQ0NDFhNDM5NGQ2NDZiNzJiYzgyYTUyNzQ4M2ZkYzcwY2E3OTg2ZmNhNSJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: blocks\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-decoration:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjNhZjk0YTUwZmFmNTBhZTAyMzZjNzExZWMxMzZiMjgwOGFjODJiYjE3MWQ0MmIzOGQxNjc2MGQyMjBmMjU4MiJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: decoration\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-food-drinks:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDUxMzdmYzBjZDUxMjAyNjcyMzgyYmZhZTAxZmViM2UxZTJiNzMxMDdlOThkMmM2YzhmNzE5ZjFkYTUzMGU2OCJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: food-drinks\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-humanoid:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTc5Yzc3ZjEyYzg2NzM5OGE0MTgxMDgxZmI1YmY3MGM1ZmYzMjcxNWM2ODk3NTBjNmU3MTdkMDY5ZTgxMzFhOSJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: humanoid\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-humans:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDQ5MmRmZTNjZThjYjYxYjkwODYwZWZmOTM4Y2I4M2UxOWMxNmU5Y2IyZDliZjJhZDc4OTZjOTBmNWIyZTFmMCJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: humans\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-miscellaneous:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDQ3OTE3MTkzZTlmYjdjYjk2OGZiYTAzYTJlMjg0YTA0NjEyMWIyZGMwMTU0MWNhY2RiYTUzYTRmOWJiZjcwOCJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: miscellaneous\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-monsters:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTgyYjQxZjY3YjMzNzE0NWM1ZWI4M2I5ZTAwMTU1NzQ4MDE2MGE1NWU5MWVmODYzZWIwYmYwNTU3Mzg0MmNlMSJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: monsters\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-plants:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDA4MzY2YjgxMWM0MzU5YWVhNjY4NjMwMGNmZDQ1MGQ5ZWFhNDYxNGMzYWYwOGExN2YxNTEzZjVkMmY0OGM0YSJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: plants\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"\n"
|
||||
+ "database-search:\n" + " displayname: '&6%value% heads'\n"
|
||||
+ " texture: \"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjViOTVkYTEyODE2NDJkYWE1ZDAyMmFkYmQzZTdjYjY5ZGMwOTQyYzgxY2Q2M2JlOWMzODU3ZDIyMmUxYzhkOSJ9fX0=\"\n"
|
||||
+ " lore:\n" + " - \"Click to open\"\n" + " - \"%value% menu\"\n"
|
||||
+ " enabled: true\n" + " database: true\n" + " config: search\n"
|
||||
+ " permission: buildbattle.heads\n" + " menuname: \"%value% blocks\"");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updatePluginFileVersion(File file, FileConfiguration fileConfiguration, int oldVersion,
|
||||
int newVersion)
|
||||
{
|
||||
|
||||
int coreVersion = fileConfiguration.getInt("Do-Not-Edit.Core-Version", 0);
|
||||
updateFileVersion(file, coreVersion, coreVersion, newVersion, oldVersion);
|
||||
|
||||
}
|
||||
|
||||
private void updateFileVersion(File file, int coreVersion, int oldCoreVersion, int fileVersion,
|
||||
int oldFileVersion)
|
||||
{
|
||||
|
||||
MigratorUtils.removeLineFromFile(file, "# Don't edit it. But who's stopping you? It's your server!");
|
||||
MigratorUtils.removeLineFromFile(file, "# Really, don't edit ;p");
|
||||
MigratorUtils.removeLineFromFile(file, "# You edited it, huh? Next time hurt yourself!");
|
||||
MigratorUtils.removeLineFromFile(file, "Do-Not-Edit:");
|
||||
MigratorUtils.removeLineFromFile(file, " File-Version: " + oldFileVersion + "");
|
||||
MigratorUtils.removeLineFromFile(file, " Core-Version: " + oldCoreVersion + "");
|
||||
MigratorUtils.addNewLines(file,
|
||||
"# Don't edit it. But who's stopping you? It's your server!\r\n" + "# Really, don't edit ;p\r\n"
|
||||
+ "# You edited it, huh? Next time hurt yourself!\r\n" + "Do-Not-Edit:\r\n" + " File-Version: "
|
||||
+ fileVersion + "\r\n" + " Core-Version: " + coreVersion + "\r\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Binary file not shown.
@@ -25,54 +25,70 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class MenuOption {
|
||||
|
||||
private int slot;
|
||||
private final String id;
|
||||
private final ItemStack itemStack;
|
||||
private String inventoryName;
|
||||
private int slot;
|
||||
private final String id;
|
||||
private final ItemStack itemStack;
|
||||
private String inventoryName;
|
||||
|
||||
public MenuOption(int slot, String id, ItemStack itemStack) {
|
||||
this.slot = slot;
|
||||
this.id = id;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
public MenuOption(int slot, String id, ItemStack itemStack) {
|
||||
|
||||
public MenuOption(int slot, String id, ItemStack itemStack, String inventoryName) {
|
||||
this.slot = slot;
|
||||
this.id = id;
|
||||
this.itemStack = itemStack;
|
||||
this.inventoryName = inventoryName;
|
||||
}
|
||||
this.slot = slot;
|
||||
this.id = id;
|
||||
this.itemStack = itemStack;
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSlot(int slot) {
|
||||
this.slot = slot;
|
||||
}
|
||||
public MenuOption(int slot, String id, ItemStack itemStack, String inventoryName) {
|
||||
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
this.slot = slot;
|
||||
this.id = id;
|
||||
this.itemStack = itemStack;
|
||||
this.inventoryName = inventoryName;
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
public String getInventoryName() {
|
||||
return inventoryName;
|
||||
}
|
||||
public int getSlot() {
|
||||
|
||||
return slot;
|
||||
|
||||
}
|
||||
|
||||
public void setSlot(int slot) {
|
||||
|
||||
this.slot = slot;
|
||||
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
|
||||
return itemStack;
|
||||
|
||||
}
|
||||
|
||||
public String getInventoryName() {
|
||||
|
||||
return inventoryName;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when item is clicked within Options Menu inventory
|
||||
*
|
||||
* @param e passed InventoryClickEvent from Options Menu
|
||||
*/
|
||||
public void onClick(InventoryClickEvent e) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when item is clicked within Options Menu inventory
|
||||
*
|
||||
* @param e passed InventoryClickEvent from Options Menu
|
||||
*/
|
||||
public void onClick(InventoryClickEvent e) {
|
||||
}
|
||||
}
|
||||
@@ -46,159 +46,222 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class OptionsRegistry {
|
||||
|
||||
private ParticleRegistry particleRegistry;
|
||||
private BiomesRegistry biomesRegistry;
|
||||
private PlayerHeadsRegistry playerHeadsRegistry;
|
||||
private final Set<MenuOption> registeredOptions = new HashSet<>();
|
||||
private int inventorySize = 5 * 9;
|
||||
private final ItemStack menuItem;
|
||||
private final Main plugin;
|
||||
private ParticleRegistry particleRegistry;
|
||||
private BiomesRegistry biomesRegistry;
|
||||
private PlayerHeadsRegistry playerHeadsRegistry;
|
||||
private final Set<MenuOption> registeredOptions = new HashSet<>();
|
||||
private int inventorySize = 5 * 9;
|
||||
private final ItemStack menuItem;
|
||||
private final Main plugin;
|
||||
|
||||
private NormalFastInv optionsGui;
|
||||
private NormalFastInv optionsGui;
|
||||
|
||||
public OptionsRegistry(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
this.menuItem = plugin.getSpecialItemManager().getSpecialItemStack("OPTIONS_MENU");
|
||||
}
|
||||
public OptionsRegistry(Main plugin) {
|
||||
|
||||
public void registerOptions() {
|
||||
biomesRegistry = new BiomesRegistry(this);
|
||||
new BiomeChangeOption(this);
|
||||
this.plugin = plugin;
|
||||
this.menuItem = plugin.getSpecialItemManager().getSpecialItemStack("OPTIONS_MENU");
|
||||
|
||||
new FloorChangeOption(this);
|
||||
|
||||
//register particles
|
||||
particleRegistry = new ParticleRegistry(this);
|
||||
new ParticlesOption(this);
|
||||
|
||||
//register player heads
|
||||
playerHeadsRegistry = new PlayerHeadsRegistry(this);
|
||||
new PlayerHeadsOption(this);
|
||||
|
||||
new PlotResetOption(this);
|
||||
new TimeChangeOption(this);
|
||||
new WeatherChangeOption(this);
|
||||
new BannerCreatorOption(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers new menu option available in options menu in game.
|
||||
*
|
||||
* @param option option to register
|
||||
* @throws IllegalArgumentException if option slot is same as one of already registered ones
|
||||
* or ID of option is same as one of registered one
|
||||
*/
|
||||
public void registerOption(MenuOption option) {
|
||||
for(MenuOption opt : registeredOptions) {
|
||||
if(opt.getSlot() == option.getSlot()) {
|
||||
throw new IllegalArgumentException("Cannot register new option on existing option slot!");
|
||||
}
|
||||
if(opt.getID().equals(option.getID())) {
|
||||
throw new IllegalArgumentException("Cannot register new option with equal identifier!");
|
||||
}
|
||||
}
|
||||
registeredOptions.add(option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters menu option that available in options menu
|
||||
*
|
||||
* @param option option to unregister
|
||||
* @throws IllegalArgumentException if option doesn't exist
|
||||
*/
|
||||
public void unregisterOption(MenuOption option) {
|
||||
if(!registeredOptions.remove(option)) {
|
||||
throw new IllegalArgumentException("Cannot remove non existing option!");
|
||||
public void registerOptions() {
|
||||
|
||||
biomesRegistry = new BiomesRegistry(this);
|
||||
new BiomeChangeOption(this);
|
||||
|
||||
new FloorChangeOption(this);
|
||||
|
||||
// register particles
|
||||
particleRegistry = new ParticleRegistry(this);
|
||||
new ParticlesOption(this);
|
||||
|
||||
// register player heads
|
||||
playerHeadsRegistry = new PlayerHeadsRegistry(this);
|
||||
new PlayerHeadsOption(this);
|
||||
|
||||
new PlotResetOption(this);
|
||||
new TimeChangeOption(this);
|
||||
new WeatherChangeOption(this);
|
||||
new BannerCreatorOption(this);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines new size of options inventory
|
||||
*
|
||||
* @param size size to set
|
||||
*/
|
||||
public void defineInventorySize(int size) {
|
||||
inventorySize = size;
|
||||
}
|
||||
/**
|
||||
* Registers new menu option available in options menu in game.
|
||||
*
|
||||
* @param option option to register
|
||||
* @throws IllegalArgumentException if option slot is same as one of already
|
||||
* registered ones or ID of option is same as
|
||||
* one of registered one
|
||||
*/
|
||||
public void registerOption(MenuOption option) {
|
||||
|
||||
for (MenuOption opt : registeredOptions) {
|
||||
|
||||
if (opt.getSlot() == option.getSlot()) {
|
||||
|
||||
throw new IllegalArgumentException("Cannot register new option on existing option slot!");
|
||||
|
||||
}
|
||||
|
||||
if (opt.getID().equals(option.getID())) {
|
||||
|
||||
throw new IllegalArgumentException("Cannot register new option with equal identifier!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registeredOptions.add(option);
|
||||
|
||||
/**
|
||||
* Creates inventory with all of registered menu options
|
||||
*
|
||||
* @return options inventory
|
||||
*/
|
||||
public NormalFastInv getOptionsGui() {
|
||||
if(optionsGui != null)
|
||||
return optionsGui;
|
||||
NormalFastInv gui = new NormalFastInv(inventorySize, new MessageBuilder("MENU_OPTION_INVENTORY").asKey().build());
|
||||
gui.addClickHandler(clickEvent -> {
|
||||
if(clickEvent.getClickedInventory() != gui.getInventory()) {
|
||||
clickEvent.setCancelled(false);
|
||||
}
|
||||
});
|
||||
for(MenuOption option : registeredOptions) {
|
||||
gui.setItem(option.getSlot(), new SimpleClickableItem(option.getItemStack(), option::onClick));
|
||||
}
|
||||
return optionsGui = gui;
|
||||
}
|
||||
|
||||
public Set<MenuOption> getRegisteredOptions() {
|
||||
return registeredOptions;
|
||||
}
|
||||
/**
|
||||
* Unregisters menu option that available in options menu
|
||||
*
|
||||
* @param option option to unregister
|
||||
* @throws IllegalArgumentException if option doesn't exist
|
||||
*/
|
||||
public void unregisterOption(MenuOption option) {
|
||||
|
||||
public ItemStack getMenuItem() {
|
||||
return menuItem;
|
||||
}
|
||||
if (!registeredOptions.remove(option)) {
|
||||
|
||||
public BiomesRegistry getBiomesRegistry() {
|
||||
return biomesRegistry;
|
||||
}
|
||||
throw new IllegalArgumentException("Cannot remove non existing option!");
|
||||
|
||||
public PlayerHeadsRegistry getPlayerHeadsRegistry() {
|
||||
return playerHeadsRegistry;
|
||||
}
|
||||
}
|
||||
|
||||
public ParticleRegistry getParticleRegistry() {
|
||||
return particleRegistry;
|
||||
}
|
||||
|
||||
public Main getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
private ItemBuilder backButton;
|
||||
|
||||
private SimpleClickableItem getBackItem() {
|
||||
if(backButton == null) {
|
||||
backButton = new ItemBuilder(XMaterial.STONE_BUTTON.parseItem())
|
||||
.name(new MessageBuilder("MENU_BUTTONS_BACK_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_BUTTONS_BACK_ITEM_LORE").asKey().build());
|
||||
}
|
||||
return new SimpleClickableItem(backButton.build(), event -> {
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
getOptionsGui().open(event.getWhoClicked());
|
||||
});
|
||||
}
|
||||
|
||||
public void addGoBackItem(ItemMap page, int slot) {
|
||||
page.setItem(slot, getBackItem());
|
||||
}
|
||||
/**
|
||||
* Defines new size of options inventory
|
||||
*
|
||||
* @param size size to set
|
||||
*/
|
||||
public void defineInventorySize(int size) {
|
||||
|
||||
public void addGoBackItem(NormalFastInv gui, int slot) {
|
||||
gui.setItem(slot, getBackItem());
|
||||
}
|
||||
inventorySize = size;
|
||||
|
||||
public void addGoBackItem(PaginatedFastInv gui, int slot) {
|
||||
gui.setItem(slot, backButton.build(), event -> {
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
getOptionsGui().open(event.getWhoClicked());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates inventory with all of registered menu options
|
||||
*
|
||||
* @return options inventory
|
||||
*/
|
||||
public NormalFastInv getOptionsGui() {
|
||||
|
||||
if (optionsGui != null)
|
||||
return optionsGui;
|
||||
NormalFastInv gui = new NormalFastInv(inventorySize,
|
||||
new MessageBuilder("MENU_OPTION_INVENTORY").asKey().build());
|
||||
gui.addClickHandler(clickEvent -> {
|
||||
|
||||
if (clickEvent.getClickedInventory() != gui.getInventory()) {
|
||||
|
||||
clickEvent.setCancelled(false);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
for (MenuOption option : registeredOptions) {
|
||||
|
||||
gui.setItem(option.getSlot(), new SimpleClickableItem(option.getItemStack(), option::onClick));
|
||||
|
||||
}
|
||||
|
||||
return optionsGui = gui;
|
||||
|
||||
}
|
||||
|
||||
public Set<MenuOption> getRegisteredOptions() {
|
||||
|
||||
return registeredOptions;
|
||||
|
||||
}
|
||||
|
||||
public ItemStack getMenuItem() {
|
||||
|
||||
return menuItem;
|
||||
|
||||
}
|
||||
|
||||
public BiomesRegistry getBiomesRegistry() {
|
||||
|
||||
return biomesRegistry;
|
||||
|
||||
}
|
||||
|
||||
public PlayerHeadsRegistry getPlayerHeadsRegistry() {
|
||||
|
||||
return playerHeadsRegistry;
|
||||
|
||||
}
|
||||
|
||||
public ParticleRegistry getParticleRegistry() {
|
||||
|
||||
return particleRegistry;
|
||||
|
||||
}
|
||||
|
||||
public Main getPlugin() {
|
||||
|
||||
return plugin;
|
||||
|
||||
}
|
||||
|
||||
private ItemBuilder backButton;
|
||||
|
||||
private SimpleClickableItem getBackItem() {
|
||||
|
||||
if (backButton == null) {
|
||||
|
||||
backButton = new ItemBuilder(XMaterial.STONE_BUTTON.parseItem())
|
||||
.name(new MessageBuilder("MENU_BUTTONS_BACK_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_BUTTONS_BACK_ITEM_LORE").asKey().build());
|
||||
|
||||
}
|
||||
|
||||
return new SimpleClickableItem(backButton.build(), event -> {
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
getOptionsGui().open(event.getWhoClicked());
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void addGoBackItem(ItemMap page, int slot) {
|
||||
|
||||
page.setItem(slot, getBackItem());
|
||||
|
||||
}
|
||||
|
||||
public void addGoBackItem(NormalFastInv gui, int slot) {
|
||||
|
||||
gui.setItem(slot, getBackItem());
|
||||
|
||||
}
|
||||
|
||||
public void addGoBackItem(PaginatedFastInv gui, int slot) {
|
||||
|
||||
gui.setItem(slot,
|
||||
new ItemBuilder(XMaterial.STONE_BUTTON.parseItem())
|
||||
.name(new MessageBuilder("MENU_BUTTONS_BACK_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_BUTTONS_BACK_ITEM_LORE").asKey().build()).build(),
|
||||
event ->
|
||||
{
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
getOptionsGui().open(event.getWhoClicked());
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+124
-45
@@ -21,11 +21,13 @@
|
||||
package plugily.projects.buildbattle.handlers.menu.registry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
@@ -33,68 +35,145 @@ import plugily.projects.buildbattle.handlers.menu.MenuOption;
|
||||
import plugily.projects.buildbattle.handlers.menu.OptionsRegistry;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.ServerVersion;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XEntityType;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class FloorChangeOption {
|
||||
public class FloorChangeOption implements Listener {
|
||||
|
||||
public FloorChangeOption(OptionsRegistry registry) {
|
||||
registry.registerOption(new MenuOption(14, "FLOOR", new ItemBuilder(XMaterial.OAK_LOG.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_FLOOR_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_FLOOR_ITEM_LORE").asKey().build())
|
||||
.build()) {
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
ItemStack itemStack = event.getCursor();
|
||||
if (itemStack == null)
|
||||
return;
|
||||
private final Set<UUID> pendingFloorChange = new HashSet<>();
|
||||
private final OptionsRegistry registry;
|
||||
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
public FloorChangeOption(OptionsRegistry registry) {
|
||||
|
||||
if(!(humanEntity instanceof Player))
|
||||
return;
|
||||
this.registry = registry;
|
||||
registry.getPlugin().getServer().getPluginManager().registerEvents(this, registry.getPlugin());
|
||||
|
||||
registry.registerOption(new MenuOption(14, "FLOOR",
|
||||
new ItemBuilder(XMaterial.OAK_LOG.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_FLOOR_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_FLOOR_ITEM_LORE").asKey().build()).build())
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
|
||||
if (!(humanEntity instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if (arena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
pendingFloorChange.add(player.getUniqueId());
|
||||
player.closeInventory();
|
||||
player.sendMessage("§eRight click a block to make it the floor!");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if (!pendingFloorChange.contains(player.getUniqueId())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK
|
||||
&& event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_AIR)
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
if (arena == null) {
|
||||
|
||||
Material material = itemStack.getType();
|
||||
if(material != XMaterial.WATER_BUCKET.parseMaterial() && material != XMaterial.LAVA_BUCKET.parseMaterial()
|
||||
&& !(material.isBlock() && material.isSolid() && material.isOccluding())) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_FLOOR_ITEM").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
pendingFloorChange.remove(player.getUniqueId());
|
||||
return;
|
||||
|
||||
if(registry.getPlugin().getBlacklistManager().getFloorList().contains(material)) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_FLOOR_ITEM").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if (plot == null)
|
||||
return;
|
||||
if (plot == null) {
|
||||
|
||||
plot.changeFloor(material, XMaterial.matchXMaterial(itemStack).getData());
|
||||
pendingFloorChange.remove(player.getUniqueId());
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Material material = null;
|
||||
byte data = 0;
|
||||
|
||||
ItemStack itemStack = event.getItem();
|
||||
if (itemStack != null && itemStack.getType() != Material.AIR) {
|
||||
|
||||
material = itemStack.getType();
|
||||
data = XMaterial.matchXMaterial(itemStack).getData();
|
||||
|
||||
} else if (event.getClickedBlock() != null) {
|
||||
|
||||
material = event.getClickedBlock().getType();
|
||||
data = event.getClickedBlock().getData();
|
||||
|
||||
}
|
||||
|
||||
if (material == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (material != XMaterial.WATER_BUCKET.parseMaterial() && material != XMaterial.LAVA_BUCKET.parseMaterial()
|
||||
&& !(material.isBlock() && material.isSolid() && material.isOccluding()))
|
||||
{
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_FLOOR_ITEM").asKey().player(player).sendPlayer();
|
||||
pendingFloorChange.remove(player.getUniqueId());
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (registry.getPlugin().getBlacklistManager().getFloorList().contains(material)) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_FLOOR_ITEM").asKey().player(player).sendPlayer();
|
||||
pendingFloorChange.remove(player.getUniqueId());
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plot.changeFloor(material, data);
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_FLOOR_CHANGED").asKey().player(player).sendPlayer();
|
||||
pendingFloorChange.remove(player.getUniqueId());
|
||||
event.setCancelled(true);
|
||||
|
||||
itemStack.setAmount(0);
|
||||
itemStack.setType(Material.AIR);
|
||||
event.getCurrentItem().setType(Material.AIR);
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
player.getNearbyEntities(5, 5, 5).stream().filter(entity -> entity.getType() == XEntityType.ITEM.get())
|
||||
.forEach(Entity::remove);
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
pendingFloorChange.remove(event.getPlayer().getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+38
-27
@@ -33,41 +33,52 @@ import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class PlotResetOption {
|
||||
|
||||
public PlotResetOption(OptionsRegistry registry) {
|
||||
//todo reset after confirmation
|
||||
registry.registerOption(new MenuOption(34, "RESET", new ItemBuilder(Material.BARRIER)
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_RESET_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_RESET_ITEM_LORE").asKey().build())
|
||||
.build()) {
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent e) {
|
||||
HumanEntity humanEntity = e.getWhoClicked();
|
||||
public PlotResetOption(OptionsRegistry registry) {
|
||||
|
||||
if (!(humanEntity instanceof Player))
|
||||
return;
|
||||
// todo reset after confirmation
|
||||
registry.registerOption(new MenuOption(34, "RESET",
|
||||
new ItemBuilder(Material.BARRIER)
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_RESET_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_RESET_ITEM_LORE").asKey().build()).build())
|
||||
{
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent e) {
|
||||
|
||||
player.closeInventory();
|
||||
HumanEntity humanEntity = e.getWhoClicked();
|
||||
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
if (!(humanEntity instanceof Player))
|
||||
return;
|
||||
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
Player player = (Player) humanEntity;
|
||||
|
||||
if (plot != null) {
|
||||
plot.resetPlot();
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_RESET_CHAT").asKey().player(player).sendPlayer();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
player.closeInventory();
|
||||
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if (arena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
|
||||
if (plot != null) {
|
||||
|
||||
plot.resetPlot();
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_RESET_CHAT").asKey().player(player).sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+104
-68
@@ -37,90 +37,126 @@ import static plugily.projects.buildbattle.handlers.menu.registry.TimeChangeOpti
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class TimeChangeOption {
|
||||
|
||||
public TimeChangeOption(OptionsRegistry registry) {
|
||||
registry.registerOption(new MenuOption(30, "TIME", new ItemBuilder(XMaterial.CLOCK.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_TIME_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_TIME_ITEM_LORE").asKey().build())
|
||||
.build(), new MessageBuilder("MENU_OPTION_CONTENT_TIME_INVENTORY").asKey().build()) {
|
||||
public TimeChangeOption(OptionsRegistry registry) {
|
||||
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if(!(humanEntity instanceof Player))
|
||||
return;
|
||||
registry.registerOption(new MenuOption(30, "TIME",
|
||||
new ItemBuilder(XMaterial.CLOCK.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_TIME_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_TIME_ITEM_LORE").asKey().build()).build(),
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_TIME_INVENTORY").asKey().build())
|
||||
{
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
NormalFastInv gui = new NormalFastInv(9, new MessageBuilder("MENU_OPTION_CONTENT_TIME_INVENTORY").asKey().build());
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if(plot == null) {
|
||||
return;
|
||||
}
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if (!(humanEntity instanceof Player))
|
||||
return;
|
||||
|
||||
//gui.addItem(new ItemBuilder(XMaterial.CLOCK.parseItem()).name(new MessageBuilder("MENU_OPTION_CONTENT_TIME_TYPE_WORLD").asKey().build()).lore(plot.getTime().name()).build());
|
||||
Player player = (Player) humanEntity;
|
||||
NormalFastInv gui = new NormalFastInv(9,
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_TIME_INVENTORY").asKey().build());
|
||||
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_WORLD");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_DAY");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_NOON");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_SUNSET");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_NIGHT");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_MIDNIGHT");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_SUNRISE");
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, 8);
|
||||
gui.open(player);
|
||||
}
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if (arena == null) {
|
||||
|
||||
private void addClockItem(NormalFastInv gui, Plot plot, String messageKey) {
|
||||
gui.addItem(new SimpleClickableItem(new ItemBuilder(XMaterial.CLOCK.parseItem()).name(new MessageBuilder(messageKey).asKey().build()).build(), event -> {
|
||||
Plot.Time time = Plot.Time.valueOf(getByPosition(event.getSlot()).toString());
|
||||
plot.setTime(time);
|
||||
return;
|
||||
|
||||
for(Player p : plot.getMembers()) {
|
||||
p.setPlayerTime(Plot.Time.format(time, p.getWorld().getTime()), false);
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_TIME_CHANGED").asKey().player(p).value(time.name()).sendPlayer();
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public enum TimeClickPosition {
|
||||
WORLD_TIME(0), DAY(1), NOON(2), SUNSET(3), NIGHT(4), MIDNIGHT(5), SUNRISE(6);
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if (plot == null) {
|
||||
|
||||
private final int position;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// gui.addItem(new ItemBuilder(XMaterial.CLOCK.parseItem()).name(new
|
||||
// MessageBuilder("MENU_OPTION_CONTENT_TIME_TYPE_WORLD").asKey().build()).lore(plot.getTime().name()).build());
|
||||
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_WORLD");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_DAY");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_NOON");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_SUNSET");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_NIGHT");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_MIDNIGHT");
|
||||
addClockItem(gui, plot, "MENU_OPTION_CONTENT_TIME_TYPE_SUNRISE");
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, 8);
|
||||
gui.open(player);
|
||||
|
||||
}
|
||||
|
||||
private void addClockItem(NormalFastInv gui, Plot plot, String messageKey) {
|
||||
|
||||
gui.addItem(new SimpleClickableItem(new ItemBuilder(XMaterial.CLOCK.parseItem())
|
||||
.name(new MessageBuilder(messageKey).asKey().build()).build(), event ->
|
||||
{
|
||||
|
||||
Plot.Time time = Plot.Time.valueOf(getByPosition(event.getSlot()).toString());
|
||||
plot.setTime(time);
|
||||
|
||||
for (Player p : plot.getMembers()) {
|
||||
|
||||
p.setPlayerTime(Plot.Time.format(time, p.getWorld().getTime()), false);
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_TIME_CHANGED").asKey().player(p)
|
||||
.value(new MessageBuilder(messageKey).asKey().build()).sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
TimeClickPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get time by clicked inventory position
|
||||
*
|
||||
* @param pos clicked position
|
||||
* @return clicked time, returns WORLD_TIME if clicked not matching results
|
||||
*/
|
||||
public static TimeClickPosition getByPosition(int pos) {
|
||||
for(TimeClickPosition position : values()) {
|
||||
if(position.getPosition() == pos) {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
return WORLD_TIME;
|
||||
}
|
||||
public enum TimeClickPosition {
|
||||
|
||||
WORLD_TIME(0), DAY(1), NOON(2), SUNSET(3), NIGHT(4), MIDNIGHT(5), SUNRISE(6);
|
||||
|
||||
private final int position;
|
||||
|
||||
TimeClickPosition(int position) {
|
||||
|
||||
this.position = position;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get time by clicked inventory position
|
||||
*
|
||||
* @param pos clicked position
|
||||
* @return clicked time, returns WORLD_TIME if clicked not matching results
|
||||
*/
|
||||
public static TimeClickPosition getByPosition(int pos) {
|
||||
|
||||
for (TimeClickPosition position : values()) {
|
||||
|
||||
if (position.getPosition() == pos) {
|
||||
|
||||
return position;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return WORLD_TIME;
|
||||
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
|
||||
return position;
|
||||
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+75
-42
@@ -36,55 +36,88 @@ import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class WeatherChangeOption {
|
||||
|
||||
public WeatherChangeOption(OptionsRegistry registry) {
|
||||
//todo add stormy (lightnings) and winter (snowflakes) with ice biome
|
||||
registry.registerOption(new MenuOption(28, "WEATHER", new ItemBuilder(Material.BUCKET)
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_ITEM_LORE").asKey().build())
|
||||
.build(), new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_INVENTORY").asKey().build()) {
|
||||
public WeatherChangeOption(OptionsRegistry registry) {
|
||||
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if(!(humanEntity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
// todo add stormy (lightnings) and winter (snowflakes) with ice biome
|
||||
registry.registerOption(new MenuOption(28, "WEATHER",
|
||||
new ItemBuilder(Material.BUCKET)
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_ITEM_LORE").asKey().build()).build(),
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_INVENTORY").asKey().build())
|
||||
{
|
||||
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if(plot == null) {
|
||||
return;
|
||||
}
|
||||
NormalFastInv gui = new NormalFastInv(9, new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_INVENTORY").asKey().build());
|
||||
for(WeatherType weatherType : WeatherType.values()) {
|
||||
Material material = Material.BUCKET;
|
||||
if (weatherType == WeatherType.DOWNFALL) {
|
||||
material = Material.WATER_BUCKET;
|
||||
}
|
||||
gui.addItem(new SimpleClickableItem(new ItemBuilder(material).name(new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_TYPE_" + weatherType.name()).asKey().build()).build(), clickEvent -> {
|
||||
plot.setWeatherType(weatherType);
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if (!(humanEntity instanceof Player)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
|
||||
if (arena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if (plot == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
NormalFastInv gui = new NormalFastInv(9,
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_INVENTORY").asKey().build());
|
||||
for (WeatherType weatherType : WeatherType.values()) {
|
||||
|
||||
Material material = Material.BUCKET;
|
||||
if (weatherType == WeatherType.DOWNFALL) {
|
||||
|
||||
material = Material.WATER_BUCKET;
|
||||
|
||||
}
|
||||
|
||||
gui.addItem(new SimpleClickableItem(new ItemBuilder(material)
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_TYPE_" + weatherType.name()).asKey()
|
||||
.build())
|
||||
.build(), clickEvent ->
|
||||
{
|
||||
|
||||
plot.setWeatherType(weatherType);
|
||||
|
||||
for (Player p : plot.getMembers()) {
|
||||
|
||||
p.setPlayerWeather(plot.getWeatherType());
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_CHANGED").asKey().value(
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_TYPE_" + weatherType.name())
|
||||
.asKey().build())
|
||||
.player(p).sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, 8);
|
||||
gui.open(player);
|
||||
|
||||
for(Player p : plot.getMembers()) {
|
||||
p.setPlayerWeather(plot.getWeatherType());
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_CHANGED").asKey().value(new MessageBuilder("MENU_OPTION_CONTENT_WEATHER_TYPE_" + weatherType.name()).asKey().build()).player(p).sendPlayer();
|
||||
}
|
||||
}));
|
||||
}
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, 8);
|
||||
gui.open(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+66
-43
@@ -35,58 +35,81 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
*/
|
||||
public class Banner {
|
||||
|
||||
private final List<BannerPattern> patterns = new LinkedList<>();
|
||||
private DyeColor color = DyeColor.WHITE;
|
||||
private final List<BannerPattern> patterns = new LinkedList<>();
|
||||
private DyeColor color = DyeColor.WHITE;
|
||||
|
||||
public void setBaseColor(DyeColor dyeColor) {
|
||||
color = dyeColor;
|
||||
}
|
||||
public void setBaseColor(DyeColor dyeColor) {
|
||||
|
||||
public void addPattern(BannerPattern pattern) {
|
||||
patterns.add(pattern);
|
||||
}
|
||||
color = dyeColor;
|
||||
|
||||
public void replaceLastPattern(BannerPattern pattern) {
|
||||
patterns.remove(patterns.size() - 1);
|
||||
patterns.add(pattern);
|
||||
}
|
||||
|
||||
public BannerPattern getLastPattern() {
|
||||
if(patterns.isEmpty()) {
|
||||
return new BannerPattern(DyeColor.BLACK, PatternType.BASE);
|
||||
}
|
||||
return patterns.get(patterns.size() - 1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ItemStack buildBanner() {
|
||||
ItemStack item = XMaterial.WHITE_BANNER.parseItem();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
BlockStateMeta bsm = (BlockStateMeta) meta;
|
||||
BlockState state = ((BlockStateMeta) meta).getBlockState();
|
||||
if (state instanceof org.bukkit.block.Banner) {
|
||||
((org.bukkit.block.Banner) state).setBaseColor(color);
|
||||
state.update(true);
|
||||
}
|
||||
bsm.setBlockState(state);
|
||||
}
|
||||
|
||||
for(BannerPattern pattern : patterns) {
|
||||
meta.addPattern(new Pattern(pattern.getDyeColor(), pattern.getPatternType()));
|
||||
public void addPattern(BannerPattern pattern) {
|
||||
|
||||
patterns.add(pattern);
|
||||
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
public void replaceLastPattern(BannerPattern pattern) {
|
||||
|
||||
patterns.remove(patterns.size() - 1);
|
||||
patterns.add(pattern);
|
||||
|
||||
}
|
||||
|
||||
public BannerPattern getLastPattern() {
|
||||
|
||||
if (patterns.isEmpty()) {
|
||||
|
||||
return new BannerPattern(DyeColor.BLACK, PatternType.BASE);
|
||||
|
||||
}
|
||||
|
||||
return patterns.get(patterns.size() - 1);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ItemStack buildBanner() {
|
||||
|
||||
ItemStack item = XMaterial.WHITE_BANNER.parseItem();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
|
||||
if (ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
|
||||
BlockStateMeta bsm = (BlockStateMeta) meta;
|
||||
BlockState state = ((BlockStateMeta) meta).getBlockState();
|
||||
if (state instanceof org.bukkit.block.Banner) {
|
||||
|
||||
((org.bukkit.block.Banner) state).setBaseColor(color);
|
||||
state.update(true);
|
||||
|
||||
}
|
||||
|
||||
bsm.setBlockState(state);
|
||||
|
||||
}
|
||||
|
||||
for (BannerPattern pattern : patterns) {
|
||||
|
||||
meta.addPattern(new Pattern(pattern.getDyeColor(), pattern.getPatternType()));
|
||||
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
public DyeColor getColor() {
|
||||
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
public DyeColor getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
+26
-17
@@ -32,27 +32,36 @@ import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
*/
|
||||
public class BannerCreatorOption {
|
||||
|
||||
public BannerCreatorOption(OptionsRegistry registry) {
|
||||
registry.registerOption(new MenuOption(16, "BANNER_CREATOR", new ItemBuilder(XMaterial.WHITE_BANNER.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_LORE").asKey().build())
|
||||
.build()) {
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
public BannerCreatorOption(OptionsRegistry registry) {
|
||||
|
||||
humanEntity.closeInventory();
|
||||
registry.registerOption(new MenuOption(16, "BANNER_CREATOR",
|
||||
new ItemBuilder(XMaterial.WHITE_BANNER.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_LORE").asKey().build()).build())
|
||||
{
|
||||
|
||||
if (humanEntity instanceof Player) {
|
||||
new BannerMenu((Player) humanEntity).openInventory(BannerMenu.PatternStage.BASE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
|
||||
humanEntity.closeInventory();
|
||||
|
||||
if (humanEntity instanceof Player) {
|
||||
|
||||
new BannerMenu((Player) humanEntity).openInventory(BannerMenu.PatternStage.BASE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+138
-96
@@ -34,6 +34,7 @@ import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.ServerVersion;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XPatternType;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
|
||||
@@ -42,129 +43,170 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
*/
|
||||
public class BannerMenu {
|
||||
|
||||
private final Main plugin = JavaPlugin.getPlugin(Main.class);
|
||||
private final Map<PatternStage, NormalFastInv> guiStages = new EnumMap<>(PatternStage.class);
|
||||
private final Banner banner;
|
||||
private final Player player;
|
||||
private final Main plugin = JavaPlugin.getPlugin(Main.class);
|
||||
private final Map<PatternStage, NormalFastInv> guiStages = new EnumMap<>(PatternStage.class);
|
||||
private final Banner banner;
|
||||
private final Player player;
|
||||
|
||||
public BannerMenu(Player player) {
|
||||
this(player, new Banner());
|
||||
}
|
||||
public BannerMenu(Player player) {
|
||||
|
||||
public BannerMenu(Player player, Banner banner) {
|
||||
this.player = player;
|
||||
this.banner = banner;
|
||||
prepareBaseStageGui();
|
||||
prepareLayerStageGui();
|
||||
prepareLayerColorStageGui();
|
||||
}
|
||||
this(player, new Banner());
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void prepareBaseStageGui() {
|
||||
NormalFastInv gui = new NormalFastInv(54, new MessageBuilder("MENU_OPTION_CONTENT_BANNER_INVENTORY_COLOR").asKey().build());
|
||||
}
|
||||
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
ItemStack item;
|
||||
public BannerMenu(Player player, Banner banner) {
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
item = XMaterial.WHITE_BANNER.parseItem();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
this.player = player;
|
||||
this.banner = banner;
|
||||
prepareBaseStageGui();
|
||||
prepareLayerStageGui();
|
||||
prepareLayerColorStageGui();
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void prepareBaseStageGui() {
|
||||
|
||||
NormalFastInv gui = new NormalFastInv(54,
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_BANNER_INVENTORY_COLOR").asKey().build());
|
||||
|
||||
for (DyeColor color : DyeColor.values()) {
|
||||
|
||||
ItemStack item;
|
||||
|
||||
if (ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
|
||||
item = XMaterial.WHITE_BANNER.parseItem();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
|
||||
BlockStateMeta bsm = (BlockStateMeta) meta;
|
||||
BlockState state = ((BlockStateMeta) meta).getBlockState();
|
||||
if (state instanceof org.bukkit.block.Banner) {
|
||||
|
||||
((org.bukkit.block.Banner) state).setBaseColor(color);
|
||||
state.update(true);
|
||||
|
||||
}
|
||||
|
||||
bsm.setBlockState(state);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
} else {
|
||||
|
||||
item = XMaterial.matchXMaterial(color.toString() + "_BANNER").orElse(XMaterial.WHITE_BANNER)
|
||||
.parseItem();
|
||||
|
||||
}
|
||||
|
||||
gui.addItem(new SimpleClickableItem(item, event -> {
|
||||
|
||||
event.setCancelled(true);
|
||||
banner.setBaseColor(color);
|
||||
banner.addPattern(new BannerPattern(color, PatternType.BASE));
|
||||
new BannerMenu(player, banner).openInventory(PatternStage.LAYER);
|
||||
|
||||
}));
|
||||
|
||||
BlockStateMeta bsm = (BlockStateMeta) meta;
|
||||
BlockState state = ((BlockStateMeta) meta).getBlockState();
|
||||
if (state instanceof org.bukkit.block.Banner) {
|
||||
((org.bukkit.block.Banner) state).setBaseColor(color);
|
||||
state.update(true);
|
||||
}
|
||||
bsm.setBlockState(state);
|
||||
item.setItemMeta(meta);
|
||||
} else {
|
||||
item = XMaterial.matchXMaterial(color.toString() + "_BANNER").orElse(XMaterial.WHITE_BANNER).parseItem();
|
||||
}
|
||||
|
||||
gui.addItem(new SimpleClickableItem(item, event -> {
|
||||
event.setCancelled(true);
|
||||
banner.setBaseColor(color);
|
||||
banner.addPattern(new BannerPattern(color, PatternType.BASE));
|
||||
new BannerMenu(player, banner).openInventory(PatternStage.LAYER);
|
||||
}));
|
||||
addCreatorItem(gui);
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 45);
|
||||
guiStages.put(PatternStage.BASE, gui);
|
||||
gui.refresh();
|
||||
|
||||
}
|
||||
|
||||
addCreatorItem(gui);
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 45);
|
||||
guiStages.put(PatternStage.BASE, gui);
|
||||
gui.refresh();
|
||||
}
|
||||
private void prepareLayerStageGui() {
|
||||
|
||||
private void prepareLayerStageGui() {
|
||||
NormalFastInv gui = new NormalFastInv(54, new MessageBuilder("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER").asKey().build());
|
||||
NormalFastInv gui = new NormalFastInv(54,
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER").asKey().build());
|
||||
|
||||
for(PatternType pattern : PatternType.values()) {
|
||||
ItemStack item = banner.buildBanner();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
DyeColor color = banner.getColor() == DyeColor.BLACK ? DyeColor.WHITE : DyeColor.BLACK;
|
||||
for (XPatternType pattern : XPatternType.getValues()) {
|
||||
|
||||
meta.addPattern(new Pattern(color, pattern));
|
||||
item.setItemMeta(meta);
|
||||
ItemStack item = banner.buildBanner();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
DyeColor color = banner.getColor() == DyeColor.BLACK ? DyeColor.WHITE : DyeColor.BLACK;
|
||||
|
||||
meta.addPattern(new Pattern(color, pattern.get()));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
gui.addItem(new SimpleClickableItem(item, event -> {
|
||||
|
||||
event.setCancelled(true);
|
||||
banner.addPattern(new BannerPattern(color, pattern.get()));
|
||||
new BannerMenu(player, banner).openInventory(PatternStage.LAYER_COLOR);
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
addCreatorItem(gui);
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 45);
|
||||
guiStages.put(PatternStage.LAYER, gui);
|
||||
gui.refresh();
|
||||
|
||||
gui.addItem(new SimpleClickableItem(item, event -> {
|
||||
event.setCancelled(true);
|
||||
banner.addPattern(new BannerPattern(color, pattern));
|
||||
new BannerMenu(player, banner).openInventory(PatternStage.LAYER_COLOR);
|
||||
}));
|
||||
}
|
||||
|
||||
addCreatorItem(gui);
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 45);
|
||||
guiStages.put(PatternStage.LAYER, gui);
|
||||
gui.refresh();
|
||||
}
|
||||
private void prepareLayerColorStageGui() {
|
||||
|
||||
private void prepareLayerColorStageGui() {
|
||||
NormalFastInv gui = new NormalFastInv(54, new MessageBuilder("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER_COLOR").asKey().build());
|
||||
NormalFastInv gui = new NormalFastInv(54,
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER_COLOR").asKey().build());
|
||||
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
ItemStack item = banner.buildBanner();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
for (DyeColor color : DyeColor.values()) {
|
||||
|
||||
meta.addPattern(new Pattern(color, banner.getLastPattern().getPatternType()));
|
||||
item.setItemMeta(meta);
|
||||
ItemStack item = banner.buildBanner();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
|
||||
meta.addPattern(new Pattern(color, banner.getLastPattern().getPatternType()));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
gui.addItem(new SimpleClickableItem(item, event -> {
|
||||
|
||||
event.setCancelled(true);
|
||||
banner.replaceLastPattern(new BannerPattern(color, banner.getLastPattern().getPatternType()));
|
||||
new BannerMenu(player, banner).openInventory(PatternStage.LAYER);
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
addCreatorItem(gui);
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 45);
|
||||
guiStages.put(PatternStage.LAYER_COLOR, gui);
|
||||
gui.refresh();
|
||||
|
||||
gui.addItem(new SimpleClickableItem(item, event -> {
|
||||
event.setCancelled(true);
|
||||
banner.replaceLastPattern(new BannerPattern(color, banner.getLastPattern().getPatternType()));
|
||||
new BannerMenu(player, banner).openInventory(PatternStage.LAYER);
|
||||
}));
|
||||
}
|
||||
|
||||
addCreatorItem(gui);
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 45);
|
||||
guiStages.put(PatternStage.LAYER_COLOR, gui);
|
||||
gui.refresh();
|
||||
}
|
||||
private void addCreatorItem(NormalFastInv gui) {
|
||||
|
||||
private void addCreatorItem(NormalFastInv gui) {
|
||||
gui.setItem(49, new SimpleClickableItem(new ItemBuilder(banner.buildBanner())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_LORE").asKey().build())
|
||||
.build(), event -> {
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
player.getInventory().addItem(banner.buildBanner());
|
||||
}));
|
||||
}
|
||||
gui.setItem(49,
|
||||
new SimpleClickableItem(new ItemBuilder(banner.buildBanner())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_BANNER_ITEM_CREATE_LORE").asKey().build())
|
||||
.build(), event ->
|
||||
{
|
||||
|
||||
public void openInventory(PatternStage stage) {
|
||||
guiStages.get(stage).open(player);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
player.getInventory().addItem(banner.buildBanner());
|
||||
|
||||
public enum PatternStage {
|
||||
BASE, LAYER, LAYER_COLOR
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
public void openInventory(PatternStage stage) {
|
||||
|
||||
guiStages.get(stage).open(player);
|
||||
|
||||
}
|
||||
|
||||
public enum PatternStage {
|
||||
BASE, LAYER, LAYER_COLOR
|
||||
}
|
||||
|
||||
}
|
||||
+21
-14
@@ -25,24 +25,31 @@ import org.bukkit.block.banner.PatternType;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
* <p>
|
||||
* Created at 16.07.2019
|
||||
*/
|
||||
public class BannerPattern {
|
||||
|
||||
private final DyeColor dyeColor;
|
||||
private final PatternType patternType;
|
||||
private final DyeColor dyeColor;
|
||||
private final PatternType patternType;
|
||||
|
||||
public BannerPattern(DyeColor dyeColor, PatternType patternType) {
|
||||
this.dyeColor = dyeColor;
|
||||
this.patternType = patternType;
|
||||
}
|
||||
public BannerPattern(DyeColor dyeColor, PatternType patternType) {
|
||||
|
||||
public DyeColor getDyeColor() {
|
||||
return dyeColor;
|
||||
}
|
||||
this.dyeColor = dyeColor;
|
||||
this.patternType = patternType;
|
||||
|
||||
}
|
||||
|
||||
public DyeColor getDyeColor() {
|
||||
|
||||
return dyeColor;
|
||||
|
||||
}
|
||||
|
||||
public PatternType getPatternType() {
|
||||
|
||||
return patternType;
|
||||
|
||||
}
|
||||
|
||||
public PatternType getPatternType() {
|
||||
return patternType;
|
||||
}
|
||||
}
|
||||
+97
-57
@@ -42,74 +42,114 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class BiomeChangeOption {
|
||||
|
||||
public BiomeChangeOption(OptionsRegistry registry) {
|
||||
registry.registerOption(new MenuOption(32, "BIOME", new ItemBuilder(XMaterial.MYCELIUM.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_BIOME_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_BIOME_ITEM_LORE").asKey().build())
|
||||
.build(), new MessageBuilder("MENU_OPTION_CONTENT_BIOME_INVENTORY").asKey().build()) {
|
||||
public BiomeChangeOption(OptionsRegistry registry) {
|
||||
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if(!(humanEntity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if(plot == null || plot.getCuboid() == null) {
|
||||
return;
|
||||
}
|
||||
registry.registerOption(new MenuOption(32, "BIOME",
|
||||
new ItemBuilder(XMaterial.MYCELIUM.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_BIOME_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_BIOME_ITEM_LORE").asKey().build()).build(),
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_BIOME_INVENTORY").asKey().build())
|
||||
{
|
||||
|
||||
Set<BiomeItem> biomes = registry.getBiomesRegistry().getBiomes();
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
|
||||
NormalFastInv gui = new NormalFastInv(registry.getPlugin().getBukkitHelper().serializeInt(biomes.size() + 1), new MessageBuilder("MENU_OPTION_CONTENT_BIOME_INVENTORY").asKey().build());
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if (!(humanEntity instanceof Player)) {
|
||||
|
||||
for(BiomeItem biomeItem : biomes) {
|
||||
gui.addItem(new SimpleClickableItem(biomeItem.getItemStack(), clickEvent -> {
|
||||
if(!player.hasPermission(biomeItem.getPermission())) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_BIOME").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
Biome biome = biomeItem.getBiome().getBiome();
|
||||
if(biome != null) {
|
||||
for(Block block : plot.getCuboid().blockList()) {
|
||||
block.setBiome(biome);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
for(Chunk chunk : plot.getCuboid().chunkList()) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
continue;
|
||||
}
|
||||
|
||||
for(Player p : registry.getPlugin().getServer().getOnlinePlayers()) {
|
||||
if(p.getWorld().equals(chunk.getWorld())) {
|
||||
ChunkManager.sendMapChunk(p, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
if (arena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if (plot == null || plot.getCuboid() == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Set<BiomeItem> biomes = registry.getBiomesRegistry().getBiomes();
|
||||
|
||||
NormalFastInv gui = new NormalFastInv(
|
||||
registry.getPlugin().getBukkitHelper().serializeInt(biomes.size() + 1),
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_BIOME_INVENTORY").asKey().build());
|
||||
|
||||
for (BiomeItem biomeItem : biomes) {
|
||||
|
||||
gui.addItem(new SimpleClickableItem(biomeItem.getItemStack(), clickEvent -> {
|
||||
|
||||
if (!player.hasPermission(biomeItem.getPermission())) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_BIOME").asKey().player(player)
|
||||
.sendPlayer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Biome biome = biomeItem.getBiome().getBiome();
|
||||
if (biome != null) {
|
||||
|
||||
for (Block block : plot.getCuboid().blockList()) {
|
||||
|
||||
block.setBiome(biome);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Chunk chunk : plot.getCuboid().chunkList()) {
|
||||
|
||||
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
|
||||
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (Player p : registry.getPlugin().getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getWorld().equals(chunk.getWorld())) {
|
||||
|
||||
ChunkManager.sendMapChunk(p, chunk);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Player p : plot.getMembers()) {
|
||||
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_BIOME_CHANGED").asKey().player(p).sendPlayer();
|
||||
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, gui.getInventory().getSize() - 1);
|
||||
|
||||
gui.open(player);
|
||||
|
||||
}
|
||||
|
||||
for(Player p : plot.getMembers()) {
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_BIOME_CHANGED").asKey().player(p).sendPlayer();
|
||||
}
|
||||
}));
|
||||
}
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, gui.getInventory().getSize() - 1);
|
||||
});
|
||||
|
||||
gui.open(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+29
-20
@@ -26,31 +26,40 @@ import plugily.projects.minigamesbox.classic.utils.version.xseries.XBiome;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 03.02.2019
|
||||
* <p>
|
||||
* Created at 03.02.2019
|
||||
*/
|
||||
public class BiomeItem {
|
||||
|
||||
public static final BiomeItem INVALID_BIOME = new BiomeItem(new ItemStack(Material.DIRT), "", XBiome.PLAINS);
|
||||
private final ItemStack itemStack;
|
||||
private final String permission;
|
||||
private final XBiome biome;
|
||||
public static final BiomeItem INVALID_BIOME = new BiomeItem(new ItemStack(Material.DIRT), "", XBiome.PLAINS);
|
||||
private final ItemStack itemStack;
|
||||
private final String permission;
|
||||
private final XBiome biome;
|
||||
|
||||
public BiomeItem(ItemStack itemStack, String permission, XBiome biome) {
|
||||
this.itemStack = itemStack;
|
||||
this.permission = permission;
|
||||
this.biome = biome;
|
||||
}
|
||||
public BiomeItem(ItemStack itemStack, String permission, XBiome biome) {
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
this.itemStack = itemStack;
|
||||
this.permission = permission;
|
||||
this.biome = biome;
|
||||
|
||||
public String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
|
||||
return itemStack;
|
||||
|
||||
}
|
||||
|
||||
public String getPermission() {
|
||||
|
||||
return permission;
|
||||
|
||||
}
|
||||
|
||||
public XBiome getBiome() {
|
||||
|
||||
return biome;
|
||||
|
||||
}
|
||||
|
||||
public XBiome getBiome() {
|
||||
return biome;
|
||||
}
|
||||
}
|
||||
+46
-32
@@ -35,44 +35,58 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 03.02.2019
|
||||
* <p>
|
||||
* Created at 03.02.2019
|
||||
*/
|
||||
public class BiomesRegistry {
|
||||
|
||||
private Inventory inventory;
|
||||
private final Set<BiomeItem> biomes = new HashSet<>();
|
||||
private final Main plugin;
|
||||
private Inventory inventory;
|
||||
private final Set<BiomeItem> biomes = new HashSet<>();
|
||||
private final Main plugin;
|
||||
|
||||
public BiomesRegistry(OptionsRegistry registry) {
|
||||
this.plugin = registry.getPlugin();
|
||||
registerBiomes();
|
||||
}
|
||||
public BiomesRegistry(OptionsRegistry registry) {
|
||||
|
||||
this.plugin = registry.getPlugin();
|
||||
registerBiomes();
|
||||
|
||||
private void registerBiomes() {
|
||||
FileConfiguration config = ConfigUtils.getConfig(plugin, "biomes");
|
||||
plugin.getDebugger().debug("Registering biomes!");
|
||||
int i = 0;
|
||||
for(String biome : config.getKeys(false)) {
|
||||
if(i >= 52) {
|
||||
plugin.getDebugger().debug("There are too many biomes to register! Menu can't hold any more!");
|
||||
break;
|
||||
}
|
||||
java.util.List<String> lore = config.getStringList(biome + ".lore");
|
||||
lore.replaceAll(line -> new MessageBuilder(line).build());
|
||||
BiomeItem biomeItem = new BiomeItem(new ItemBuilder(XMaterial.matchXMaterial(config
|
||||
.getString(biome + ".material-name", "bedrock").toUpperCase()).orElse(XMaterial.BEDROCK).parseItem())
|
||||
.name(new MessageBuilder(config.getString(biome + ".displayname")).build())
|
||||
.lore(lore)
|
||||
.build(), config.getString(biome + ".permission"), XBiome.of(biome).orElse(XBiome.BADLANDS));
|
||||
biomes.add(biomeItem);
|
||||
i++;
|
||||
}
|
||||
plugin.getDebugger().debug("Registered in total " + i + " biomes!");
|
||||
}
|
||||
|
||||
public Set<BiomeItem> getBiomes() {
|
||||
return biomes;
|
||||
}
|
||||
private void registerBiomes() {
|
||||
|
||||
FileConfiguration config = ConfigUtils.getConfig(plugin, "biomes");
|
||||
plugin.getDebugger().debug("Registering biomes!");
|
||||
int i = 0;
|
||||
for (String biome : config.getKeys(false)) {
|
||||
|
||||
if (i >= 52) {
|
||||
|
||||
plugin.getDebugger().debug("There are too many biomes to register! Menu can't hold any more!");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
java.util.List<String> lore = config.getStringList(biome + ".lore");
|
||||
lore.replaceAll(line -> new MessageBuilder(line).build());
|
||||
BiomeItem biomeItem = new BiomeItem(
|
||||
new ItemBuilder(XMaterial
|
||||
.matchXMaterial(config.getString(biome + ".material-name", "bedrock").toUpperCase())
|
||||
.orElse(XMaterial.BEDROCK).parseItem())
|
||||
.name(new MessageBuilder(config.getString(biome + ".displayname")).build()).lore(lore)
|
||||
.build(),
|
||||
config.getString(biome + ".permission"), XBiome.of(biome).orElse(XBiome.BADLANDS));
|
||||
biomes.add(biomeItem);
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
plugin.getDebugger().debug("Registered in total " + i + " biomes!");
|
||||
|
||||
}
|
||||
|
||||
public Set<BiomeItem> getBiomes() {
|
||||
|
||||
return biomes;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+33
-21
@@ -27,32 +27,44 @@ import org.bukkit.inventory.ItemStack;
|
||||
*/
|
||||
public class ParticleItem {
|
||||
|
||||
private ItemStack itemStack;
|
||||
private String effect;
|
||||
private String permission;
|
||||
private ItemStack itemStack;
|
||||
private String effect;
|
||||
private String permission;
|
||||
|
||||
public String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
public String getPermission() {
|
||||
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
return permission;
|
||||
|
||||
public String getEffect() {
|
||||
return effect;
|
||||
}
|
||||
}
|
||||
|
||||
public void setEffect(String effect) {
|
||||
this.effect = effect;
|
||||
}
|
||||
public void setPermission(String permission) {
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
this.permission = permission;
|
||||
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
public String getEffect() {
|
||||
|
||||
return effect;
|
||||
|
||||
}
|
||||
|
||||
public void setEffect(String effect) {
|
||||
|
||||
this.effect = effect;
|
||||
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
|
||||
return itemStack;
|
||||
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
|
||||
this.itemStack = itemStack;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+53
-30
@@ -27,7 +27,6 @@ import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.PluginMain;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -38,41 +37,65 @@ import java.util.Map.Entry;
|
||||
*/
|
||||
public class ParticleRefreshScheduler {
|
||||
|
||||
private BukkitTask task;
|
||||
private BukkitTask task;
|
||||
|
||||
public ParticleRefreshScheduler(PluginMain plugin) {
|
||||
int particleRefreshTick = plugin.getConfig().getInt("Particle.Refresh-Rate", 10);
|
||||
public ParticleRefreshScheduler(PluginMain plugin) {
|
||||
|
||||
if(particleRefreshTick < 0) {
|
||||
particleRefreshTick = 20;
|
||||
}
|
||||
int particleRefreshTick = plugin.getConfig().getInt("Particle.Refresh-Rate", 10);
|
||||
|
||||
int amountParticle = plugin.getConfig().getInt("Particle.Effects", 20);
|
||||
if (particleRefreshTick < 0) {
|
||||
|
||||
if(amountParticle < 0) {
|
||||
amountParticle = 20;
|
||||
}
|
||||
particleRefreshTick = 20;
|
||||
|
||||
final int particleAmount = amountParticle;
|
||||
|
||||
task = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(arena instanceof BaseArena && !arena.getPlayers().isEmpty()) {
|
||||
for(Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
if(!buildPlot.getMembers().isEmpty()) {
|
||||
for(Entry<Location, String> map : buildPlot.getParticles().entrySet()) {
|
||||
VersionUtils.sendParticles(map.getValue(), new HashSet<>(buildPlot.getMembers()), map.getKey(), particleAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0, particleRefreshTick);
|
||||
}
|
||||
|
||||
public void cancelTask() {
|
||||
if(task != null) {
|
||||
task.cancel();
|
||||
int amountParticle = plugin.getConfig().getInt("Particle.Effects", 20);
|
||||
|
||||
if (amountParticle < 0) {
|
||||
|
||||
amountParticle = 20;
|
||||
|
||||
}
|
||||
|
||||
final int particleAmount = amountParticle;
|
||||
|
||||
task = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
|
||||
|
||||
for (IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
|
||||
if (arena instanceof BaseArena && !arena.getPlayers().isEmpty()) {
|
||||
|
||||
for (Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
|
||||
if (!buildPlot.getMembers().isEmpty()) {
|
||||
|
||||
for (Entry<Location, String> map : buildPlot.getParticles().entrySet()) {
|
||||
|
||||
VersionUtils.sendParticles(map.getValue(), new HashSet<>(buildPlot.getMembers()),
|
||||
map.getKey(), particleAmount);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, 0, particleRefreshTick);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelTask() {
|
||||
|
||||
if (task != null) {
|
||||
|
||||
task.cancel();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+199
-136
@@ -40,169 +40,232 @@ import plugily.projects.minigamesbox.inventory.utils.fastinv.PaginatedFastInv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
* <p>
|
||||
* Created at 23.12.2018
|
||||
*/
|
||||
public class ParticleRegistry {
|
||||
|
||||
private PaginatedFastInv particles;
|
||||
private final List<String> blackListedParticles = Arrays.asList("BLOCK_CRACK", "ITEM_CRACK", "ITEM_TAKE", "BLOCK_DUST", "MOB_APPEARANCE", "FOOTSTEP", "REDSTONE");
|
||||
private final Set<ParticleItem> registeredParticles = new HashSet<>();
|
||||
private final Main plugin;
|
||||
private PaginatedFastInv particles;
|
||||
private final List<String> blackListedParticles = Arrays.asList("BLOCK_CRACK", "ITEM_CRACK", "ITEM_TAKE",
|
||||
"BLOCK_DUST", "MOB_APPEARANCE", "FOOTSTEP", "REDSTONE");
|
||||
private final Set<ParticleItem> registeredParticles = new HashSet<>();
|
||||
private final Main plugin;
|
||||
|
||||
public ParticleRegistry(OptionsRegistry registry) {
|
||||
this.plugin = registry.getPlugin();
|
||||
updateParticlesFile();
|
||||
registerParticles();
|
||||
registerInventory();
|
||||
}
|
||||
public ParticleRegistry(OptionsRegistry registry) {
|
||||
|
||||
private void registerParticles() {
|
||||
plugin.getDebugger().debug("Registering particles!");
|
||||
this.plugin = registry.getPlugin();
|
||||
updateParticlesFile();
|
||||
registerParticles();
|
||||
registerInventory();
|
||||
|
||||
FileConfiguration config = ConfigUtils.getConfig(plugin, "particles");
|
||||
int i = 0;
|
||||
|
||||
for(String particle : VersionUtils.PARTICLE_VALUES) {
|
||||
if(i >= 100) {
|
||||
plugin.getDebugger().debug("There are too many particles to register! Menu can't hold any more!");
|
||||
break;
|
||||
}
|
||||
|
||||
if(blackListedParticles.contains(particle) || config.getBoolean(particle + ".disabled", false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<String> lore = config.getStringList(particle + ".lore");
|
||||
lore.replaceAll(line -> new MessageBuilder(line).build());
|
||||
|
||||
ParticleItem particleItem = new ParticleItem();
|
||||
particleItem.setItemStack(new ItemBuilder(XMaterial.matchXMaterial(config
|
||||
.getString(particle + ".material-name", "bedrock").toUpperCase(Locale.ENGLISH)).orElse(XMaterial.PAPER).parseItem())
|
||||
.name(new MessageBuilder(config.getString(particle + ".displayname")).build())
|
||||
.lore(lore)
|
||||
.build());
|
||||
particleItem.setPermission(config.getString(particle + ".permission", ""));
|
||||
particleItem.setEffect(particle);
|
||||
registeredParticles.add(particleItem);
|
||||
i++;
|
||||
}
|
||||
|
||||
plugin.getDebugger().debug("Registered in total " + i + " particles!");
|
||||
}
|
||||
private void registerParticles() {
|
||||
|
||||
private void updateParticlesFile() {
|
||||
FileConfiguration config = ConfigUtils.getConfig(plugin, "particles");
|
||||
for(String particle : VersionUtils.PARTICLE_VALUES) {
|
||||
if(!config.isSet(particle)) {
|
||||
config.set(particle + ".displayname", "&6" + particle);
|
||||
config.set(particle + ".lore", Arrays.asList("&7Click to activate", "&7on your location"));
|
||||
config.set(particle + ".material-name", Material.PAPER.name());
|
||||
config.set(particle + ".permission", "buildbattle.particles");
|
||||
continue;
|
||||
}
|
||||
if(!config.isSet(particle + ".material-name")) {
|
||||
config.set(particle + ".material-name", Material.PAPER.name());
|
||||
plugin.getDebugger().debug("Found outdated item in particles.yml! We've converted it to the newest version!");
|
||||
}
|
||||
}
|
||||
ConfigUtils.saveConfig(plugin, config, "particles");
|
||||
}
|
||||
plugin.getDebugger().debug("Registering particles!");
|
||||
|
||||
private void registerInventory() {
|
||||
PaginatedFastInv gui = new PaginatedFastInv(54, new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_INVENTORY").asKey().build());
|
||||
FileConfiguration config = ConfigUtils.getConfig(plugin, "particles");
|
||||
int i = 0;
|
||||
|
||||
new InventoryScheme()
|
||||
.mask(" 1111111 ")
|
||||
.mask(" 1111111 ")
|
||||
.mask(" 1111111 ")
|
||||
.mask(" 1111111 ")
|
||||
.bindPagination('1').apply(gui);
|
||||
for (String particle : VersionUtils.PARTICLE_VALUES) {
|
||||
|
||||
if (i >= 100) {
|
||||
|
||||
gui.previousPageItem(45, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("<- " + p + "/" + gui.lastPage()).build());
|
||||
gui.nextPageItem(53, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name(p + "/" + gui.lastPage() + " ->").build());
|
||||
plugin.getDebugger().debug("There are too many particles to register! Menu can't hold any more!");
|
||||
break;
|
||||
|
||||
gui.setItem(52, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("X").build(),
|
||||
e -> e.getWhoClicked().closeInventory());
|
||||
}
|
||||
|
||||
gui.setItem(49, new ItemBuilder(new ItemStack(Material.REDSTONE_BLOCK))
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_NAME").asKey().build())
|
||||
.lore(Collections.singletonList(new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_LORE").asKey().build()))
|
||||
.build(), event -> {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
if (blackListedParticles.contains(particle) || config.getBoolean(particle + ".disabled", false)) {
|
||||
|
||||
if(!(humanEntity instanceof Player))
|
||||
return;
|
||||
continue;
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(false);
|
||||
player.closeInventory();
|
||||
ParticleRemoveMenu.openMenu(player, arena.getPlotManager().getPlot(player));
|
||||
});
|
||||
}
|
||||
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 46);
|
||||
List<String> lore = config.getStringList(particle + ".lore");
|
||||
lore.replaceAll(line -> new MessageBuilder(line).build());
|
||||
|
||||
addParticles(gui);
|
||||
ParticleItem particleItem = new ParticleItem();
|
||||
particleItem.setItemStack(new ItemBuilder(XMaterial
|
||||
.matchXMaterial(
|
||||
config.getString(particle + ".material-name", "bedrock").toUpperCase(Locale.ENGLISH))
|
||||
.orElse(XMaterial.PAPER).parseItem())
|
||||
.name(new MessageBuilder(config.getString(particle + ".displayname")).build()).lore(lore).build());
|
||||
particleItem.setPermission(config.getString(particle + ".permission", ""));
|
||||
particleItem.setEffect(particle);
|
||||
registeredParticles.add(particleItem);
|
||||
i++;
|
||||
|
||||
setParticles(gui);
|
||||
}
|
||||
|
||||
private void addParticles(PaginatedFastInv gui) {
|
||||
for(ParticleItem item : registeredParticles) {
|
||||
gui.addContent(item.getItemStack(), event -> {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
|
||||
if(!(humanEntity instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
if(!player.hasPermission(item.getPermission())) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_PARTICLE").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if(plot.getParticles().size() >= plugin.getConfig().getInt("Particle.Max-Amount", 25)) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_LIMIT_PARTICLES").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
plot.getParticles().put(player.getLocation(), item.getEffect());
|
||||
plugin.getUserManager().getUser(player).adjustStatistic("PARTICLES_USED", 1);
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_ADDED").asKey().player(player).sendPlayer();
|
||||
});
|
||||
|
||||
plugin.getDebugger().debug("Registered in total " + i + " particles!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public PaginatedFastInv getParticles() {
|
||||
return particles;
|
||||
}
|
||||
private void updateParticlesFile() {
|
||||
|
||||
public void setParticles(PaginatedFastInv particles) {
|
||||
this.particles = particles;
|
||||
}
|
||||
FileConfiguration config = ConfigUtils.getConfig(plugin, "particles");
|
||||
for (String particle : VersionUtils.PARTICLE_VALUES) {
|
||||
|
||||
if (!config.isSet(particle)) {
|
||||
|
||||
config.set(particle + ".displayname", "&6" + particle);
|
||||
config.set(particle + ".lore", Arrays.asList("&7Click to activate", "&7on your location"));
|
||||
config.set(particle + ".material-name", Material.PAPER.name());
|
||||
config.set(particle + ".permission", "buildbattle.particles");
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (!config.isSet(particle + ".material-name")) {
|
||||
|
||||
config.set(particle + ".material-name", Material.PAPER.name());
|
||||
plugin.getDebugger()
|
||||
.debug("Found outdated item in particles.yml! We've converted it to the newest version!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConfigUtils.saveConfig(plugin, config, "particles");
|
||||
|
||||
}
|
||||
|
||||
private void registerInventory() {
|
||||
|
||||
PaginatedFastInv gui = new PaginatedFastInv(54,
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_INVENTORY").asKey().build());
|
||||
|
||||
new InventoryScheme().mask(" 1111111 ").mask(" 1111111 ").mask(" 1111111 ").mask(" 1111111 ")
|
||||
.bindPagination('1').apply(gui);
|
||||
|
||||
gui.previousPageItem(45,
|
||||
p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("<- " + p + "/" + gui.lastPage()).build());
|
||||
gui.nextPageItem(53,
|
||||
p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name(p + "/" + gui.lastPage() + " ->").build());
|
||||
|
||||
gui.setItem(52, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("X").build(),
|
||||
e -> e.getWhoClicked().closeInventory());
|
||||
|
||||
gui.setItem(49, new ItemBuilder(new ItemStack(Material.REDSTONE_BLOCK))
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_NAME").asKey().build())
|
||||
.lore(Collections.singletonList(
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_ITEM_REMOVE_LORE").asKey().build()))
|
||||
.build(), event ->
|
||||
{
|
||||
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
|
||||
if (!(humanEntity instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if (arena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
event.setCancelled(false);
|
||||
player.closeInventory();
|
||||
ParticleRemoveMenu.openMenu(player, arena.getPlotManager().getPlot(player));
|
||||
|
||||
});
|
||||
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 46);
|
||||
|
||||
addParticles(gui);
|
||||
|
||||
setParticles(gui);
|
||||
|
||||
}
|
||||
|
||||
private void addParticles(PaginatedFastInv gui) {
|
||||
|
||||
for (ParticleItem item : registeredParticles) {
|
||||
|
||||
gui.addContent(item.getItemStack(), event -> {
|
||||
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
|
||||
if (!(humanEntity instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if (arena == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!player.hasPermission(item.getPermission())) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_PARTICLE").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Plot plot = arena.getPlotManager().getPlot(player);
|
||||
if (plot == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (plot.getParticles().size() >= plugin.getConfig().getInt("Particle.Max-Amount", 25)) {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_LIMIT_PARTICLES").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
plot.getParticles().put(player.getLocation(), item.getEffect());
|
||||
plugin.getUserManager().getUser(player).adjustStatistic("PARTICLES_USED", 1);
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_ADDED").asKey().player(player).sendPlayer();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PaginatedFastInv getParticles() {
|
||||
|
||||
return particles;
|
||||
|
||||
}
|
||||
|
||||
public void setParticles(PaginatedFastInv particles) {
|
||||
|
||||
this.particles = particles;
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ParticleItem getItemByEffect(String effect) {
|
||||
|
||||
for (ParticleItem item : registeredParticles) {
|
||||
|
||||
if (item.getEffect().equals(effect)) {
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public Set<ParticleItem> getRegisteredParticles() {
|
||||
|
||||
return registeredParticles;
|
||||
|
||||
@Nullable
|
||||
public ParticleItem getItemByEffect(String effect) {
|
||||
for(ParticleItem item : registeredParticles) {
|
||||
if(item.getEffect().equals(effect)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<ParticleItem> getRegisteredParticles() {
|
||||
return registeredParticles;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 148 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user