mirror of
https://github.com/Plugily-Projects/BuildBattle.git
synced 2026-11-04 16:40:09 -05:00
Compare commits
No files matched your search
+102
-1
@@ -10,6 +10,107 @@ deploy webhooks to print changelog successfully
|
||||
|
||||
That's all, matcher will stop when detects next line started with `###` match
|
||||
|
||||
### 5.1.2 Release
|
||||
* Fixed InventoryView not interface on getGui @VoteMenu
|
||||
* Fixed Method 'org.bukkit.block.banner.PatternType[] org.bukkit.block.banner.PatternType.values()' must be Methodref constant
|
||||
* Fixed InventoryView not interface onItemMove
|
||||
* Fixed vehicle moving outside of arena plots and other worlds
|
||||
|
||||
### 5.1.1 Release
|
||||
* Fixed liquid flow outside plots and different worlds
|
||||
* Fixed forceplay console command without theme
|
||||
|
||||
### 5.1.0 Release (10.07.2025)
|
||||
* Added Heads from HeadDatabase (selected on each server start 200 per category)
|
||||
* Added Heads Search function
|
||||
* Added paginated Heads menu to support more than one site of heads
|
||||
* Added onVoteInventoryInteractEvent to block movement of items while plot voting stage
|
||||
* Added a lot of new default themes at themes.yml (+140)
|
||||
* Added possibility to add same meaning words for gtb themes by using ", " in themes.yml
|
||||
* Added /bba settheme <arena> <theme> for Console use
|
||||
* Added /bba forceplay <arena> <theme> which moves all online players into arena and sets the theme
|
||||
* Fixed Floor NPC spawns on any actions
|
||||
* Fixed NPE if OptionsMenu Particles are opened as none builder whileas in gtb
|
||||
* Fixed on first time setup without restart the NPE getArenaInGameState is null
|
||||
* Fixed ItemFrames and Paintings were not able to be removed by player on plot
|
||||
* Fixed plot distribution on plot selection on a solo game could cause to set multiple players on the same plot
|
||||
* Fixed resetPlayerWeather did not change the weather
|
||||
* Fixed none builder Players of GTB didn't got the builder set weather and time
|
||||
* Fixed Time.Changed message did not translate placeholder into language.yml content
|
||||
* Fixed on Plotreset time did not update to world time
|
||||
* Fixed Player Outside Plot interaction with blocks were possible
|
||||
* Fixed NPE AddGoBackButton
|
||||
* Fixed Water Flow on Ground
|
||||
* Fixed Vehicles such as Boats could drive outside plot
|
||||
* Fixed Flower Pots couldn't be destroyed on plot
|
||||
* Fixed placeholder on message Changed-Theme
|
||||
* Fixed sendBuildLeftTimeMessage is not handled by MessageBuilder correctly
|
||||
* Changed Allow Plot selection also if ArenaState is FULL_GAME
|
||||
* Changed (for API usage) renamed BBTheme to GuessTheme
|
||||
* Changed Hide guessing players from builder in gtb mode
|
||||
* Changed LanguageMigrator on plugin level to update file versions
|
||||
* Updated Minigamesbox to 1.4.2
|
||||
|
||||
### 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
|
||||
@@ -621,4 +722,4 @@ it will have BEDROCK value if absent
|
||||
|
||||
### 3.0.0 Release (14.05.2018 - 01.06.2018)
|
||||
|
||||
* Add everything here
|
||||
* Add everything here
|
||||
+10
-4
@@ -1,11 +1,11 @@
|
||||

|
||||
|
||||
# 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)
|
||||
# Build Battle / Guess The Build [](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,
|
||||
BuildBattle / Guess The Build 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?
|
||||
There are different modes such as the classic BuildBattle and the guess mode called Guess The Build. On the classic version the goal is to build the best you can on your own as solo or as team with unlimited team sizes! You must compete with other players in this building game. Who will be the best? On the guess mode you have to build whileas the other players are guessing the correct word according to your building which grants points to the players. The player with the most points (best guesses) wins.
|
||||
Have fun using it! Leave a good rating if you really like it.
|
||||
|
||||
## Want to contribute in this project?
|
||||
@@ -31,7 +31,13 @@ Have fun using it! Leave a good rating if you really like it.
|
||||
|
||||
<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.
|
||||
Thanks to Code Whale for Open Source license for POEditor project, so we are able to have locales.
|
||||
|
||||
#### Minecraft Heads
|
||||
|
||||
[](https://minecraft-heads.com/)
|
||||
|
||||
Thanks to Minecraft Heads to let us use the Name and Textures of the heads to provide you a better heads experience ingame.
|
||||
|
||||
## Contributors
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* BuildBattle - Ultimate building competition minigame
|
||||
@@ -21,7 +22,7 @@
|
||||
plugins {
|
||||
id("signing")
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||
id ("com.gradleup.shadow") version "9.0.0-beta5"
|
||||
java
|
||||
}
|
||||
|
||||
@@ -30,7 +31,10 @@ repositories {
|
||||
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(uri("https://papermc.io/repo/repository/maven-public/"))
|
||||
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/"))
|
||||
@@ -38,14 +42,14 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("plugily.projects:MiniGamesBox-Classic:1.3.5") { isTransitive = false }
|
||||
compileOnly("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT")
|
||||
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.3"
|
||||
version = "5.0.13-SNAPSHOT4"
|
||||
description = "BuildBattle"
|
||||
|
||||
java {
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,206 @@
|
||||
<?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>
|
||||
File renamed without changes.
@@ -9,12 +9,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v3
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
uses: actions/checkout@v4.2.2
|
||||
- name: Bump Version
|
||||
id: bump
|
||||
uses: Plugily-Projects/version-bump-action@v8
|
||||
uses: Plugily-Projects/version-bump-action@v10
|
||||
with:
|
||||
github-token: ${{ secrets.github_token }}
|
||||
auto-version-bump: true
|
||||
@@ -25,19 +23,32 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
ref: 'development'
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4.6.0
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
java-version: '21'
|
||||
java-package: jdk
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Publish with Gradle
|
||||
run: ./gradlew publishMavenPublicationToSnapshotsRepository
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ secrets.SNAPSHOTSUSERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.SNAPSHOTSPASSWORD }}
|
||||
- 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
|
||||
@@ -11,12 +11,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v3
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
uses: actions/checkout@v4.2.2
|
||||
- name: Bump Version
|
||||
id: bump
|
||||
uses: Plugily-Projects/version-bump-action@v8
|
||||
uses: Plugily-Projects/version-bump-action@v10
|
||||
with:
|
||||
github-token: ${{ secrets.github_token }}
|
||||
auto-version-bump: false
|
||||
@@ -28,19 +26,32 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Latest Commit
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
ref: 'master'
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4.6.0
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
java-version: '21'
|
||||
java-package: jdk
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Publish with Gradle
|
||||
run: ./gradlew publishMavenPublicationToReleasesRepository
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ secrets.RELEASESUSERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.RELEASESPASSWORD }}
|
||||
- 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
|
||||
+2
-21
@@ -1,26 +1,7 @@
|
||||
#
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
#
|
||||
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,214 @@
|
||||
<?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.1.2</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>
|
||||
<!--
|
||||
Needed for HeadDatabase Conversion of JSON to YML
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.9</version>
|
||||
</dependency>
|
||||
-->
|
||||
<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.3</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>
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>buildbattle</artifactId>
|
||||
<version>5.0.0</version>
|
||||
<version>5.0.13-SNAPSHOT4</version>
|
||||
<name>BuildBattle</name>
|
||||
|
||||
<properties>
|
||||
@@ -37,7 +37,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plugilyprojects</id>
|
||||
@@ -69,7 +69,7 @@
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.19.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
|
||||
@@ -82,7 +82,7 @@
|
||||
<dependency>
|
||||
<groupId>plugily.projects</groupId>
|
||||
<artifactId>MiniGamesBox-Classic</artifactId>
|
||||
<version>1.2.0-SNAPSHOT51</version>
|
||||
<version>1.3.17-SNAPSHOT10</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
@@ -108,41 +108,51 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<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.4.0</version>
|
||||
<version>3.11.2</version>
|
||||
<configuration>
|
||||
<destDir>minecraft/buildbattle</destDir>
|
||||
<isOffline>false</isOffline>
|
||||
<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.2.2</version>
|
||||
<version>3.4.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@@ -159,10 +169,6 @@
|
||||
<pattern>plugily.projects.minigamesbox</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.minigamesbox</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>plugily.projects.commonsbox</pattern>
|
||||
<shadedPattern>plugily.projects.buildbattle.commonsbox</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
@@ -185,14 +191,18 @@
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>3.5.2</version>
|
||||
<version>3.5.3</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>plugily-projects</id>
|
||||
<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>
|
||||
</project>
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
package plugily.projects.buildbattle;
|
||||
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import plugily.projects.buildbattle.arena.ArenaEvents;
|
||||
import plugily.projects.buildbattle.arena.ArenaManager;
|
||||
@@ -34,8 +32,10 @@ import plugily.projects.buildbattle.boot.AdditionalValueInitializer;
|
||||
import plugily.projects.buildbattle.boot.MessageInitializer;
|
||||
import plugily.projects.buildbattle.boot.PlaceholderInitializer;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.buildbattle.handlers.LanguageMigrator;
|
||||
import plugily.projects.buildbattle.handlers.menu.OptionsRegistry;
|
||||
import plugily.projects.buildbattle.handlers.misc.BlacklistManager;
|
||||
import plugily.projects.buildbattle.handlers.misc.HeadDatabaseManager;
|
||||
import plugily.projects.buildbattle.handlers.setup.SetupCategoryManager;
|
||||
import plugily.projects.buildbattle.handlers.themes.ThemeManager;
|
||||
import plugily.projects.minigamesbox.classic.PluginMain;
|
||||
@@ -43,8 +43,6 @@ 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;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by Tom on 17/08/2015.
|
||||
* Updated by Tigerpanzer_02 on 03.12.2021
|
||||
@@ -52,6 +50,7 @@ import java.io.File;
|
||||
public class Main extends PluginMain {
|
||||
|
||||
private VoteItems voteItems;
|
||||
private HeadDatabaseManager headDatabaseManager;
|
||||
private ThemeManager themeManager;
|
||||
private BlacklistManager blacklistManager;
|
||||
private OptionsRegistry optionsRegistry;
|
||||
@@ -66,14 +65,10 @@ public class Main extends PluginMain {
|
||||
super();
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
protected Main(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
|
||||
super(loader, description, dataFolder, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
long start = System.currentTimeMillis();
|
||||
new LanguageMigrator(this);
|
||||
MessageInitializer messageInitializer = new MessageInitializer(this);
|
||||
super.onEnable();
|
||||
getDebugger().debug("[System] [Plugin] Initialization start");
|
||||
@@ -90,6 +85,7 @@ public class Main extends PluginMain {
|
||||
addFileName("themes");
|
||||
addFileName("vote_items");
|
||||
blacklistManager = new BlacklistManager(this);
|
||||
headDatabaseManager = new HeadDatabaseManager(this);
|
||||
themeManager = new ThemeManager(this);
|
||||
BaseArena.init(this);
|
||||
new ArenaEvents(this);
|
||||
@@ -120,6 +116,10 @@ public class Main extends PluginMain {
|
||||
return voteItems;
|
||||
}
|
||||
|
||||
public HeadDatabaseManager getHeadDatabaseManager() {
|
||||
return headDatabaseManager;
|
||||
}
|
||||
|
||||
public ThemeManager getThemeManager() {
|
||||
return themeManager;
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,8 +22,8 @@ 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.minigamesbox.classic.api.event.PlugilyEvent;
|
||||
import plugily.projects.buildbattle.handlers.themes.GuessTheme;
|
||||
import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,9 +35,9 @@ import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
|
||||
public class PlayerThemeGuessEvent extends PlugilyEvent {
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final BBTheme theme;
|
||||
private final GuessTheme theme;
|
||||
|
||||
public PlayerThemeGuessEvent(GuessArena eventArena, BBTheme theme) {
|
||||
public PlayerThemeGuessEvent(GuessArena eventArena, GuessTheme theme) {
|
||||
super(eventArena);
|
||||
this.theme = theme;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class PlayerThemeGuessEvent extends PlugilyEvent {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
public BBTheme getTheme() {
|
||||
public GuessTheme getTheme() {
|
||||
return theme;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
|
||||
import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
|
||||
public class PlotPlayerChooseEvent extends PlugilyEvent implements Cancellable {
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ package plugily.projects.buildbattle.api.event.plot;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
|
||||
import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
|
||||
@@ -23,7 +23,7 @@ package plugily.projects.buildbattle.api.event.plot;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
|
||||
import plugily.projects.minigamesbox.api.events.PlugilyEvent;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
|
||||
@@ -31,8 +31,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryCreativeEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
@@ -43,8 +44,8 @@ import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArenaEvents;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.ServerVersion;
|
||||
@@ -52,7 +53,9 @@ import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerInteractEntityEvent;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerInteractEvent;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerPickupArrow;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XEntityType;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.inventory.XInventoryView;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
@@ -74,7 +77,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaState() != ArenaState.IN_GAME || (arena instanceof BuildArena && arena.getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING)
|
||||
if(arena.getArenaState() != IArenaState.IN_GAME || (arena instanceof BuildArena && arena.getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING)
|
||||
|| plugin.getBlacklistManager().getItemList().contains(event.getBlock().getType())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -84,18 +87,60 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
|
||||
if(buildPlot != null && buildPlot.getCuboid() != null && buildPlot.getCuboid().isIn(event.getBlock().getLocation())) {
|
||||
plugin.getUserManager().getUser(event.getPlayer()).adjustStatistic("BLOCKS_BROKEN", 1);
|
||||
if(event.isDropItems()) {
|
||||
event.getBlock().getDrops().clear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onOutSidePlotInteract(PlugilyPlayerInteractEvent event) {
|
||||
if(event.getClickedBlock() == null) {
|
||||
return;
|
||||
}
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
Plot buildPlot = arena.getPlotManager().getPlot(event.getPlayer());
|
||||
if(buildPlot != null && buildPlot.getCuboid() != null && !buildPlot.getCuboid().isInWithMarge(event.getClickedBlock().getLocation(), 2)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
if(!plugin.getArenaRegistry().getArenaWorlds().contains(event.getLocation().getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getArenaRegistry().getArenas().forEach(arena -> {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
return;
|
||||
}
|
||||
if(((BaseArena) arena).getArenaInGameState() != BaseArena.ArenaInGameState.BUILD_TIME || plugin.getBlacklistManager().getItemList().contains(event.getEntity().getItemStack().getType())) {
|
||||
return;
|
||||
}
|
||||
for(Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
if(buildPlot.getCuboid() != null && buildPlot.getCuboid().isInWithMarge(event.getLocation(), 1)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlace(BlockPlaceEvent event) {
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaState() != ArenaState.IN_GAME || plugin.getBlacklistManager().getItemList().contains(event.getBlock().getType())
|
||||
if(arena.getArenaState() != IArenaState.IN_GAME || plugin.getBlacklistManager().getItemList().contains(event.getBlock().getType())
|
||||
|| (arena instanceof BuildArena && arena.getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -119,7 +164,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
if(event.getRightClicked().getType() == EntityType.ITEM_FRAME && ((ItemFrame) event.getRightClicked()).getItem().getType() != Material.AIR) {
|
||||
Location entityLocation = event.getRightClicked().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -132,6 +177,49 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onHangingBreakEvent(HangingBreakByEntityEvent event) {
|
||||
if(event.getEntity() instanceof ItemFrame || event.getEntity() instanceof Painting) {
|
||||
if(event.getRemover() instanceof Player && plugin.getArenaRegistry().isInArena((Player) event.getRemover())) {
|
||||
Player player = (Player) event.getRemover();
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if(arena == null) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
Plot buildPlot = arena.getPlotManager().getPlot(player);
|
||||
|
||||
if(buildPlot != null && buildPlot.getCuboid() != null && buildPlot.getCuboid().isIn(event.getEntity().getLocation())) {
|
||||
event.setCancelled(false);
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPaintandFlowerInteraction(PlugilyPlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if(arena == null || event.getClickedBlock() == null) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
Plot buildPlot = arena.getPlotManager().getPlot(player);
|
||||
if(event.getClickedBlock().getType() != XMaterial.PAINTING.parseMaterial() && event.getClickedBlock().getType() != XMaterial.FLOWER_POT.parseMaterial()) {
|
||||
return;
|
||||
}
|
||||
if(buildPlot != null && buildPlot.getCuboid() != null && buildPlot.getCuboid().isIn(event.getClickedBlock().getLocation())) {
|
||||
//need to cancel with highest as minigamescore is blocking it!
|
||||
event.setCancelled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onNPCClick(PlugilyPlayerInteractEntityEvent event) {
|
||||
if(VersionUtils.checkOffHand(event.getHand()) || event.getRightClicked().getType() != EntityType.VILLAGER) {
|
||||
@@ -146,7 +234,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
|
||||
if(arena == null || arena.getArenaState() != ArenaState.IN_GAME) {
|
||||
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -189,7 +277,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
if(playerPlot != null) {
|
||||
|
||||
// Prevent "Legacy material support initialisation"
|
||||
playerPlot.changeFloor(material, ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1) ? hand.getData().getData() : 0);
|
||||
playerPlot.changeFloor(material, ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12) ? hand.getData().getData() : 0);
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_FLOOR_CHANGED").asKey().player(event.getPlayer()).sendPlayer();
|
||||
}
|
||||
}
|
||||
@@ -204,25 +292,27 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
return;
|
||||
}
|
||||
|
||||
if(arena.getArenaState() != ArenaState.IN_GAME || event.getClickedBlock().getType() == XMaterial.ENDER_CHEST.parseMaterial()) {
|
||||
if(event.getClickedBlock().getType() == XMaterial.ENDER_CHEST.parseMaterial()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMinecartMove(VehicleMoveEvent event) {
|
||||
public void onVehicleMove(VehicleMoveEvent event) {
|
||||
Vehicle vehicle = event.getVehicle();
|
||||
if(vehicle.getType() != EntityType.MINECART) {
|
||||
return;
|
||||
}
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
for(Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
if(buildPlot.getCuboid() != null && !buildPlot.getCuboid().isInWithMarge(event.getTo(), -1) && buildPlot.getCuboid().isIn(event.getTo())) {
|
||||
((Minecart) vehicle).setMaxSpeed(0);
|
||||
if(buildPlot.getCuboid() != null && buildPlot.getCuboid().isIn(event.getFrom()) && !buildPlot.getCuboid().isInWithMarge(event.getTo(), 1)) {
|
||||
vehicle.setVelocity(vehicle.getVelocity().zero());
|
||||
if(vehicle.getType() == XEntityType.MINECART.get()) {
|
||||
((Minecart) vehicle).setMaxSpeed(0);
|
||||
} else {
|
||||
vehicle.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,13 +322,14 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
public void onIgniteEvent(BlockIgniteEvent event) {
|
||||
Location blockLocation = event.getBlock().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
for(Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
if(buildPlot.getCuboid() != null && buildPlot.getCuboid().isInWithMarge(blockLocation, 5)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,7 +339,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
public void onPistonRetractEvent(BlockPistonRetractEvent event) {
|
||||
Location blockLocation = event.getBlock().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -256,6 +347,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
for(Block block : event.getBlocks()) {
|
||||
if(buildPlot.getCuboid() != null && !buildPlot.getCuboid().isInWithMarge(block.getLocation(), -1) && buildPlot.getCuboid().isIn(blockLocation)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,7 +358,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
Location blockLocation = event.getBlock().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -301,7 +393,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
int maxMobPerPlot = plugin.getConfig().getInt("Mob.Max-Amount", 20);
|
||||
Location entityLoc = event.getEntity().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -317,13 +409,13 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(event.getEntity().getType() == EntityType.WITHER || !plugin.getConfigPreferences().getOption("MOB_SPAWN")) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for(Plot plot : baseArena.getPlotManager().getPlots()) {
|
||||
if(plot.getCuboid() != null && plot.getCuboid().isInWithMarge(entityLoc, 1)) {
|
||||
if(!plugin.getConfigPreferences().getOption("MOB_SPAWN")) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(plot.getEntities() >= maxMobPerPlot) {
|
||||
plot.getMembers().forEach(player -> new MessageBuilder("IN_GAME_MESSAGES_PLOT_LIMIT_ENTITIES").asKey().arena(arena).player(player).sendPlayer());
|
||||
event.setCancelled(true);
|
||||
@@ -340,7 +432,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
plot.addEntity();
|
||||
event.setCancelled(false);
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_9_R1)) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_9)) {
|
||||
event.getEntity().setAI(false);
|
||||
}
|
||||
}
|
||||
@@ -353,7 +445,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
if(event.getSource().getType() != Material.FIRE)
|
||||
return;
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -373,7 +465,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
public void onDispense(BlockDispenseEvent event) {
|
||||
Location blockLoc = event.getBlock().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -409,22 +501,20 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
return;
|
||||
}
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena((Player) event.getEntity());
|
||||
if(arena == null || arena.getArenaState() != ArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
if(event.getEntity().getType() != EntityType.PLAYER) {
|
||||
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onDamage(EntityDamageEvent event) {
|
||||
if(event.getEntity().getType() != EntityType.PLAYER) {
|
||||
return;
|
||||
}
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena((Player) event.getEntity());
|
||||
if(arena == null || arena.getArenaState() != ArenaState.IN_GAME) {
|
||||
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@@ -455,7 +545,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
public void onTNTExplode(EntityExplodeEvent event) {
|
||||
Location entityLocation = event.getEntity().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -469,15 +559,48 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWaterFlowEvent(BlockFromToEvent event) {
|
||||
Location toBlock = event.getToBlock().getLocation();
|
||||
Location blockLoc = event.getBlock().getLocation();
|
||||
public void onOtherBlockExplode(BlockExplodeEvent event) {
|
||||
Location blockLocation = event.getBlock().getLocation();
|
||||
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
for(Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
if(buildPlot.getCuboid() != null && buildPlot.getCuboid().isInWithMarge(blockLocation, 5)) {
|
||||
event.blockList().clear();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEnderpearlThrow(ProjectileLaunchEvent event) {
|
||||
if(event.getEntity().getShooter() instanceof Player) {
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena((Player) event.getEntity().getShooter());
|
||||
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
if(event.getEntity() instanceof EnderPearl) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWaterFlowEvent(BlockFromToEvent event) {
|
||||
Location toBlock = event.getToBlock().getLocation();
|
||||
Location blockLoc = event.getBlock().getLocation();
|
||||
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
for(Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
if(buildPlot.getTeleportLocation().getWorld() != toBlock.getWorld()) {
|
||||
continue;
|
||||
}
|
||||
if(buildPlot.getCuboid() != null) {
|
||||
if(!buildPlot.getCuboid().isIn(toBlock) && buildPlot.getCuboid().isIn(blockLoc)) {
|
||||
event.setCancelled(true);
|
||||
@@ -507,7 +630,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
@EventHandler
|
||||
public void onPistonExtendEvent(BlockPistonExtendEvent event) {
|
||||
Location blockLoc = event.getBlock().getLocation();
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(!(arena instanceof BaseArena)) {
|
||||
continue;
|
||||
}
|
||||
@@ -532,15 +655,6 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
Player player = (Player) event.getPlayer();
|
||||
BaseArena baseArena = plugin.getArenaRegistry().getArena(player);
|
||||
if(baseArena != null && baseArena.getArenaInGameState() == BaseArena.ArenaInGameState.BUILD_TIME) {
|
||||
baseArena.addMenuItem(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemMove(InventoryClickEvent event) {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
@@ -548,10 +662,10 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
if(humanEntity instanceof Player) {
|
||||
BaseArena baseArena = plugin.getArenaRegistry().getArena((Player) humanEntity);
|
||||
|
||||
if(baseArena != null && baseArena.getArenaState() != ArenaState.IN_GAME) {
|
||||
if(baseArena != null && baseArena.getArenaState() != IArenaState.IN_GAME) {
|
||||
if(event.getClickedInventory() == humanEntity.getInventory()) {
|
||||
if(event.getView().getType() == InventoryType.CRAFTING
|
||||
|| event.getView().getType() == InventoryType.PLAYER) {
|
||||
if(XInventoryView.of(event.getView()).getType() == InventoryType.CRAFTING
|
||||
|| XInventoryView.of(event.getView()).getType() == InventoryType.PLAYER) {
|
||||
event.setResult(Event.Result.DENY);
|
||||
}
|
||||
}
|
||||
@@ -566,7 +680,10 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
if(!(arena instanceof GuessArena)) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaState() != ArenaState.IN_GAME) {
|
||||
if(arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaInGameState() != BaseArena.ArenaInGameState.BUILD_TIME) {
|
||||
return;
|
||||
}
|
||||
if(arena.getSpectators().contains(player)) {
|
||||
@@ -583,7 +700,7 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_GUESS_BUILDER").asKey().arena(gameArena).player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
if(gameArena.getCurrentBBTheme() == null || !gameArena.getCurrentBBTheme().getTheme().equalsIgnoreCase(event.getMessage())) {
|
||||
if(gameArena.getCurrentBBTheme() == null || gameArena.getCurrentBBTheme().getThemes().stream().noneMatch(theme -> theme.equalsIgnoreCase(event.getMessage()))) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@@ -601,4 +718,23 @@ public class ArenaEvents extends PluginArenaEvents {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVoteInventoryInteractEvent(InventoryCreativeEvent event) {
|
||||
if(!(event.getWhoClicked() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(player);
|
||||
if(!(arena instanceof BuildArena)) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
return;
|
||||
}
|
||||
if(arena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,9 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
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;
|
||||
@@ -45,7 +47,7 @@ public class ArenaManager extends PluginArenaManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void additionalPartyJoin(Player player, PluginArena arena, Player partyLeader) {
|
||||
public void additionalPartyJoin(Player player, IPluginArena arena, Player partyLeader) {
|
||||
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return;
|
||||
@@ -54,7 +56,7 @@ public class ArenaManager extends PluginArenaManager {
|
||||
List<Plot> plots = pluginArena.getPlotManager().getPlots();
|
||||
Plot partyPlot = plots.get(plots.size() == 1 ? 0 : plugin.getRandom().nextInt(plots.size()));
|
||||
|
||||
if(arena.getPlayers().contains(partyLeader)) {
|
||||
if(arena.getPlayersLeft().contains(partyLeader)) {
|
||||
Plot partyLeaderPlot = pluginArena.getPlotManager().getPlot(partyLeader);
|
||||
if(partyLeaderPlot != null) {
|
||||
partyPlot = partyLeaderPlot;
|
||||
@@ -67,13 +69,13 @@ public class ArenaManager extends PluginArenaManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leaveAttempt(@NotNull Player player, @NotNull PluginArena arena) {
|
||||
public void leaveAttempt(@NotNull Player player, @NotNull IPluginArena arena) {
|
||||
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return;
|
||||
}
|
||||
super.leaveAttempt(player, arena);
|
||||
User user = plugin.getUserManager().getUser(player);
|
||||
IUser user = plugin.getUserManager().getUser(player);
|
||||
user.setStatistic("LOCAL_POINTS", 0);
|
||||
user.setStatistic("LOCAL_POINTS_GTB", 0);
|
||||
Plot plot = pluginArena.getPlotManager().getPlot(player);
|
||||
@@ -91,7 +93,7 @@ public class ArenaManager extends PluginArenaManager {
|
||||
((GuessArena) arena).getWhoGuessed().remove(player);
|
||||
if(guessArena.getCurrentBuilders().contains(player)) {
|
||||
if(plot.getMembers().isEmpty()) {
|
||||
if(arena.getArenaState() == ArenaState.IN_GAME) {
|
||||
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);
|
||||
|
||||
@@ -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.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArenaRegistry;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
@@ -118,7 +119,7 @@ public class ArenaRegistry extends PluginArenaRegistry {
|
||||
World minWorld = minPoint.getWorld();
|
||||
|
||||
if(minWorld != null) {
|
||||
Biome biome = ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15_R1) ?
|
||||
Biome biome = ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15) ?
|
||||
minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockY(), minPoint.getBlockZ())
|
||||
: minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockZ());
|
||||
|
||||
@@ -156,7 +157,7 @@ public class ArenaRegistry extends PluginArenaRegistry {
|
||||
|
||||
@Override
|
||||
public @Nullable BaseArena getArena(Player player) {
|
||||
PluginArena pluginArena = super.getArena(player);
|
||||
IPluginArena pluginArena = super.getArena(player);
|
||||
if(pluginArena instanceof BaseArena) {
|
||||
return (BaseArena) pluginArena;
|
||||
}
|
||||
@@ -165,7 +166,7 @@ public class ArenaRegistry extends PluginArenaRegistry {
|
||||
|
||||
@Override
|
||||
public @Nullable BaseArena getArena(String id) {
|
||||
PluginArena pluginArena = super.getArena(id);
|
||||
IPluginArena pluginArena = super.getArena(id);
|
||||
if(pluginArena instanceof BaseArena) {
|
||||
return (BaseArena) pluginArena;
|
||||
}
|
||||
@@ -174,7 +175,7 @@ public class ArenaRegistry extends PluginArenaRegistry {
|
||||
|
||||
public @NotNull List<BaseArena> getPluginArenas() {
|
||||
List<BaseArena> baseArenas = new ArrayList<>(super.getArenas().size());
|
||||
for(PluginArena pluginArena : super.getArenas()) {
|
||||
for(IPluginArena pluginArena : super.getArenas()) {
|
||||
if(pluginArena instanceof BaseArena) {
|
||||
baseArenas.add((BaseArena) pluginArena);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ 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.actionbar.ActionBar;
|
||||
import plugily.projects.minigamesbox.classic.utils.items.HandlerItem;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
|
||||
@@ -53,11 +54,11 @@ public class BaseArena extends PluginArena {
|
||||
private final List<Player> spectators = new ArrayList<>();
|
||||
private MapRestorerManager mapRestorerManager;
|
||||
private final PlotManager plotManager;
|
||||
private String theme = "Theme";
|
||||
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<>();
|
||||
|
||||
@@ -153,17 +154,17 @@ public class BaseArena extends PluginArena {
|
||||
return theme;
|
||||
}
|
||||
|
||||
public void setTheme(String theme) {
|
||||
this.theme = theme == null ? "Theme" : 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();
|
||||
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);
|
||||
}
|
||||
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() {
|
||||
@@ -179,7 +180,8 @@ public class BaseArena extends PluginArena {
|
||||
|
||||
if(this instanceof BuildArena) {
|
||||
buildPlot = getPlotFromPlayer(player);
|
||||
} else if(this instanceof GuessArena && (buildPlot = getPlotFromPlayer(player)) != null) {
|
||||
} else if(this instanceof GuessArena) {
|
||||
buildPlot = ((GuessArena) this).getBuildPlot();
|
||||
player.setPlayerWeather(buildPlot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(buildPlot.getTime(), player.getWorld().getTime()), false);
|
||||
}
|
||||
@@ -217,33 +219,6 @@ public class BaseArena extends PluginArena {
|
||||
}
|
||||
}
|
||||
|
||||
HandlerItem optionsMenuItem;
|
||||
|
||||
private HandlerItem getMenuItem() {
|
||||
if(optionsMenuItem == null) {
|
||||
HandlerItem optionsMenu = new HandlerItem(getPlugin().getOptionsRegistry().getMenuItem());
|
||||
optionsMenu.setLeftClick(true);
|
||||
optionsMenu.setRightClick(true);
|
||||
optionsMenu.addInteractHandler(event -> {
|
||||
event.setCancelled(true);
|
||||
getPlugin().getOptionsRegistry().getOptionsGui().open(event.getPlayer());
|
||||
});
|
||||
optionsMenu.addInventoryClickHandler(event -> {
|
||||
getPlugin().getOptionsRegistry().getOptionsGui().open(event.getWhoClicked());
|
||||
});
|
||||
optionsMenuItem = optionsMenu.build();
|
||||
}
|
||||
return optionsMenuItem;
|
||||
}
|
||||
|
||||
public void addMenuItem(Player player) {
|
||||
if(player.getInventory().contains(getMenuItem().getItemStack())) {
|
||||
return;
|
||||
}
|
||||
player.getInventory().setItem(8, getMenuItem().getItemStack());
|
||||
}
|
||||
|
||||
|
||||
public PlotManager getPlotManager() {
|
||||
return plotManager;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,10 @@ import plugily.projects.buildbattle.arena.states.build.InGameState;
|
||||
import plugily.projects.buildbattle.arena.states.build.StartingState;
|
||||
import plugily.projects.buildbattle.handlers.themes.vote.VoteMenu;
|
||||
import plugily.projects.buildbattle.handlers.themes.vote.VotePoll;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
@@ -44,8 +45,8 @@ public class BuildArena extends BaseArena {
|
||||
public BuildArena(String id) {
|
||||
super(id);
|
||||
setArenaType(ArenaType.SOLO);
|
||||
addGameStateHandler(ArenaState.IN_GAME, new InGameState());
|
||||
addGameStateHandler(ArenaState.STARTING, new StartingState());
|
||||
addGameStateHandler(IArenaState.IN_GAME, new InGameState());
|
||||
addGameStateHandler(IArenaState.STARTING, new StartingState());
|
||||
getPlugin().getDebugger().debug("Init Arena {0} with ArenaType {1}", getId(), getArenaType());
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ public class BuildArena extends BaseArena {
|
||||
|
||||
@Override
|
||||
public void distributePlots() {
|
||||
int neededPlots = getPlayers().size() / getArenaOption("PLOT_MEMBER_SIZE");
|
||||
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");
|
||||
@@ -104,30 +105,36 @@ public class BuildArena extends BaseArena {
|
||||
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:
|
||||
for(Player player : getPlayers()) {
|
||||
// get base with min players
|
||||
Plot minPlayers = getPlotManager().getPlots().stream().min(Comparator.comparing(Plot::getMembersSize)).get();
|
||||
// add player to min base if he got no base
|
||||
Plot playerPlot = getPlotManager().getPlot(player);
|
||||
if(playerPlot == null) {
|
||||
minPlayers.addMember(player, this, true);
|
||||
}
|
||||
// fallback
|
||||
if(playerPlot == null) {
|
||||
getPlotManager().getPlots().get(0).addMember(player, this, true);
|
||||
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() == getPlayers().size()) {
|
||||
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);
|
||||
@@ -149,14 +156,14 @@ public class BuildArena extends BaseArena {
|
||||
|
||||
@Override
|
||||
public boolean enoughPlayersToContinue() {
|
||||
int size = getPlayers().size();
|
||||
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(getPlayers());
|
||||
return !new HashSet<>(getPlotManager().getPlot(getPlayersLeft().get(0)).getMembers()).containsAll(getPlayersLeft());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ 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.minigamesbox.classic.arena.ArenaState;
|
||||
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;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class GuessArena extends BaseArena {
|
||||
|
||||
private final List<Player> whoGuessed = new ArrayList<>();
|
||||
private int round = 1;
|
||||
private BBTheme currentTheme = null;
|
||||
private GuessTheme currentTheme = null;
|
||||
|
||||
private Plot buildPlot = null;
|
||||
private List<Integer> removedCharsAt = new ArrayList<>();
|
||||
@@ -60,25 +60,24 @@ public class GuessArena extends BaseArena {
|
||||
public GuessArena(String id) {
|
||||
super(id);
|
||||
setArenaType(ArenaType.GUESS_THE_BUILD);
|
||||
addGameStateHandler(ArenaState.IN_GAME, new InGameState());
|
||||
addGameStateHandler(ArenaState.STARTING, new StartingState());
|
||||
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() {
|
||||
currentTheme = null;
|
||||
resetBuildPlot();
|
||||
round = 1;
|
||||
whoGuessed.clear();
|
||||
removedCharsAt.clear();
|
||||
playedPlots.clear();
|
||||
playedThemes.clear();
|
||||
super.cleanUpArena();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distributePlots() {
|
||||
int neededPlots = getPlayers().size() / plotMemberSize;
|
||||
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");
|
||||
@@ -91,6 +90,9 @@ public class GuessArena extends BaseArena {
|
||||
if(players.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
if(!plot.getMembers().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if(!getPlugin().getUserManager().getUser(players.get(0)).isSpectator()) {
|
||||
plot.addMember(players.remove(0), this, true);
|
||||
}
|
||||
@@ -109,13 +111,13 @@ public class GuessArena extends BaseArena {
|
||||
|
||||
@Override
|
||||
public boolean enoughPlayersToContinue() {
|
||||
int size = getPlayers().size();
|
||||
int size = getPlayersLeft().size();
|
||||
|
||||
if(size > plotMemberSize) {
|
||||
return true;
|
||||
}
|
||||
if(size == plotMemberSize) {
|
||||
return !new HashSet<>(getPlotManager().getPlot(getPlayersLeft().get(0)).getMembers()).containsAll(getPlayers());
|
||||
return !new HashSet<>(getPlotManager().getPlot(getPlayersLeft().get(0)).getMembers()).containsAll(getPlayersLeft());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -138,10 +140,10 @@ public class GuessArena extends BaseArena {
|
||||
if(buildPlot != null) {
|
||||
buildPlot.resetPlot();
|
||||
}
|
||||
getRemovedCharsAt().clear();
|
||||
removedCharsAt.clear();
|
||||
setBuildPlot(null);
|
||||
setCurrentTheme(null);
|
||||
getWhoGuessed().clear();
|
||||
whoGuessed.clear();
|
||||
round += 1;
|
||||
getPlayers().forEach(player -> getPlugin().getActionBarManager().clearActionBarsFromPlayer(player));
|
||||
}
|
||||
@@ -183,7 +185,7 @@ public class GuessArena extends BaseArena {
|
||||
}
|
||||
|
||||
//-1 because builder can´t guess
|
||||
if(whoGuessed.size() >= getPlayers().size() - 1) {
|
||||
if(whoGuessed.size() >= getPlayersLeft().size() - 1) {
|
||||
setTimer(getPlugin().getConfig().getInt("Time-Manager." + getArenaType().getPrefix() + ".Round-Delay"));
|
||||
setArenaInGameState(ArenaInGameState.PLOT_VOTING);
|
||||
|
||||
@@ -205,7 +207,7 @@ public class GuessArena extends BaseArena {
|
||||
Bukkit.getScheduler().runTask(getPlugin(), () -> Bukkit.getPluginManager().callEvent(new PlayerThemeGuessEvent(this, currentTheme)));
|
||||
}
|
||||
|
||||
public BBTheme getCurrentBBTheme() {
|
||||
public GuessTheme getCurrentBBTheme() {
|
||||
return currentTheme;
|
||||
}
|
||||
|
||||
@@ -237,11 +239,11 @@ public class GuessArena extends BaseArena {
|
||||
return round;
|
||||
}
|
||||
|
||||
public void setCurrentTheme(BBTheme currentTheme) {
|
||||
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.getTheme(), currentTheme.getDifficulty());
|
||||
getPlugin().getDebugger().debug("Arena {0} set Theme to {1} ({2})", getId(), currentTheme.getThemesAsString(), currentTheme.getDifficulty());
|
||||
}
|
||||
this.currentTheme = currentTheme;
|
||||
}
|
||||
|
||||
@@ -23,14 +23,12 @@ package plugily.projects.buildbattle.arena.managers;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.managers.PluginScoreboardManager;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.user.User;
|
||||
import plugily.projects.minigamesbox.classic.utils.scoreboard.common.EntryBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.scoreboard.type.Entry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -47,39 +45,33 @@ public class ScoreboardManager extends PluginScoreboardManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entry> formatScoreboard(User user) {
|
||||
EntryBuilder builder = new EntryBuilder();
|
||||
public List<String> getScoreboardLines(Player player) {
|
||||
List<String> lines;
|
||||
PluginArena userArena = user.getArena();
|
||||
|
||||
if(userArena.getArenaState() == ArenaState.FULL_GAME) {
|
||||
lines = userArena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content.Starting");
|
||||
} else if(userArena.getArenaState() == ArenaState.IN_GAME) {
|
||||
if(userArena instanceof GuessArena) {
|
||||
lines = userArena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + userArena.getArenaState().getFormattedName() + ".Guess-The-Build" + (((GuessArena) userArena).getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING ? "-Waiting" : ""));
|
||||
} else {
|
||||
if(userArena.getArenaOption("PLOT_MEMBER_SIZE") <= 1) {
|
||||
lines = userArena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + userArena.getArenaState().getFormattedName() + ".Classic");
|
||||
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 {
|
||||
lines = userArena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + userArena.getArenaState().getFormattedName() + ".Teams");
|
||||
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;
|
||||
}
|
||||
} else if(userArena.getArenaState() == ArenaState.ENDING) {
|
||||
if(userArena instanceof GuessArena) {
|
||||
lines = userArena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + userArena.getArenaState().getFormattedName() + ".Guess-The-Build");
|
||||
} else {
|
||||
lines = userArena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + userArena.getArenaState().getFormattedName() + ".Classic");
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
lines = userArena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + userArena.getArenaState().getFormattedName());
|
||||
}
|
||||
|
||||
Player player = user.getPlayer();
|
||||
|
||||
for(String line : lines) {
|
||||
builder.next(new MessageBuilder(line).player(player).arena(arena).build());
|
||||
}
|
||||
return builder.build();
|
||||
return lines;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -187,10 +187,11 @@ public class Plot {
|
||||
particles.clear();
|
||||
|
||||
for(Player p : members) {
|
||||
p.resetPlayerWeather();
|
||||
setWeatherType(p.getPlayerWeather());
|
||||
p.setPlayerWeather(WeatherType.CLEAR);
|
||||
p.resetPlayerTime();
|
||||
}
|
||||
setTime(Time.WORLD_TIME);
|
||||
setWeatherType(WeatherType.CLEAR);
|
||||
|
||||
World centerWorld = cuboid.getCenter().getWorld();
|
||||
|
||||
@@ -220,7 +221,7 @@ public class Plot {
|
||||
}
|
||||
|
||||
for(Chunk chunk : cuboid.chunkList()) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15_R1)) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
continue;
|
||||
}
|
||||
@@ -235,7 +236,7 @@ public class Plot {
|
||||
changeFloor(defaultFloor.parseMaterial());
|
||||
|
||||
if(centerWorld != null) {
|
||||
if(ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15_R1)) {
|
||||
if(ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15)) {
|
||||
Location min = cuboid.getMinPoint();
|
||||
Location max = cuboid.getMaxPoint();
|
||||
|
||||
@@ -307,7 +308,7 @@ public class Plot {
|
||||
Block block = maxWorld.getBlockAt(x, y, z);
|
||||
block.setType(material);
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1)) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
try {
|
||||
Block.class.getMethod("setData", byte.class).invoke(block, data);
|
||||
} catch(Exception e) {
|
||||
|
||||
@@ -26,9 +26,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.api.event.plot.PlotPlayerReceiveEvent;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.classic.utils.dimensional.Cuboid;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.ServerVersion;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -121,7 +119,7 @@ public class PlotManager {
|
||||
Bukkit.getScheduler().runTaskLater(arena.getPlugin(), () -> {
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
}, 40);
|
||||
}, 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+17
-3
@@ -35,6 +35,8 @@ 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -79,10 +81,22 @@ public final class PlotMenuHandler {
|
||||
}
|
||||
|
||||
public void createMenu(Player player, BaseArena arena) {
|
||||
NormalFastInv gui = new NormalFastInv(plugin.getBukkitHelper().serializeInt(arena.getPlotManager().getPlots().size()), new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_MENU_NAME").asKey().build());
|
||||
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();
|
||||
@@ -127,7 +141,7 @@ public final class PlotMenuHandler {
|
||||
});
|
||||
|
||||
int finalPlots = plots;
|
||||
gui.addItem(new SimpleClickableItem(itemStack, event -> {
|
||||
gui.addContent(itemStack, event -> {
|
||||
event.setCancelled(true);
|
||||
|
||||
if(!(event.isLeftClick() || event.isRightClick())) {
|
||||
@@ -143,7 +157,7 @@ public final class PlotMenuHandler {
|
||||
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_PLOT_CHOOSE").asKey().player(player).integer(finalPlots).sendPlayer();
|
||||
event.getWhoClicked().closeInventory();
|
||||
}));
|
||||
});
|
||||
|
||||
plots++;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.arena.managers.plots.Plot;
|
||||
import plugily.projects.buildbattle.arena.vote.VoteItems;
|
||||
import plugily.projects.minigamesbox.api.user.IUser;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
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.user.User;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -52,22 +52,24 @@ public class InGameState extends PluginInGameState {
|
||||
}
|
||||
switch(pluginArena.getArenaInGameState()) {
|
||||
case THEME_VOTING:
|
||||
if(arena.getTimer() <= 0) {
|
||||
if(arena.getTimer() <= 0 || pluginArena.getTheme() != null) {
|
||||
// may consider start to build message...
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.BUILD_TIME);
|
||||
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".In-Game"));
|
||||
|
||||
if(pluginArena.getVotePoll() != null && pluginArena.getTheme().equals("Theme")) {
|
||||
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();
|
||||
}
|
||||
|
||||
for(Player player : pluginArena.getPlayers()) {
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
player.closeInventory();
|
||||
pluginArena.addMenuItem(player);
|
||||
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);
|
||||
}
|
||||
@@ -75,11 +77,10 @@ public class InGameState extends PluginInGameState {
|
||||
break;
|
||||
case BUILD_TIME:
|
||||
handleBuildTime(pluginArena);
|
||||
handleOptionsMenu(pluginArena);
|
||||
if(arena.getTimer() <= 0) {
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
User user = getPlugin().getUserManager().getUser(player);
|
||||
|
||||
if(user.isSpectator()) continue;
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
|
||||
Plot playerPlot = pluginArena.getPlotFromPlayer(player);
|
||||
if(!pluginArena.getQueue().contains(playerPlot)) {
|
||||
@@ -103,8 +104,8 @@ public class InGameState extends PluginInGameState {
|
||||
adjustStatistics(pluginArena);
|
||||
|
||||
pluginArena.teleportToWinnerPlot();
|
||||
pluginArena.executeEndRewards();
|
||||
getPlugin().getArenaManager().stopGame(false, arena);
|
||||
pluginArena.executeEndRewards();
|
||||
} else {
|
||||
voteForNextPlot(pluginArena);
|
||||
}
|
||||
@@ -139,7 +140,7 @@ public class InGameState extends PluginInGameState {
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_VOTING_PLOT_OWNER_TITLE").asKey().arena(pluginArena).player(player).value(formattedMembers).sendArena();
|
||||
}
|
||||
|
||||
User user = getPlugin().getUserManager().getUser(player);
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
int points = user.getStatistic("LOCAL_POINTS");
|
||||
|
||||
//no vote made, in this case make it a good vote
|
||||
@@ -161,7 +162,7 @@ public class InGameState extends PluginInGameState {
|
||||
private void adjustStatistics(BuildArena pluginArena) {
|
||||
for(Plot plot : pluginArena.getPlotManager().getTopPlotsOrder()) {
|
||||
plot.getMembers().forEach(player -> {
|
||||
User user = getPlugin().getUserManager().getUser(player);
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST")) {
|
||||
user.setStatistic("POINTS_HIGHEST", plot.getPoints());
|
||||
}
|
||||
@@ -180,7 +181,7 @@ public class InGameState extends PluginInGameState {
|
||||
}
|
||||
|
||||
private void handleThemeVoting(BuildArena pluginArena) {
|
||||
for(Player player : pluginArena.getPlayers()) {
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
pluginArena.getVoteMenu().updateInventory(player);
|
||||
}
|
||||
}
|
||||
@@ -196,6 +197,15 @@ public class InGameState extends PluginInGameState {
|
||||
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) {
|
||||
|
||||
}
|
||||
@@ -207,7 +217,7 @@ public class InGameState extends PluginInGameState {
|
||||
if(votingPlot.getPoints() == 0) {
|
||||
List<Plot> plotsVoted = new ArrayList<>();
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
User user = getPlugin().getUserManager().getUser(player);
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
Plot plot = pluginArena.getPlotFromPlayer(player);
|
||||
if(!votingPlot.getMembers().contains(player)) {
|
||||
if(!plotsVoted.contains(plot)) {
|
||||
@@ -249,7 +259,7 @@ public class InGameState extends PluginInGameState {
|
||||
|
||||
while(plot == null && !pluginArena.getQueue().isEmpty()) {
|
||||
// should not happen anymore... to be removed
|
||||
System.out.print("A PLAYER HAS NO PLOT!");
|
||||
getPlugin().getDebugger().debug("A PLAYER HAS NO PLOT!");
|
||||
plot = pluginArena.getQueue().poll();
|
||||
}
|
||||
|
||||
@@ -268,7 +278,7 @@ public class InGameState extends PluginInGameState {
|
||||
String formattedMembers = plot.getFormattedMembers();
|
||||
boolean hidePlotOwner = getPlugin().getConfigPreferences().getOption("PLOT_HIDE_OWNER");
|
||||
|
||||
for(Player player : pluginArena.getPlayers()) {
|
||||
for(Player player : pluginArena.getPlayersLeft()) {
|
||||
VersionUtils.teleport(player, teleportLoc);
|
||||
player.setPlayerWeather(plot.getWeatherType());
|
||||
player.setPlayerTime(Plot.Time.format(plot.getTime(), player.getWorld().getTime()), false);
|
||||
|
||||
@@ -28,20 +28,24 @@ import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
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.user.User;
|
||||
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
|
||||
@@ -71,8 +75,11 @@ public class InGameState extends PluginInGameState {
|
||||
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 -> player.setGameMode(GameMode.CREATIVE)), 40);
|
||||
pluginArena.getCurrentBuilders().forEach(pluginArena::addMenuItem);
|
||||
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> pluginArena.getCurrentBuilders().forEach(player -> {
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
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);
|
||||
@@ -86,22 +93,26 @@ public class InGameState extends PluginInGameState {
|
||||
|
||||
if(timer <= 90) {
|
||||
if(timer == 90) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_CHARS").asKey().arena(pluginArena).integer(pluginArena.getCurrentBBTheme().getTheme().length()).sendArena();
|
||||
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().getTheme()).arena(pluginArena).sendArena();
|
||||
new TitleBuilder("IN_GAME_MESSAGES_PLOT_GTB_THEME_TITLE").asKey().value(pluginArena.getCurrentBBTheme().getTheme()).arena(pluginArena).sendArena();
|
||||
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);
|
||||
@@ -109,9 +120,7 @@ public class InGameState extends PluginInGameState {
|
||||
pluginArena.teleportToWinnerPlot(); //todo save built plot from winner
|
||||
pluginArena.executeEndRewards();
|
||||
getPlugin().getArenaManager().stopGame(false, arena);
|
||||
}
|
||||
//round delay
|
||||
if(arena.getTimer() <= 0) {
|
||||
} else if (arena.getTimer() <= 0) {
|
||||
pluginArena.resetBuildPlot();
|
||||
setArenaTimer(getPlugin().getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Voting.Theme"));
|
||||
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.THEME_VOTING);
|
||||
@@ -132,10 +141,10 @@ public class InGameState extends PluginInGameState {
|
||||
continue;
|
||||
}
|
||||
if(pluginArena.getWhoGuessed().contains(player)) {
|
||||
getPlugin().getActionBarManager().addActionBar(player, new ActionBar(new MessageBuilder(pluginArena.getCurrentBBTheme().getTheme()), ActionBar.ActionBarType.DISPLAY));
|
||||
getPlugin().getActionBarManager().addActionBar(player, new ActionBar(new MessageBuilder(pluginArena.getCurrentBBTheme().getDefaultTheme()), ActionBar.ActionBarType.DISPLAY));
|
||||
continue;
|
||||
}
|
||||
int themeLength = pluginArena.getCurrentBBTheme().getTheme().length();
|
||||
int themeLength = pluginArena.getCurrentBBTheme().getDefaultTheme().length();
|
||||
List<Integer> charsAt = new ArrayList<>(themeLength);
|
||||
|
||||
for(int i = 0; i < themeLength; i++) {
|
||||
@@ -155,7 +164,7 @@ public class InGameState extends PluginInGameState {
|
||||
|
||||
StringBuilder actionbar = new StringBuilder();
|
||||
for(int i = 0; i < themeLength; i++) {
|
||||
char charAt = pluginArena.getCurrentBBTheme().getTheme().charAt(i);
|
||||
char charAt = pluginArena.getCurrentBBTheme().getDefaultTheme().charAt(i);
|
||||
|
||||
if(Character.isWhitespace(charAt)) {
|
||||
actionbar.append(" ");
|
||||
@@ -175,13 +184,13 @@ public class InGameState extends PluginInGameState {
|
||||
if(pluginArena.isCurrentThemeSet()) {
|
||||
return;
|
||||
}
|
||||
BBTheme.Difficulty difficulty = BBTheme.Difficulty.EASY;
|
||||
GuessTheme.Difficulty difficulty = GuessTheme.Difficulty.EASY;
|
||||
switch(pluginArena.getPlugin().getRandom().nextInt(2 + 1)) {
|
||||
case 1:
|
||||
difficulty = BBTheme.Difficulty.MEDIUM;
|
||||
difficulty = GuessTheme.Difficulty.MEDIUM;
|
||||
break;
|
||||
case 2:
|
||||
difficulty = BBTheme.Difficulty.HARD;
|
||||
difficulty = GuessTheme.Difficulty.HARD;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -189,8 +198,17 @@ public class InGameState extends PluginInGameState {
|
||||
setChosenTheme(pluginArena, getThemeByDifficulty(pluginArena, difficulty));
|
||||
}
|
||||
|
||||
private void setChosenTheme(GuessArena pluginArena, BBTheme bbTheme) {
|
||||
setTheme(pluginArena, bbTheme);
|
||||
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, GuessTheme guessTheme) {
|
||||
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),
|
||||
@@ -214,20 +232,20 @@ public class InGameState extends PluginInGameState {
|
||||
});
|
||||
|
||||
|
||||
BBTheme easy = getThemeByDifficulty(pluginArena, BBTheme.Difficulty.EASY);
|
||||
gui.setItem(11, new SimpleClickableItem(new ItemBuilder(Material.PAPER).name(getThemeItemName(pluginArena).value(easy.getTheme()).build())
|
||||
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);
|
||||
}));
|
||||
|
||||
BBTheme medium = getThemeByDifficulty(pluginArena, BBTheme.Difficulty.MEDIUM);
|
||||
gui.setItem(13, new SimpleClickableItem(new ItemBuilder(Material.PAPER).name(getThemeItemName(pluginArena).value(medium.getTheme()).build())
|
||||
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);
|
||||
}));
|
||||
|
||||
BBTheme hard = getThemeByDifficulty(pluginArena, BBTheme.Difficulty.HARD);
|
||||
gui.setItem(15, new SimpleClickableItem(new ItemBuilder(Material.PAPER).name(getThemeItemName(pluginArena).value(hard.getTheme()).build())
|
||||
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);
|
||||
}));
|
||||
@@ -245,27 +263,31 @@ public class InGameState extends PluginInGameState {
|
||||
}
|
||||
|
||||
|
||||
private BBTheme getThemeByDifficulty(GuessArena pluginArena, BBTheme.Difficulty difficulty) {
|
||||
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 themeName = themesFilter.get(getPlugin().getRandom().nextInt(themesFilter.size()));
|
||||
BBTheme theme = new BBTheme(themeName, difficulty);
|
||||
pluginArena.getPlayedThemes().add(themeName);
|
||||
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, BBTheme 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 -> {
|
||||
User user = getPlugin().getUserManager().getUser(player);
|
||||
IUser user = getPlugin().getUserManager().getUser(player);
|
||||
/*
|
||||
//ToDo GTB stats
|
||||
if(plot.getPoints() > user.getStatistic("POINTS_HIGHEST")) {
|
||||
|
||||
@@ -28,9 +28,9 @@ 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.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.user.IUser;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.user.User;
|
||||
import plugily.projects.minigamesbox.classic.utils.misc.complement.ComplementAccessor;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerInteractEvent;
|
||||
@@ -60,7 +60,7 @@ public class VoteEvents implements Listener {
|
||||
}
|
||||
|
||||
BaseArena arena = plugin.getArenaRegistry().getArena(event.getPlayer());
|
||||
if(arena == null || arena.getArenaState() != ArenaState.IN_GAME || arena instanceof GuessArena) {
|
||||
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME || arena instanceof GuessArena) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class VoteEvents implements Listener {
|
||||
Plot plot = solo.getVotingPlot();
|
||||
|
||||
if(plugin.getVoteItems().getReportItem().equals(event.getItem())) {
|
||||
User user = plugin.getUserManager().getUser(event.getPlayer());
|
||||
IUser user = plugin.getUserManager().getUser(event.getPlayer());
|
||||
|
||||
user.adjustStatistic("REPORTS_TRIGGERED", 1);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
package plugily.projects.buildbattle.boot;
|
||||
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.minigamesbox.api.preferences.IConfigPreferences;
|
||||
import plugily.projects.minigamesbox.classic.api.StatisticType;
|
||||
import plugily.projects.minigamesbox.classic.api.StatsStorage;
|
||||
import plugily.projects.minigamesbox.classic.arena.options.ArenaOption;
|
||||
@@ -31,7 +32,6 @@ import plugily.projects.minigamesbox.classic.handlers.permissions.PermissionsMan
|
||||
import plugily.projects.minigamesbox.classic.handlers.reward.RewardType;
|
||||
import plugily.projects.minigamesbox.classic.handlers.reward.RewardsFactory;
|
||||
import plugily.projects.minigamesbox.classic.preferences.ConfigOption;
|
||||
import plugily.projects.minigamesbox.classic.preferences.ConfigPreferences;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
@@ -53,13 +53,14 @@ public class AdditionalValueInitializer {
|
||||
}
|
||||
|
||||
private void registerConfigOptions() {
|
||||
ConfigPreferences configPreferences = plugin.getConfigPreferences();
|
||||
IConfigPreferences configPreferences = plugin.getConfigPreferences();
|
||||
|
||||
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() {
|
||||
@@ -92,7 +93,7 @@ public class AdditionalValueInitializer {
|
||||
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"));
|
||||
rewardsFactory.registerRewardType("PLACE", new RewardType("place", RewardType.ExecutorType.NUMBER, false));
|
||||
}
|
||||
|
||||
private void registerSpecialItems() {
|
||||
|
||||
@@ -111,6 +111,7 @@ public class MessageInitializer {
|
||||
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", ""));
|
||||
|
||||
@@ -28,9 +28,9 @@ 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.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.buildbattle.handlers.themes.GuessTheme;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.handlers.placeholder.Placeholder;
|
||||
import plugily.projects.minigamesbox.classic.handlers.placeholder.PlaceholderManager;
|
||||
@@ -58,30 +58,30 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("theme", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getTheme(player, arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getTheme(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getTheme(PluginArena arena) {
|
||||
private String getTheme(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
}
|
||||
String theme = pluginArena.getTheme();
|
||||
if(theme.equalsIgnoreCase("theme")) {
|
||||
if(theme == null) {
|
||||
theme = new MessageBuilder("SCOREBOARD_THEME_UNKNOWN").asKey().build();
|
||||
}
|
||||
return theme;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getTheme(Player player, PluginArena arena) {
|
||||
private String getTheme(Player player, IPluginArena arena) {
|
||||
String theme = getTheme(arena);
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
@@ -92,8 +92,8 @@ public class PlaceholderInitializer {
|
||||
}
|
||||
if(theme.equalsIgnoreCase(new MessageBuilder("SCOREBOARD_THEME_UNKNOWN").asKey().build())) {
|
||||
if(((GuessArena) pluginArena).getCurrentBuilders().contains(player) || ((GuessArena) pluginArena).getWhoGuessed().contains(player)) {
|
||||
BBTheme guessTheme = ((GuessArena) pluginArena).getCurrentBBTheme();
|
||||
theme = guessTheme == null ? new MessageBuilder("SCOREBOARD_THEME_UNKNOWN").asKey().build() : guessTheme.getTheme();
|
||||
GuessTheme guessTheme = ((GuessArena) pluginArena).getCurrentBBTheme();
|
||||
theme = guessTheme == null ? new MessageBuilder("SCOREBOARD_THEME_UNKNOWN").asKey().build() : guessTheme.getDefaultTheme();
|
||||
}
|
||||
}
|
||||
return theme;
|
||||
@@ -102,20 +102,20 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("difficulty", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getTheme(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getTheme(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getTheme(PluginArena arena) {
|
||||
private String getTheme(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena instanceof GuessArena) {
|
||||
BBTheme theme = ((GuessArena) pluginArena).getCurrentBBTheme();
|
||||
GuessTheme theme = ((GuessArena) pluginArena).getCurrentBBTheme();
|
||||
if(theme == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -127,20 +127,20 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("difficulty_points_reward", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getTheme(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getTheme(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getTheme(PluginArena arena) {
|
||||
private String getTheme(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena instanceof GuessArena) {
|
||||
BBTheme theme = ((GuessArena) pluginArena).getCurrentBBTheme();
|
||||
GuessTheme theme = ((GuessArena) pluginArena).getCurrentBBTheme();
|
||||
if(theme == null) {
|
||||
return "0";
|
||||
}
|
||||
@@ -152,17 +152,17 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("builder", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getBuilder(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getBuilder(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getBuilder(PluginArena arena) {
|
||||
private String getBuilder(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(!(pluginArena instanceof GuessArena)) {
|
||||
return null;
|
||||
@@ -176,17 +176,17 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("type", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getType(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getType(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getType(PluginArena arena) {
|
||||
private String getType(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
@@ -196,17 +196,17 @@ public class PlaceholderInitializer {
|
||||
});
|
||||
placeholderManager.registerPlaceholder(new Placeholder("type_pretty", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getType(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getType(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getType(PluginArena arena) {
|
||||
private String getType(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
@@ -218,22 +218,22 @@ public class PlaceholderInitializer {
|
||||
final int number = i;
|
||||
placeholderManager.registerPlaceholder(new Placeholder("place_member_" + number, Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getPlace(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getPlace(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getPlace(PluginArena arena) {
|
||||
private String getPlace(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
}
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != ArenaState.ENDING) {
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != IArenaState.ENDING) {
|
||||
return "???";
|
||||
}
|
||||
List<Plot> plotRanking = pluginArena.getPlotManager().getTopPlotsOrder();
|
||||
@@ -249,22 +249,22 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("place_points_" + number, Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getPlace(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getPlace(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getPlace(PluginArena arena) {
|
||||
private String getPlace(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
}
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != ArenaState.ENDING) {
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != IArenaState.ENDING) {
|
||||
return "???";
|
||||
}
|
||||
List<Plot> plotRanking = pluginArena.getPlotManager().getTopPlotsOrder();
|
||||
@@ -277,17 +277,17 @@ public class PlaceholderInitializer {
|
||||
}
|
||||
placeholderManager.registerPlaceholder(new Placeholder("ingame_state", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getState(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getState(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getState(PluginArena arena) {
|
||||
private String getState(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
@@ -301,17 +301,17 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("ingame_state_pretty", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getState(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getState(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getState(PluginArena arena) {
|
||||
private String getState(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
@@ -326,12 +326,12 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("teammates", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getMembers(player, arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getMembers(Player player, PluginArena arena) {
|
||||
private String getMembers(Player player, IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
@@ -355,12 +355,12 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("summary_player", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getSummary(arena, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getSummary(PluginArena arena, Player player) {
|
||||
private String getSummary(IPluginArena arena, Player player) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
@@ -375,17 +375,17 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("summary_place_own", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getSummary(arena, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getSummary(PluginArena arena, Player player) {
|
||||
private String getSummary(IPluginArena arena, Player player) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
}
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != ArenaState.ENDING) {
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != IArenaState.ENDING) {
|
||||
return null;
|
||||
}
|
||||
List<Plot> plotRanking = pluginArena.getPlotManager().getTopPlotsOrder();
|
||||
@@ -404,17 +404,17 @@ public class PlaceholderInitializer {
|
||||
|
||||
placeholderManager.registerPlaceholder(new Placeholder("summary", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getSummary(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getSummary(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getSummary(PluginArena arena) {
|
||||
private String getSummary(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
@@ -428,27 +428,27 @@ public class PlaceholderInitializer {
|
||||
});
|
||||
placeholderManager.registerPlaceholder(new Placeholder("summary_place_list", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getSummary(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getSummary(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getSummary(PluginArena arena) {
|
||||
private String getSummary(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
}
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != ArenaState.ENDING) {
|
||||
if(pluginArena.getArenaInGameState() != BaseArena.ArenaInGameState.PLOT_VOTING && pluginArena.getArenaState() != IArenaState.ENDING) {
|
||||
return null;
|
||||
}
|
||||
int places = pluginArena.getPlotManager().getTopPlotsOrder().size();
|
||||
if(places > 16) {
|
||||
places = 16;
|
||||
if(places > 20) {
|
||||
places = 20;
|
||||
}
|
||||
StringBuilder placeSummary = new StringBuilder();
|
||||
for(int i = 1; i <= places; i++) {
|
||||
@@ -460,17 +460,17 @@ public class PlaceholderInitializer {
|
||||
});
|
||||
placeholderManager.registerPlaceholder(new Placeholder("gtb_rounds", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) {
|
||||
@Override
|
||||
public String getValue(Player player, PluginArena arena) {
|
||||
public String getValue(Player player, IPluginArena arena) {
|
||||
return getSummary(arena);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(PluginArena arena) {
|
||||
public String getValue(IPluginArena arena) {
|
||||
return getSummary(arena);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getSummary(PluginArena arena) {
|
||||
private String getSummary(IPluginArena arena) {
|
||||
BaseArena pluginArena = arenaRegistry.getArena(arena.getId());
|
||||
if(pluginArena == null) {
|
||||
return null;
|
||||
|
||||
+13
-4
@@ -20,17 +20,21 @@
|
||||
|
||||
package plugily.projects.buildbattle.commands.arguments;
|
||||
|
||||
import org.checkerframework.checker.units.qual.Force;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
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.minigamesbox.classic.arena.PluginArena;
|
||||
import plugily.projects.buildbattle.commands.arguments.game.MenuArgument;
|
||||
import plugily.projects.minigamesbox.api.arena.IPluginArena;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.PluginArgumentsRegistry;
|
||||
|
||||
import java.util.List;
|
||||
@@ -46,25 +50,30 @@ public class ArgumentsRegistry extends PluginArgumentsRegistry {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PluginArena> getSpecificFilteredArenas(List<PluginArena> arenas, String filter) {
|
||||
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":
|
||||
case "team":
|
||||
default:
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+31
-13
@@ -25,11 +25,15 @@ 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.io.Console;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
* <p>
|
||||
@@ -38,12 +42,29 @@ import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
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",
|
||||
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) {
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena((Player) sender);
|
||||
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;
|
||||
@@ -53,20 +74,17 @@ public class SetThemeArgument {
|
||||
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;
|
||||
}
|
||||
if(arena.getArenaInGameState() == BaseArena.ArenaInGameState.THEME_VOTING) {
|
||||
String themeName = args[1];
|
||||
StringJoiner themeName = new StringJoiner(" ");
|
||||
|
||||
if(arena.getPlugin().getThemeManager().isThemeBlacklisted(themeName)) {
|
||||
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);
|
||||
new MessageBuilder("IN_GAME_MESSAGES_ADMIN_CHANGED_THEME").asKey().prefix().value(themeName).arena(arena).sendArena();
|
||||
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);
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgument;
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public class SelectPlotArgument {
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
|
||||
if(arena != null && (arena.getArenaState() == ArenaState.WAITING_FOR_PLAYERS || arena.getArenaState() == ArenaState.STARTING))
|
||||
if(arena != null && (arena.getArenaState() == IArenaState.WAITING_FOR_PLAYERS || arena.getArenaState() == IArenaState.STARTING || arena.getArenaState() == IArenaState.FULL_GAME))
|
||||
arena.getPlugin().getPlotMenuHandler().createMenu(player, arena);
|
||||
}
|
||||
});
|
||||
|
||||
+8
-3
@@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgument;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
|
||||
@@ -50,13 +50,18 @@ public class GuessArgument {
|
||||
Player player = (Player) sender;
|
||||
BaseArena arena = (BaseArena) registry.getPlugin().getArenaRegistry().getArena(player);
|
||||
|
||||
if(!(arena instanceof GuessArena) || arena.getArenaState() != ArenaState.IN_GAME) {
|
||||
if(!(arena instanceof GuessArena) || arena.getArenaState() != IArenaState.IN_GAME) {
|
||||
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;
|
||||
@@ -67,7 +72,7 @@ public class GuessArgument {
|
||||
return;
|
||||
}
|
||||
|
||||
if(gameArena.getCurrentBBTheme() == null || !gameArena.getCurrentBBTheme().getTheme().equalsIgnoreCase(Arrays.toString(args).split(" ", 2)[1].replace(",", "").replace("]", ""))) {
|
||||
if(gameArena.getCurrentBBTheme() == null || gameArena.getCurrentBBTheme().getThemes().stream().noneMatch(theme -> theme.equalsIgnoreCase(Arrays.toString(args).split(" ", 2)[1].replace(",", "").replace("]", "")))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
*
|
||||
* 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.game;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.commands.arguments.ArgumentsRegistry;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgument;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <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);
|
||||
|
||||
if(arena != null && (arena.getArenaState() == IArenaState.IN_GAME))
|
||||
arena.getPlugin().getOptionsRegistry().getOptionsGui().open(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* 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(1), LANGUAGE(2),
|
||||
/*LEADERBOARDS(0),*/ MYSQL(1), PERMISSIONS(1), POWERUPS(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 LANGUAGE:
|
||||
switch(version) {
|
||||
case 1:
|
||||
MigratorUtils.insertAfterLine(file, " Heads:", " Database:\n" +
|
||||
" Lore: \"Get Head %value%\"");
|
||||
break;
|
||||
default:
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.ItemMap;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.PaginatedFastInv;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -50,147 +51,156 @@ import java.util.Set;
|
||||
*/
|
||||
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) {
|
||||
this.plugin = plugin;
|
||||
this.menuItem = plugin.getSpecialItemManager().getSpecialItemStack("OPTIONS_MENU");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
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);
|
||||
/**
|
||||
* 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!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
/**
|
||||
* Defines new size of options inventory
|
||||
*
|
||||
* @param size size to set
|
||||
*/
|
||||
public void defineInventorySize(int size) {
|
||||
inventorySize = size;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines new size of options inventory
|
||||
*
|
||||
* @param size size to set
|
||||
*/
|
||||
public void defineInventorySize(int size) {
|
||||
inventorySize = size;
|
||||
}
|
||||
public void addGoBackItem(ItemMap page, int slot) {
|
||||
page.setItem(slot, getBackItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(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());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+5
-2
@@ -33,6 +33,8 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -88,8 +90,9 @@ public class FloorChangeOption {
|
||||
event.getCurrentItem().setType(Material.AIR);
|
||||
player.closeInventory();
|
||||
|
||||
player.getNearbyEntities(5, 5, 5).stream().filter(entity -> entity.getType() == EntityType.DROPPED_ITEM)
|
||||
.forEach(Entity::remove);
|
||||
player.getNearbyEntities(5, 5, 5).stream().filter(entity -> entity.getType() == XEntityType.ITEM.get())
|
||||
.forEach(Entity::remove);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+3
-2
@@ -67,8 +67,9 @@ public class TimeChangeOption {
|
||||
return;
|
||||
}
|
||||
|
||||
gui.addItem(new ItemBuilder(XMaterial.CLOCK.parseItem()).name(new MessageBuilder("MENU_OPTION_CONTENT_TIME_TYPE_WORLD").asKey().build()).lore(plot.getTime().name()).build());
|
||||
//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");
|
||||
@@ -86,7 +87,7 @@ public class TimeChangeOption {
|
||||
|
||||
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();
|
||||
new MessageBuilder("MENU_OPTION_CONTENT_TIME_CHANGED").asKey().player(p).value(new MessageBuilder(messageKey).asKey().build()).sendPlayer();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
+10
-2
@@ -21,10 +21,12 @@
|
||||
package plugily.projects.buildbattle.handlers.menu.registry.banner;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.ServerVersion;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
|
||||
@@ -66,8 +68,14 @@ public class Banner {
|
||||
ItemStack item = XMaterial.WHITE_BANNER.parseItem();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1)) {
|
||||
meta.setBaseColor(color);
|
||||
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) {
|
||||
|
||||
+14
-5
@@ -21,17 +21,20 @@
|
||||
package plugily.projects.buildbattle.handlers.menu.registry.banner;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
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;
|
||||
|
||||
@@ -69,11 +72,17 @@ public class BannerMenu {
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
ItemStack item;
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1)) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
|
||||
item = XMaterial.WHITE_BANNER.parseItem();
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
|
||||
meta.setBaseColor(color);
|
||||
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();
|
||||
@@ -96,17 +105,17 @@ public class BannerMenu {
|
||||
private void prepareLayerStageGui() {
|
||||
NormalFastInv gui = new NormalFastInv(54, new MessageBuilder("MENU_OPTION_CONTENT_BANNER_INVENTORY_LAYER").asKey().build());
|
||||
|
||||
for(PatternType pattern : PatternType.values()) {
|
||||
for(XPatternType pattern : XPatternType.getValues()) {
|
||||
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));
|
||||
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));
|
||||
banner.addPattern(new BannerPattern(color, pattern.get()));
|
||||
new BannerMenu(player, banner).openInventory(PatternStage.LAYER_COLOR);
|
||||
}));
|
||||
}
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public class BiomeChangeOption {
|
||||
}
|
||||
|
||||
for(Chunk chunk : plot.getCuboid().chunkList()) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15_R1)) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
continue;
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class BiomesRegistry {
|
||||
.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.matchXBiome(biome).orElse(XBiome.BADLANDS));
|
||||
.build(), config.getString(biome + ".permission"), XBiome.of(biome).orElse(XBiome.BADLANDS));
|
||||
biomes.add(biomeItem);
|
||||
i++;
|
||||
}
|
||||
|
||||
+2
-1
@@ -25,6 +25,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
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;
|
||||
@@ -55,7 +56,7 @@ public class ParticleRefreshScheduler {
|
||||
final int particleAmount = amountParticle;
|
||||
|
||||
task = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
|
||||
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
|
||||
if(arena instanceof BaseArena && !arena.getPlayers().isEmpty()) {
|
||||
for(Plot buildPlot : ((BaseArena) arena).getPlotManager().getPlots()) {
|
||||
if(!buildPlot.getMembers().isEmpty()) {
|
||||
|
||||
+31
-46
@@ -35,9 +35,8 @@ import plugily.projects.minigamesbox.classic.utils.configuration.ConfigUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.ItemMap;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.paged.PagedFastInv;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.InventoryScheme;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.PaginatedFastInv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -49,7 +48,7 @@ import java.util.*;
|
||||
*/
|
||||
public class ParticleRegistry {
|
||||
|
||||
private PagedFastInv particles;
|
||||
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;
|
||||
@@ -114,46 +113,23 @@ public class ParticleRegistry {
|
||||
}
|
||||
|
||||
private void registerInventory() {
|
||||
int i = 0;
|
||||
Set<ParticleItem> particleItemsPage1 = new HashSet<>(registeredParticles.size());
|
||||
Set<ParticleItem> particleItemsPage2 = new HashSet<>();
|
||||
PaginatedFastInv gui = new PaginatedFastInv(54, new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_INVENTORY").asKey().build());
|
||||
|
||||
for(ParticleItem item : registeredParticles) {
|
||||
(i >= 45 ? particleItemsPage2 : particleItemsPage1).add(item);
|
||||
i++;
|
||||
}
|
||||
new InventoryScheme()
|
||||
.mask(" 1111111 ")
|
||||
.mask(" 1111111 ")
|
||||
.mask(" 1111111 ")
|
||||
.mask(" 1111111 ")
|
||||
.bindPagination('1').apply(gui);
|
||||
|
||||
PagedFastInv gui = new PagedFastInv(54, new MessageBuilder("MENU_OPTION_CONTENT_PARTICLE_INVENTORY").asKey().build());
|
||||
|
||||
gui.setForceRefresh(true);
|
||||
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());
|
||||
|
||||
ItemMap page1 = gui.createNewPage();
|
||||
ItemMap page2 = gui.createNewPage();
|
||||
gui.setItem(52, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("X").build(),
|
||||
e -> e.getWhoClicked().closeInventory());
|
||||
|
||||
page2.setItem(45, new SimpleClickableItem(new ItemBuilder(new ItemStack(XMaterial.ARROW.parseMaterial())).name("<-").build(), event -> {
|
||||
gui.setCurrentPage(0);
|
||||
gui.refresh();
|
||||
}));
|
||||
page1.setItem(53, new SimpleClickableItem(new ItemBuilder(new ItemStack(XMaterial.ARROW.parseMaterial())).name("->").build(), event -> {
|
||||
gui.setCurrentPage(1);
|
||||
gui.refresh();
|
||||
}));
|
||||
|
||||
addParticles(page1, particleItemsPage1);
|
||||
addParticles(page2, particleItemsPage2);
|
||||
|
||||
addRemoveItem(page1);
|
||||
addRemoveItem(page2);
|
||||
setParticles(gui);
|
||||
|
||||
plugin.getOptionsRegistry().addGoBackItem(page1, 46);
|
||||
plugin.getOptionsRegistry().addGoBackItem(page2, 46);
|
||||
|
||||
gui.refresh();
|
||||
}
|
||||
|
||||
private void addRemoveItem(ItemMap itemMap) {
|
||||
itemMap.setItem(49, new SimpleClickableItem(new ItemBuilder(new ItemStack(Material.REDSTONE_BLOCK))
|
||||
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 -> {
|
||||
@@ -170,12 +146,18 @@ public class ParticleRegistry {
|
||||
event.setCancelled(false);
|
||||
player.closeInventory();
|
||||
ParticleRemoveMenu.openMenu(player, arena.getPlotManager().getPlot(player));
|
||||
}));
|
||||
});
|
||||
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 46);
|
||||
|
||||
addParticles(gui);
|
||||
|
||||
setParticles(gui);
|
||||
}
|
||||
|
||||
private void addParticles(ItemMap itemMap, Set<ParticleItem> particleItems) {
|
||||
for(ParticleItem item : particleItems) {
|
||||
itemMap.addItem(new SimpleClickableItem(item.getItemStack(), event -> {
|
||||
private void addParticles(PaginatedFastInv gui) {
|
||||
for(ParticleItem item : registeredParticles) {
|
||||
gui.addContent(item.getItemStack(), event -> {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
|
||||
if(!(humanEntity instanceof Player))
|
||||
@@ -191,6 +173,9 @@ public class ParticleRegistry {
|
||||
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;
|
||||
@@ -198,15 +183,15 @@ public class ParticleRegistry {
|
||||
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 PagedFastInv getParticles() {
|
||||
public PaginatedFastInv getParticles() {
|
||||
return particles;
|
||||
}
|
||||
|
||||
public void setParticles(PagedFastInv particles) {
|
||||
public void setParticles(PaginatedFastInv particles) {
|
||||
this.particles = particles;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class ParticlesOption {
|
||||
}
|
||||
|
||||
humanEntity.closeInventory();
|
||||
registry.getPlugin().getOptionsRegistry().getParticleRegistry().getParticles().open(humanEntity);
|
||||
registry.getPlugin().getOptionsRegistry().getParticleRegistry().getParticles().open(((Player) humanEntity));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+13
-4
@@ -21,7 +21,7 @@
|
||||
package plugily.projects.buildbattle.handlers.menu.registry.playerheads;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.PaginatedFastInv;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
@@ -35,7 +35,8 @@ public class HeadsCategory {
|
||||
private final String categoryID;
|
||||
private ItemStack itemStack;
|
||||
private String permission;
|
||||
private NormalFastInv gui;
|
||||
private PaginatedFastInv gui;
|
||||
private boolean search = false;
|
||||
|
||||
public HeadsCategory(String categoryID) {
|
||||
this.categoryID = categoryID;
|
||||
@@ -61,11 +62,19 @@ public class HeadsCategory {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public NormalFastInv getGui() {
|
||||
public PaginatedFastInv getGui() {
|
||||
return gui;
|
||||
}
|
||||
|
||||
public void setGui(NormalFastInv inventoryView) {
|
||||
public void setGui(PaginatedFastInv inventoryView) {
|
||||
this.gui = inventoryView;
|
||||
}
|
||||
|
||||
public void setSearch(boolean search) {
|
||||
this.search = search;
|
||||
}
|
||||
|
||||
public boolean isSearch() {
|
||||
return search;
|
||||
}
|
||||
}
|
||||
+103
-32
@@ -20,16 +20,30 @@
|
||||
|
||||
package plugily.projects.buildbattle.handlers.menu.registry.playerheads;
|
||||
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
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.conversation.SimpleConversationBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemUtils;
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Plajer
|
||||
@@ -38,41 +52,98 @@ import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
*/
|
||||
public class PlayerHeadsOption {
|
||||
|
||||
public PlayerHeadsOption(OptionsRegistry registry) {
|
||||
registry.registerOption(new MenuOption(10, "PLAYER_HEADS", new ItemBuilder(ItemUtils.PLAYER_HEAD_ITEM.clone())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_HEADS_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_HEADS_ITEM_LORE").asKey().build())
|
||||
.build(), new MessageBuilder("MENU_OPTION_CONTENT_HEADS_INVENTORY").asKey().build()) {
|
||||
public PlayerHeadsOption(OptionsRegistry registry) {
|
||||
registry.registerOption(new MenuOption(10, "PLAYER_HEADS", new ItemBuilder(XMaterial.PLAYER_HEAD.parseItem())
|
||||
.name(new MessageBuilder("MENU_OPTION_CONTENT_HEADS_ITEM_NAME").asKey().build())
|
||||
.lore(new MessageBuilder("MENU_OPTION_CONTENT_HEADS_ITEM_LORE").asKey().build())
|
||||
.build(), new MessageBuilder("MENU_OPTION_CONTENT_HEADS_INVENTORY").asKey().build()) {
|
||||
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if (!(humanEntity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) humanEntity;
|
||||
if (registry.getPlugin().getConfigPreferences().getOption("HEAD_MENU_CUSTOM")) {
|
||||
player.performCommand(registry.getPlugin().getConfig().getString("Head-Menu.Command", "heads"));
|
||||
return;
|
||||
}
|
||||
NormalFastInv gui = new NormalFastInv(registry.getPlugin().getBukkitHelper().serializeInt(registry.getPlayerHeadsRegistry().getCategories().size() + 1), new MessageBuilder("MENU_OPTION_CONTENT_HEADS_INVENTORY").asKey().build());
|
||||
@Override
|
||||
public void onClick(InventoryClickEvent event) {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
humanEntity.closeInventory();
|
||||
if(!(humanEntity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) humanEntity;
|
||||
if(registry.getPlugin().getConfigPreferences().getOption("HEAD_MENU_CUSTOM")) {
|
||||
player.performCommand(registry.getPlugin().getConfig().getString("Head-Menu.Command", "heads"));
|
||||
return;
|
||||
}
|
||||
NormalFastInv gui = new NormalFastInv(registry.getPlugin().getBukkitHelper().serializeInt(registry.getPlayerHeadsRegistry().getCategories().size() + 1), new MessageBuilder("MENU_OPTION_CONTENT_HEADS_INVENTORY").asKey().build());
|
||||
|
||||
for (HeadsCategory headsCategory : registry.getPlayerHeadsRegistry().getCategories().keySet()) {
|
||||
gui.addItem(new SimpleClickableItem(headsCategory.getItemStack(), clickEvent -> {
|
||||
player.closeInventory();
|
||||
if (!player.hasPermission(headsCategory.getPermission())) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_HEAD").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
headsCategory.getGui().open(player);
|
||||
}));
|
||||
}
|
||||
for(HeadsCategory headsCategory : registry.getPlayerHeadsRegistry().getCategories().keySet()) {
|
||||
if(headsCategory.isSearch()) {
|
||||
gui.setItem(gui.getInventory().getSize() - 2, headsCategory.getItemStack(), clickEvent -> {
|
||||
player.closeInventory();
|
||||
if(!player.hasPermission(headsCategory.getPermission())) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_HEAD").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
createChatEvent(event, player, registry);
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, gui.getInventory().getSize() - 1);
|
||||
gui.open(humanEntity);
|
||||
gui.addItem(headsCategory.getItemStack(), clickEvent -> {
|
||||
player.closeInventory();
|
||||
if(!player.hasPermission(headsCategory.getPermission())) {
|
||||
new MessageBuilder("IN_GAME_MESSAGES_PLOT_PERMISSION_HEAD").asKey().player(player).sendPlayer();
|
||||
return;
|
||||
}
|
||||
headsCategory.getGui().open(player);
|
||||
});
|
||||
}
|
||||
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(gui, gui.getInventory().getSize() - 1);
|
||||
gui.open(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void createChatEvent(InventoryClickEvent event, Player player, OptionsRegistry registry) {
|
||||
new SimpleConversationBuilder(registry.getPlugin()).withPrompt(new StringPrompt() {
|
||||
@Override
|
||||
public @NotNull String getPromptText(ConversationContext context) {
|
||||
return new MessageBuilder("&ePlease type in chat the name of the head!").prefix().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
String name = new MessageBuilder(input, false).build();
|
||||
context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | Got " + name).prefix().build());
|
||||
|
||||
PaginatedFastInv resultGui = new PaginatedFastInv(54, new MessageBuilder("Searching %value%").value(name).build());
|
||||
new InventoryScheme()
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.bindPagination('1').apply(resultGui);
|
||||
|
||||
|
||||
resultGui.previousPageItem(45, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("&7<- &6" + p + "&7/&6" + resultGui.lastPage()).colorizeItem().build());
|
||||
resultGui.addPageChangeHandler(openedPage -> {
|
||||
resultGui.setItem(49, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("&7X &6" + openedPage + " &7X").colorizeItem().build(), e -> e.getWhoClicked().closeInventory());
|
||||
});
|
||||
}
|
||||
resultGui.nextPageItem(53, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("&6 " + p + "&7/&6" + resultGui.lastPage() + " &7->").colorizeItem().build());
|
||||
|
||||
registry.getPlugin().getOptionsRegistry().addGoBackItem(resultGui, 46);
|
||||
|
||||
List<ItemStack> filteredHeads = registry.getPlayerHeadsRegistry().getHeadsDatabase().values().stream()
|
||||
.flatMap(innerMap -> innerMap.entrySet().stream())
|
||||
.filter(entry -> entry.getKey().toLowerCase().contains(input.toLowerCase()))
|
||||
.map(Map.Entry::getValue)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for(ItemStack playerHead : filteredHeads) {
|
||||
resultGui.addContent(playerHead, clickEvent -> clickEvent.getWhoClicked().getInventory().addItem(playerHead.clone()));
|
||||
}
|
||||
resultGui.open(player);
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
}).buildFor((Player) event.getWhoClicked());
|
||||
}
|
||||
|
||||
}
|
||||
+126
-17
@@ -20,23 +20,30 @@
|
||||
|
||||
package plugily.projects.buildbattle.handlers.menu.registry.playerheads;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.handlers.menu.OptionsRegistry;
|
||||
import plugily.projects.buildbattle.handlers.misc.HeadDatabaseManager;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.configuration.ConfigUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.misc.complement.ComplementAccessor;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XEnchantment;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.InventoryScheme;
|
||||
import plugily.projects.minigamesbox.inventory.utils.fastinv.PaginatedFastInv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -47,7 +54,7 @@ import java.util.stream.Collectors;
|
||||
public class PlayerHeadsRegistry {
|
||||
|
||||
private final Main plugin;
|
||||
private final Map<HeadsCategory, NormalFastInv> categories = new HashMap<>();
|
||||
private final Map<HeadsCategory, PaginatedFastInv> categories = new HashMap<>();
|
||||
|
||||
public PlayerHeadsRegistry(OptionsRegistry registry) {
|
||||
this.plugin = registry.getPlugin();
|
||||
@@ -60,6 +67,30 @@ public class PlayerHeadsRegistry {
|
||||
if(!config.getBoolean(str + ".enabled", true)) {
|
||||
continue;
|
||||
}
|
||||
if(str.equalsIgnoreCase("Do-Not-Edit")) {
|
||||
continue;
|
||||
}
|
||||
if(config.getBoolean(str + ".database", false)) {
|
||||
String categoryName = config.getString(str + ".config", "fail");
|
||||
if(categoryName.equalsIgnoreCase("search")) {
|
||||
HeadsCategory category = new HeadsCategory(str);
|
||||
category.setItemStack(new ItemBuilder(ItemUtils.getSkull(config.getString(str + ".texture")))
|
||||
.name(new MessageBuilder(config.getString(str + ".displayname")).value(categoryName.toUpperCase()).build())
|
||||
.lore(config.getStringList(str + ".lore").stream()
|
||||
.map(lore -> new MessageBuilder(lore).value(categoryName.toUpperCase()).build()).collect(Collectors.toList()))
|
||||
.glowEffect().build());
|
||||
category.setPermission(config.getString(str + ".permission"));
|
||||
category.setSearch(true);
|
||||
categories.put(category, null);
|
||||
} else {
|
||||
CompletableFuture.supplyAsync(() -> plugin.getHeadDatabaseManager().getDatabase(categoryName)).thenAccept(download -> {
|
||||
if(download != HeadDatabaseManager.DownloadStatus.FAIL) {
|
||||
useDatabaseHeads(config, str);
|
||||
}
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
HeadsCategory category = new HeadsCategory(str);
|
||||
|
||||
category.setItemStack(new ItemBuilder(ItemUtils.getSkull(config.getString(str + ".texture")))
|
||||
@@ -86,20 +117,98 @@ public class PlayerHeadsRegistry {
|
||||
stack.setItemMeta(im);
|
||||
playerHeads.add(stack);
|
||||
}
|
||||
NormalFastInv gui = new NormalFastInv(plugin.getBukkitHelper().serializeInt(playerHeads.size() + 1), new MessageBuilder(config.getString(str + ".menuname")).build());
|
||||
|
||||
for(ItemStack playerHead : playerHeads) {
|
||||
gui.addItem(new SimpleClickableItem(playerHead, clickEvent -> clickEvent.getWhoClicked().getInventory().addItem(playerHead.clone())));
|
||||
}
|
||||
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, gui.getInventory().getSize() - 1);
|
||||
category.setGui(gui);
|
||||
categories.put(category, gui);
|
||||
createPaginatedInventory(str, config, playerHeads, category);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<HeadsCategory, NormalFastInv> getCategories() {
|
||||
private void createPaginatedInventory(String str, FileConfiguration config, Collection<ItemStack> playerHeads, HeadsCategory category) {
|
||||
PaginatedFastInv gui = new PaginatedFastInv(54, new MessageBuilder(config.getString(str + ".menuname")).value(config.getString(str + ".config")).build());
|
||||
new InventoryScheme()
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.mask("111111111")
|
||||
.bindPagination('1').apply(gui);
|
||||
|
||||
|
||||
gui.previousPageItem(45, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("&7<- &6" + p + "&7/&6" + gui.lastPage()).colorizeItem().build());
|
||||
gui.addPageChangeHandler(openedPage -> {
|
||||
gui.setItem(49, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("&7X &6" + openedPage + " &7X").colorizeItem().build(), e -> e.getWhoClicked().closeInventory());
|
||||
});
|
||||
gui.nextPageItem(53, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("&6 " + p + "&7/&6" + gui.lastPage() + " &7->").colorizeItem().build());
|
||||
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, 46);
|
||||
|
||||
if(playerHeads.size() > 200) {
|
||||
List<ItemStack> heads = new ArrayList<>(playerHeads);
|
||||
Collections.shuffle(heads);
|
||||
int start = plugin.getRandom().nextInt(heads.size() - 225);
|
||||
playerHeads = heads.subList(start, start + 225);
|
||||
}
|
||||
|
||||
for(ItemStack playerHead : playerHeads) {
|
||||
gui.addContent(playerHead, clickEvent -> clickEvent.getWhoClicked().getInventory().addItem(playerHead.clone()));
|
||||
}
|
||||
|
||||
plugin.getOptionsRegistry().addGoBackItem(gui, gui.getInventory().getSize() - 1);
|
||||
category.setGui(gui);
|
||||
categories.put(category, gui);
|
||||
}
|
||||
|
||||
public void useDatabaseHeads(FileConfiguration config, String str) {
|
||||
HeadsCategory category = new HeadsCategory(str);
|
||||
String categoryName = config.getString(str + ".config", "fail");
|
||||
|
||||
category.setItemStack(new ItemBuilder(ItemUtils.getSkull(config.getString(str + ".texture")))
|
||||
.name(new MessageBuilder(config.getString(str + ".displayname")).value(categoryName.toUpperCase()).build())
|
||||
.lore(config.getStringList(str + ".lore").stream()
|
||||
.map(lore -> new MessageBuilder(lore).value(categoryName.toUpperCase()).build()).collect(Collectors.toList()))
|
||||
.build());
|
||||
category.setPermission(config.getString(str + ".permission"));
|
||||
|
||||
|
||||
CompletableFuture.supplyAsync(() -> loadHeadsFromYML(categoryName)).thenAccept(playerHeads -> createPaginatedInventory(str, config, playerHeads.values(), category));
|
||||
}
|
||||
|
||||
private final Map<String, Map<String, ItemStack>> headsDatabase = new HashMap<>();
|
||||
|
||||
public Map<String, ItemStack> loadHeadsFromYML(String name) {
|
||||
// Should do this in async thread to do not cause dead for the main thread
|
||||
long start = System.currentTimeMillis();
|
||||
FileConfiguration categoryConfig = ConfigUtils.getConfig(plugin, "heads/database/" + name);
|
||||
Map<String, String> heads = new HashMap<>();
|
||||
for(String path : categoryConfig.getKeys(false)) {
|
||||
heads.put(path, categoryConfig.getString(path));
|
||||
}
|
||||
plugin.getDebugger().debug("[System] [Plugin] Head file loading " + name + " finished took ms" + (System.currentTimeMillis() - start));
|
||||
|
||||
long secondStart = System.currentTimeMillis();
|
||||
Map<String, ItemStack> playerHeads = new HashMap<>();
|
||||
for(Map.Entry<String, String> entry : heads.entrySet()) {
|
||||
if(entry.getKey().toLowerCase().contains("(dup)")) {
|
||||
continue;
|
||||
}
|
||||
ItemStack stack = ItemUtils.getSkull(entry.getValue());
|
||||
ItemMeta im = stack.getItemMeta();
|
||||
|
||||
ComplementAccessor.getComplement().setDisplayName(im, new MessageBuilder(entry.getKey()).build());
|
||||
ComplementAccessor.getComplement().setLore(im, Collections.singletonList(new MessageBuilder("MENU_OPTION_CONTENT_HEADS_DATABASE_LORE").asKey().value(entry.getKey()).build()));
|
||||
stack.setItemMeta(im);
|
||||
playerHeads.put(entry.getKey(), stack);
|
||||
}
|
||||
headsDatabase.put(name, playerHeads);
|
||||
plugin.getDebugger().debug("[System] [Plugin] Head textures loading " + name + " finished took ms" + (System.currentTimeMillis() - secondStart));
|
||||
return playerHeads;
|
||||
}
|
||||
|
||||
|
||||
public Map<HeadsCategory, PaginatedFastInv> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
public Map<String, Map<String, ItemStack>> getHeadsDatabase() {
|
||||
return headsDatabase;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,26 +37,20 @@ public class ChunkManager {
|
||||
|
||||
private static Class<?> packetPlayOutMapChunk, chunkClass;
|
||||
private static Constructor<?> mapChunkConstructor;
|
||||
private static Method chunkHandleMethod;
|
||||
|
||||
static {
|
||||
if(ServerVersion.Version.isCurrentLower(ServerVersion.Version.v1_18_R1)) {
|
||||
if (ServerVersion.Version.isCurrentLower(ServerVersion.Version.v1_18)) {
|
||||
packetPlayOutMapChunk = PacketUtils.classByName("net.minecraft.network.protocol.game", "PacketPlayOutMapChunk");
|
||||
chunkClass = PacketUtils.classByName("net.minecraft.world.level.chunk", "Chunk");
|
||||
|
||||
try {
|
||||
chunkHandleMethod = Chunk.class.getMethod("getHandle");
|
||||
} catch(NoSuchMethodException exc) {
|
||||
}
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17_R1)) {
|
||||
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17)) {
|
||||
try {
|
||||
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(PacketUtils.classByName("net.minecraft.world.level.chunk", "LevelChunk"));
|
||||
} catch(NoSuchMethodException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
try {
|
||||
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(chunkClass);
|
||||
} catch(NoSuchMethodException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (NoSuchMethodException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,38 +58,39 @@ public class ChunkManager {
|
||||
}
|
||||
|
||||
public static void sendMapChunk(Player player, Chunk chunk) {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_18_R1)) {
|
||||
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_18)) {
|
||||
return; // Should just use World#refreshChunk instead
|
||||
}
|
||||
|
||||
try {
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17_R1)) {
|
||||
Method chunkHandleMethod = chunk.getClass().getMethod("getHandle");
|
||||
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17)) {
|
||||
PacketUtils.sendPacket(player, mapChunkConstructor.newInstance(chunkHandleMethod.invoke(chunk)));
|
||||
return;
|
||||
}
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_16_R1)) {
|
||||
if(mapChunkConstructor == null)
|
||||
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_16)) {
|
||||
if (mapChunkConstructor == null)
|
||||
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(chunkClass, int.class, boolean.class);
|
||||
|
||||
PacketUtils.sendPacket(player, mapChunkConstructor.newInstance(chunkHandleMethod.invoke(chunk), 65535, false));
|
||||
return;
|
||||
}
|
||||
|
||||
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_10_R2)) {
|
||||
if(mapChunkConstructor == null)
|
||||
if (ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_10)) {
|
||||
if (mapChunkConstructor == null)
|
||||
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(chunkClass, boolean.class, int.class);
|
||||
|
||||
PacketUtils.sendPacket(player, mapChunkConstructor.newInstance(chunkHandleMethod.invoke(chunk), true, 65535));
|
||||
return;
|
||||
}
|
||||
|
||||
if(mapChunkConstructor == null)
|
||||
if (mapChunkConstructor == null)
|
||||
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(chunkClass, int.class);
|
||||
|
||||
PacketUtils.sendPacket(player, mapChunkConstructor.newInstance(chunkHandleMethod.invoke(chunk), 65535));
|
||||
} catch(ReflectiveOperationException exception) {
|
||||
exception.printStackTrace();
|
||||
} catch (ReflectiveOperationException exception) {
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package plugily.projects.buildbattle.handlers.misc;
|
||||
|
||||
import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.minigamesbox.classic.utils.configuration.ConfigUtils;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* @author Tigerpanzer_02
|
||||
* <p>
|
||||
* Created at 09.07.2025
|
||||
*/
|
||||
public class HeadDatabaseManager {
|
||||
|
||||
private final Main plugin;
|
||||
private final ArrayList<String> headCatalog = new ArrayList<>(Arrays.asList("alphabet", "animals", "blocks", "decoration", "food-drinks", "humanoid", "humans", "miscellaneous", "monsters", "plants"));
|
||||
|
||||
public HeadDatabaseManager(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
try(Scanner scanner = new Scanner(requestHeadFetch(null), "UTF-8").useDelimiter("\\A")) {
|
||||
String data = scanner.hasNext() ? scanner.next() : "";
|
||||
File file = new File(plugin.getDataFolder().getPath() + "/heads/database/head_data.yml");
|
||||
if(!file.exists()) {
|
||||
new File(plugin.getDataFolder().getPath() + "/heads/").mkdir();
|
||||
new File(plugin.getDataFolder().getPath() + "/heads/database/").mkdir();
|
||||
if(!file.createNewFile()) {
|
||||
plugin.getDebugger().debug(Level.WARNING, "Couldn't create heads folder! We must disable heads support.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Files.write(file.toPath(), data.getBytes());
|
||||
plugin.getDebugger().debug(Level.WARNING, "Fetched latest heads file from repository.");
|
||||
} catch(IOException ignored) {
|
||||
//ignore exceptions
|
||||
plugin.getDebugger().debug(Level.WARNING, "Couldn't access heads fetcher service or there is other problem! You should notify author!");
|
||||
}
|
||||
}
|
||||
|
||||
public DownloadStatus getDatabase(String databaseName) {
|
||||
if(!headCatalog.contains(databaseName)) {
|
||||
return DownloadStatus.FAIL;
|
||||
}
|
||||
return download(plugin, databaseName);
|
||||
}
|
||||
|
||||
public ArrayList<String> getHeadCatalog() {
|
||||
return headCatalog;
|
||||
}
|
||||
|
||||
private DownloadStatus download(Main plugin, String name) {
|
||||
DownloadStatus status = demandHeadDownload(name);
|
||||
if(status == DownloadStatus.FAIL) {
|
||||
plugin.getDebugger().debug(Level.WARNING, "&cHeads service couldn't download latest heads for plugin! Reduced heads will be used instead!");
|
||||
} else if(status == DownloadStatus.SUCCESS) {
|
||||
plugin.getDebugger().debug(Level.WARNING, "&aDownloaded heads " + name + " properly!");
|
||||
} else if(status == DownloadStatus.LATEST) {
|
||||
plugin.getDebugger().debug(Level.WARNING, "&aHeads " + name + " is latest! Awesome!");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
private InputStream requestHeadFetch(String head) {
|
||||
try {
|
||||
URL url = new URL("https://api.plugily.xyz/onlineservices/v1/fetch.php");
|
||||
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("User-Agent", "PlugilyProjectsOnlineServices/1.0");
|
||||
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
conn.setRequestProperty("Accept-Charset", "UTF-8");
|
||||
conn.setDoOutput(true);
|
||||
|
||||
OutputStream os = conn.getOutputStream();
|
||||
if(head == null) {
|
||||
os.write(("pass=onlineservice").getBytes("UTF-8"));
|
||||
} else {
|
||||
os.write(("pass=onlineservice&head=" + head).getBytes("UTF-8"));
|
||||
}
|
||||
os.flush();
|
||||
os.close();
|
||||
return conn.getInputStream();
|
||||
} catch(IOException e) {
|
||||
plugin.getDebugger().debug(Level.SEVERE, "Could not fetch heads from plugily.xyz api! Cause: {0} ({1})", new Object[]{e.getCause(), e.getMessage()});
|
||||
return new InputStream() {
|
||||
@Override
|
||||
public int read() {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private DownloadStatus demandHeadDownload(String head) {
|
||||
File headFile = new File(plugin.getDataFolder() + "/heads/database/" + head + ".yml");
|
||||
if(!headFile.exists() || !isExact(head, headFile)) {
|
||||
return writeFile(head);
|
||||
}
|
||||
return DownloadStatus.LATEST;
|
||||
}
|
||||
|
||||
private boolean isExact(String head, File file) {
|
||||
try(Scanner scanner = new Scanner(requestHeadFetch(head), "UTF-8").useDelimiter("\\A");
|
||||
Scanner localScanner = new Scanner(file, "UTF-8").useDelimiter("\\A")) {
|
||||
String onlineData = scanner.hasNext() ? scanner.next() : "";
|
||||
String localData = localScanner.hasNext() ? localScanner.next() : "";
|
||||
|
||||
return onlineData.equals(localData);
|
||||
} catch(IOException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private DownloadStatus writeFile(String head) {
|
||||
try(Scanner scanner = new Scanner(requestHeadFetch(head), "UTF-8").useDelimiter("\\A")) {
|
||||
String data = scanner.hasNext() ? scanner.next() : "";
|
||||
try(OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(plugin.getDataFolder().getPath() + "/heads/database/" + head + ".yml"), "UTF-8")) {
|
||||
writer.write(data);
|
||||
}
|
||||
return DownloadStatus.SUCCESS;
|
||||
} catch(IOException ignored) {
|
||||
plugin.getDebugger().debug(Level.WARNING, "Demanded head " + head + " cannot be downloaded! You should notify author!");
|
||||
return DownloadStatus.FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
[ARCHIVE] Convert Heads with Json to YML Code
|
||||
private void loadFileFromJSONde(String input) {
|
||||
long start = System.currentTimeMillis();
|
||||
JsonElement element = getJsonElement("https://raw.githubusercontent.com/Plugily-Projects/online-services/refs/heads/master/buildbattle/headdatabase/raw/" + input + ".yml");
|
||||
or
|
||||
JsonElement element = getJsonElement("https://minecraft-heads.com/scripts/api.php?cat=decoration");
|
||||
if(element == null) {
|
||||
return;
|
||||
}
|
||||
JsonArray outputJson = element.getAsJsonArray();
|
||||
AtomicInteger i = new AtomicInteger();
|
||||
i.set(0);
|
||||
outputJson.forEach(categoryElement -> {
|
||||
JsonObject category = categoryElement.getAsJsonObject();
|
||||
if(category.get("name") == null) {
|
||||
return;
|
||||
}
|
||||
if(category.get("value") == null) {
|
||||
return;
|
||||
}
|
||||
String name = category.get("name").getAsString();
|
||||
String value = category.get("value").getAsString();
|
||||
if(heads.get(name) != null) {
|
||||
heads.put(name + " (dup) " + i.get(), value);
|
||||
i.getAndIncrement();
|
||||
} else
|
||||
heads.put(name, value);
|
||||
});
|
||||
System.out.println(heads);
|
||||
FileConfiguration categoryConfig = ConfigUtils.getConfig(plugin, "heads/menus/hd/" + input);
|
||||
for(Map.Entry<String, String> entry : heads.entrySet()) {
|
||||
// System.out.println("Trying to save -> " + entry.getKey() + " "+ entry.getValue());
|
||||
categoryConfig.set(entry.getKey().replace(".", " "), entry.getValue());
|
||||
}
|
||||
ConfigUtils.saveConfig(plugin, categoryConfig, "heads/menus/hd/" + input);
|
||||
System.out.println("[System] [Plugin] Head finished took ms" + (System.currentTimeMillis() - start));
|
||||
heads.clear();
|
||||
}
|
||||
|
||||
private final String USER_AGENT = "Plugily Projects Converter v1";
|
||||
|
||||
public JsonElement getJsonElement(String fullURL) {
|
||||
try {
|
||||
URL url = new URL(fullURL);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.addRequestProperty("User-Agent", USER_AGENT);
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
InputStreamReader reader = new InputStreamReader(inputStream);
|
||||
return new JsonParser().parse(reader);
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public enum DownloadStatus {
|
||||
SUCCESS, FAIL, LATEST
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ package plugily.projects.buildbattle.handlers.setup;
|
||||
import org.bukkit.entity.Player;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.GuessArena;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.handlers.setup.categories.PluginSpecificCategory;
|
||||
import plugily.projects.minigamesbox.classic.handlers.setup.items.category.CountItem;
|
||||
import plugily.projects.minigamesbox.classic.handlers.setup.items.category.MultiLocationItem;
|
||||
@@ -52,8 +53,20 @@ public class SpecificCategory extends PluginSpecificCategory {
|
||||
getItemList().add(gamePlot);
|
||||
|
||||
MultiLocationItem floorNPC = new MultiLocationItem(getSetupInventory(), new ItemBuilder(XMaterial.VILLAGER_SPAWN_EGG.parseMaterial()), "Floor Changer NPC", "Add floor changer NPC to your plot.\nRequires Citizens plugin! Runs addnpc command", "floornpc", 0, event -> {
|
||||
((Player) event.getWhoClicked()).performCommand("bba addnpc");
|
||||
switch (event.getClick()) {
|
||||
case LEFT:
|
||||
((Player) event.getWhoClicked()).performCommand("bba addnpc");
|
||||
}
|
||||
}, interactEvent -> {
|
||||
switch (interactEvent.getAction()) {
|
||||
case PHYSICAL:
|
||||
case LEFT_CLICK_AIR:
|
||||
interactEvent.getPlayer().performCommand("bba addnpc");
|
||||
(new MessageBuilder("&cPlease keep in mind to use blocks instead of player location for precise coordinates!")).prefix().send(interactEvent.getPlayer());
|
||||
break;
|
||||
case LEFT_CLICK_BLOCK:
|
||||
interactEvent.getPlayer().performCommand("bba addnpc");
|
||||
}
|
||||
});
|
||||
gui.setItem((getInventoryLine() * 9) + 2, floorNPC);
|
||||
getItemList().add(floorNPC);
|
||||
|
||||
+16
-6
@@ -20,18 +20,28 @@
|
||||
|
||||
package plugily.projects.buildbattle.handlers.themes;
|
||||
|
||||
public class BBTheme {
|
||||
import java.util.ArrayList;
|
||||
|
||||
private final String theme;
|
||||
public class GuessTheme {
|
||||
|
||||
private final ArrayList<String> themes;
|
||||
private final Difficulty difficulty;
|
||||
|
||||
public BBTheme(String theme, Difficulty difficulty) {
|
||||
this.theme = theme == null ? "" : theme;
|
||||
public GuessTheme(ArrayList<String> themes, Difficulty difficulty) {
|
||||
this.themes = themes;
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
public String getTheme() {
|
||||
return theme;
|
||||
public ArrayList<String> getThemes() {
|
||||
return themes;
|
||||
}
|
||||
|
||||
public String getThemesAsString() {
|
||||
return String.join(", ", themes);
|
||||
}
|
||||
|
||||
public String getDefaultTheme() {
|
||||
return themes.get(0);
|
||||
}
|
||||
|
||||
public Difficulty getDifficulty() {
|
||||
@@ -160,7 +160,7 @@ public class ThemeManager {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static GameThemes getByDifficulty(BBTheme.Difficulty difficulty) {
|
||||
public static GameThemes getByDifficulty(GuessTheme.Difficulty difficulty) {
|
||||
switch(difficulty) {
|
||||
case EASY:
|
||||
return GUESS_THE_BUILD_EASY;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
package plugily.projects.buildbattle.handlers.themes.vote;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
@@ -33,21 +32,19 @@ import plugily.projects.buildbattle.Main;
|
||||
import plugily.projects.buildbattle.arena.BaseArena;
|
||||
import plugily.projects.buildbattle.arena.BuildArena;
|
||||
import plugily.projects.buildbattle.handlers.themes.ThemeManager;
|
||||
import plugily.projects.minigamesbox.classic.arena.ArenaState;
|
||||
import plugily.projects.minigamesbox.api.arena.IArenaState;
|
||||
import plugily.projects.minigamesbox.api.user.IUser;
|
||||
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
|
||||
import plugily.projects.minigamesbox.classic.user.User;
|
||||
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XEnchantment;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XItemFlag;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
|
||||
import plugily.projects.minigamesbox.classic.utils.version.xseries.inventory.XInventoryView;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.ClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
|
||||
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@@ -102,12 +99,12 @@ public class VoteMenu {
|
||||
NormalFastInv gui = new NormalFastInv(9 * themeSelection.size(), new MessageBuilder("MENU_THEME_INVENTORY").asKey().build());
|
||||
|
||||
gui.addCloseHandler(event -> {
|
||||
if(arena.getArenaState() == ArenaState.IN_GAME && arena.getArenaInGameState() == BaseArena.ArenaInGameState.THEME_VOTING) {
|
||||
if(arena.getArenaState() == IArenaState.IN_GAME && arena.getArenaInGameState() == BaseArena.ArenaInGameState.THEME_VOTING) {
|
||||
plugin.getServer().getScheduler().runTask(plugin, () -> {
|
||||
HumanEntity humanEntity = event.getPlayer();
|
||||
Inventory inventory = event.getInventory();
|
||||
|
||||
if(humanEntity.getOpenInventory().getTopInventory() != inventory) {
|
||||
if(XInventoryView.of(humanEntity.getOpenInventory()).getTopInventory() != inventory) {
|
||||
humanEntity.openInventory(inventory);
|
||||
}
|
||||
});
|
||||
@@ -130,25 +127,30 @@ public class VoteMenu {
|
||||
|
||||
setGlassPanes(gui, multiplied, percent);
|
||||
|
||||
gui.setItem(multiplied + 8, new SimpleClickableItem(new ItemBuilder(new ItemStack(Material.PAPER))
|
||||
.name(new MessageBuilder("MENU_THEME_VOTE_SUPER_ITEM_NAME").asKey().arena(arena).value(theme).build())
|
||||
.lore(new MessageBuilder("MENU_THEME_VOTE_SUPER_ITEM_LORE").asKey().player(guiPlayer).arena(arena).value(theme).build().split(";"))
|
||||
.build(), event -> {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
if (plugin.getConfigPreferences().getOption("SUPER_VOTES")) {
|
||||
gui.setItem(multiplied + 8, new SimpleClickableItem(new ItemBuilder(new ItemStack(Material.PAPER))
|
||||
.name(new MessageBuilder("MENU_THEME_VOTE_SUPER_ITEM_NAME").asKey().arena(arena).value(theme).build())
|
||||
.lore(new MessageBuilder("MENU_THEME_VOTE_SUPER_ITEM_LORE").asKey().player(guiPlayer).arena(arena).value(theme).build().split(";"))
|
||||
.build(), event -> {
|
||||
HumanEntity humanEntity = event.getWhoClicked();
|
||||
|
||||
if(!(humanEntity instanceof Player))
|
||||
return;
|
||||
if(!(humanEntity instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) humanEntity;
|
||||
User user = plugin.getUserManager().getUser(player);
|
||||
Player player = (Player) humanEntity;
|
||||
IUser user = plugin.getUserManager().getUser(player);
|
||||
|
||||
if(user.getStatistic("SUPER_VOTES") > 0) {
|
||||
user.adjustStatistic("SUPER_VOTES", -1);
|
||||
new MessageBuilder("MENU_THEME_VOTE_SUPER_USED").asKey().arena(arena).player(player).value(theme).sendArena();
|
||||
arena.setTheme(theme);
|
||||
arena.setTimer(0, true);
|
||||
}
|
||||
}));
|
||||
if(user.getStatistic("SUPER_VOTES") > 0) {
|
||||
user.adjustStatistic("SUPER_VOTES", -1);
|
||||
new MessageBuilder("MENU_THEME_VOTE_SUPER_USED").asKey().arena(arena).player(player).value(theme).sendArena();
|
||||
arena.setTheme(theme);
|
||||
arena.setTimer(0, true);
|
||||
}
|
||||
}));
|
||||
}
|
||||
else {
|
||||
gui.setItem(multiplied + 8, ClickableItem.of(new ItemBuilder(XMaterial.IRON_BARS.parseItem()).name("&7<-").colorizeItem().build()));
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -183,7 +185,7 @@ public class VoteMenu {
|
||||
ItemBuilder itemBuilder = new ItemBuilder(clickableSignItem.getItem()).removeLore();
|
||||
itemBuilder.lore(new MessageBuilder("MENU_THEME_ITEM_LORE").asKey().arena(arena).value(theme).integer((int) percent).build().split(";"));
|
||||
if(theme.equals(playerVote)) {
|
||||
itemBuilder.enchantment(Enchantment.DAMAGE_ALL, 1).flags(ItemFlag.HIDE_ENCHANTS);
|
||||
itemBuilder.enchantment(XEnchantment.UNBREAKING.get(), 1).flags(XItemFlag.HIDE_ENCHANTS.get());
|
||||
} else {
|
||||
itemBuilder.removeEnchants().removeFlags();
|
||||
}
|
||||
@@ -215,10 +217,10 @@ public class VoteMenu {
|
||||
int slot = multiplied + 2 + j;
|
||||
|
||||
if(vote > percent) {
|
||||
gui.setItem(slot, ClickableItem.of(new ItemBuilder(XMaterial.RED_STAINED_GLASS_PANE.parseItem()).name("").build()));
|
||||
gui.setItem(slot, ClickableItem.of(new ItemBuilder(XMaterial.RED_STAINED_GLASS_PANE.parseItem()).name("???").build()));
|
||||
continue;
|
||||
}
|
||||
gui.setItem(slot, ClickableItem.of(new ItemBuilder(XMaterial.LIME_STAINED_GLASS_PANE.parseItem()).name("").build()));
|
||||
gui.setItem(slot, ClickableItem.of(new ItemBuilder(XMaterial.LIME_STAINED_GLASS_PANE.parseItem()).name("???").build()));
|
||||
vote += 16.7;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
# Available localizations:
|
||||
# default - English language. Uses 'language.yml'.
|
||||
# See https://github.com/Plugily-Projects/locale_storage/tree/master/plugins/minecraft/buildbattle
|
||||
# Help us translate the project -> https://translate.plugily.xyz
|
||||
# Use filename of the language e.g. de_DE.yml -> locale: de_DE
|
||||
locale: default
|
||||
|
||||
@@ -49,14 +50,10 @@ Commands:
|
||||
Executes: "buildbattle leave"
|
||||
Enabled: true
|
||||
'3':
|
||||
Short: "kit"
|
||||
Executes: "buildbattle selectkit"
|
||||
Enabled: false
|
||||
'4':
|
||||
Short: "stats"
|
||||
Executes: "buildbattle stats"
|
||||
Enabled: false
|
||||
'5':
|
||||
'4':
|
||||
Short: "top"
|
||||
Executes: "buildbattle top"
|
||||
Enabled: true
|
||||
@@ -71,6 +68,18 @@ Block:
|
||||
Leave: false
|
||||
# Cancels Item Movement into player crafting, enchantment tables, anvils ...
|
||||
Item-Move: true
|
||||
ArmorStand:
|
||||
# Should we block armor stand destroy with double click?
|
||||
Destroy: true
|
||||
# Should we block armor stand interaction?
|
||||
Interact: true
|
||||
# Should these only be blocked while ingame and arena state is in_game? (e.g. Lobby and Ending is blocked)
|
||||
# Setting it to false means on all stages of the game the event will be cancelled.
|
||||
# Setting it to true means only while IN_GAME the event will be cancelled.
|
||||
Check: true
|
||||
# Should all interactions with interactive materials such as doors / buttons / fences / redstone be blocked during ingame
|
||||
# Full list see https://github.com/CryptoMorin/XSeries/blob/e84000a2bead7367d893cf8661f8d5432116adaa/core/src/main/java/com/cryptomorin/xseries/XTag.java#L2793
|
||||
Interact: false
|
||||
|
||||
|
||||
# Enable this option when you're using MySQL, otherwise it won't work.
|
||||
@@ -82,16 +91,18 @@ Database: false
|
||||
|
||||
# Should we enable in game rewards? See rewards.yml for more...
|
||||
# You should also check out our script engine tutorial for rewards! https://tutorial.plugily.xyz
|
||||
Rewards: true
|
||||
Rewards: false
|
||||
|
||||
|
||||
# Enable in game (eg. '[KIT][LEVEL] Tigerpanzer_02: hey') special formatting?
|
||||
# Formatting is configurable in old_language.yml
|
||||
# You can use PlaceholderAPI placeholders in chat format!
|
||||
Plugin-Chat-Format: true
|
||||
# Enable the super votes in the theme vote menu
|
||||
Super-Votes: true
|
||||
|
||||
|
||||
Chat:
|
||||
# Enable in game (eg. '[KIT][LEVEL] Tigerpanzer_02: hey') special formatting?
|
||||
# Formatting is configurable in language.yml
|
||||
# You can use PlaceholderAPI placeholders in chat format!
|
||||
Format: true
|
||||
Separate:
|
||||
# Should we enable a separate arena chat for players inside a arena
|
||||
# Useful on multi arena servers that don't want the same chat for all players on the server
|
||||
@@ -142,7 +153,8 @@ Damage:
|
||||
Drowning: false
|
||||
# Should players get fire damage?
|
||||
Fire: false
|
||||
|
||||
# Should players lose food ingame & get damage?
|
||||
Hunger: false
|
||||
|
||||
Cycle:
|
||||
# Should we make permanent clear weather on all worlds where our arenas are?
|
||||
@@ -192,8 +204,8 @@ Time-Manager:
|
||||
|
||||
|
||||
Mob:
|
||||
# Should mob spawning on arenas be enabled?
|
||||
Spawn: false
|
||||
# Should mob spawning on arenas be enabled? (Contains Armour Stands)
|
||||
Spawn: true
|
||||
# The list of restricted entities that can't be spawned in game
|
||||
Restricted:
|
||||
- wither
|
||||
@@ -239,7 +251,7 @@ Items:
|
||||
# Enable another Head menu instead of our
|
||||
Head-Menu:
|
||||
Custom: false
|
||||
# The command that should be executed on the player
|
||||
# The command that should be executed on the player if Head-Menu.Custom = true
|
||||
Command: heads
|
||||
|
||||
|
||||
@@ -275,4 +287,4 @@ Update-Notifier:
|
||||
# You edited it, huh? Next time hurt yourself!
|
||||
Do-Not-Edit:
|
||||
File-Version: 1
|
||||
Core-Version: 2
|
||||
Core-Version: 6
|
||||
@@ -1,13 +1,13 @@
|
||||
animals:
|
||||
displayname: '&6Animal heads'
|
||||
simple-animals:
|
||||
displayname: '&6Simple Animal heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjIxNjY4ZWY3Y2I3OWRkOWMyMmNlM2QxZjNmNGNiNmUyNTU5ODkzYjZkZjRhNDY5NTE0ZTY2N2MxNmFhNCJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "animal heads menu"
|
||||
- "simple animal heads menu"
|
||||
enabled: true
|
||||
config: animalheads
|
||||
permission: buildbattle.heads
|
||||
menuname: "Animal heads"
|
||||
menuname: "Simple Animal heads"
|
||||
miniblocks:
|
||||
displayname: '&6Mini block heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzI4YTE4MTU2ODlkNzE5NGNmN2RiMDYxYjU5ZjYzMTA2MjY0YjUxMzg3OTc2YTdmYjc0YWI3OWI1NjQxIn19fQ=="
|
||||
@@ -28,3 +28,138 @@ info:
|
||||
config: info
|
||||
permission: buildbattle.heads
|
||||
menuname: "Info blocks"
|
||||
|
||||
# Use HeadDatabase in addition to the configured ones
|
||||
# You can remove categories from the catalog which shouldn't be loaded!
|
||||
# Catalog:
|
||||
# - alphabet
|
||||
# - animals
|
||||
# - blocks
|
||||
# - decoration
|
||||
# - food-drinks
|
||||
# - humanoid
|
||||
# - humans
|
||||
# - miscellaneous
|
||||
# - monsters
|
||||
# - plants
|
||||
database-alphabet:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzI1MDhlMmNhNjUwMGJjZTMwNTM5YzM4ODg0MmE1NjcyYjdiYzI5YTY4NzZkZDZhNTAyNTY3MmUyNTJkMjVkYSJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: alphabet
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-animals:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTQyYjllYzM0OTYwNjRiMDg1ZjdkMzBjZTkwYTBjOGY3NjM2YzhlZjUzMDNiMjBjMjVjYTEwYTk5N2JkNzQzMyJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: animals
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-blocks:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzViNDQ4ZmQ5NWM4NzRjOTVmZTc0ODQ0NDFhNDM5NGQ2NDZiNzJiYzgyYTUyNzQ4M2ZkYzcwY2E3OTg2ZmNhNSJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: blocks
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-decoration:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjNhZjk0YTUwZmFmNTBhZTAyMzZjNzExZWMxMzZiMjgwOGFjODJiYjE3MWQ0MmIzOGQxNjc2MGQyMjBmMjU4MiJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: decoration
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-food-drinks:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDUxMzdmYzBjZDUxMjAyNjcyMzgyYmZhZTAxZmViM2UxZTJiNzMxMDdlOThkMmM2YzhmNzE5ZjFkYTUzMGU2OCJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: food-drinks
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-humanoid:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTc5Yzc3ZjEyYzg2NzM5OGE0MTgxMDgxZmI1YmY3MGM1ZmYzMjcxNWM2ODk3NTBjNmU3MTdkMDY5ZTgxMzFhOSJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: humanoid
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-humans:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDQ5MmRmZTNjZThjYjYxYjkwODYwZWZmOTM4Y2I4M2UxOWMxNmU5Y2IyZDliZjJhZDc4OTZjOTBmNWIyZTFmMCJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: humans
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-miscellaneous:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDQ3OTE3MTkzZTlmYjdjYjk2OGZiYTAzYTJlMjg0YTA0NjEyMWIyZGMwMTU0MWNhY2RiYTUzYTRmOWJiZjcwOCJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: miscellaneous
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-monsters:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTgyYjQxZjY3YjMzNzE0NWM1ZWI4M2I5ZTAwMTU1NzQ4MDE2MGE1NWU5MWVmODYzZWIwYmYwNTU3Mzg0MmNlMSJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: monsters
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-plants:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDA4MzY2YjgxMWM0MzU5YWVhNjY4NjMwMGNmZDQ1MGQ5ZWFhNDYxNGMzYWYwOGExN2YxNTEzZjVkMmY0OGM0YSJ9fX0="
|
||||
lore:
|
||||
- "Click to open"
|
||||
- "%value% menu"
|
||||
enabled: true
|
||||
database: true
|
||||
config: plants
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
database-search:
|
||||
displayname: '&6%value% heads'
|
||||
texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjViOTVkYTEyODE2NDJkYWE1ZDAyMmFkYmQzZTdjYjY5ZGMwOTQyYzgxY2Q2M2JlOWMzODU3ZDIyMmUxYzhkOSJ9fX0="
|
||||
lore:
|
||||
- "Click to search"
|
||||
- "for a head (english only!)"
|
||||
enabled: true
|
||||
database: true
|
||||
config: search
|
||||
permission: buildbattle.heads
|
||||
menuname: "%value% blocks"
|
||||
@@ -231,7 +231,7 @@ In-Game:
|
||||
# Join cancelled via external plugin that uses the API of our plugin.
|
||||
Cancelled-Via-API: "%color_chat_issue%%plugin_prefix% You can't join this game!"
|
||||
As-Party-Member: "%color_chat_issue%%plugin_prefix% You joined %arena_name% because the party leader joined it!"
|
||||
Arena-Not-Configured: "%color_chat_issue%%plugin_prefix% BaseArena is not configured yet! Contact staff!"
|
||||
Arena-Not-Configured: "%color_chat_issue%%plugin_prefix% BaseArena is not configured yet! Contact your server's staff!"
|
||||
Title: "20,30,20;%arena_name%;%arena_players_size%/%arena_max_players%"
|
||||
Death:
|
||||
Tag: "&8Dead"
|
||||
@@ -293,7 +293,7 @@ In-Game:
|
||||
Own: "&aYou became #%number%"
|
||||
Admin:
|
||||
Set-Starting-In-To-0: "%plugin_prefix% An admin set waiting time to 0. The game starts now!"
|
||||
Changed-Theme: "%plugin_prefix% Admin has changed theme to %THEME%"
|
||||
Changed-Theme: "%plugin_prefix% Admin has changed theme to %value%"
|
||||
Plot:
|
||||
Nobody: "%color_chat_issue%Nobody"
|
||||
Time-Left:
|
||||
@@ -377,6 +377,8 @@ Menu:
|
||||
Item:
|
||||
Name: "&bGet player heads"
|
||||
Lore: "Click to get heads"
|
||||
Database:
|
||||
Lore: "Get Head %value%"
|
||||
Floor:
|
||||
Item:
|
||||
Name: "&bChange floor material"
|
||||
@@ -393,7 +395,7 @@ Menu:
|
||||
Noon: "Noon (6000 ticks)"
|
||||
Sunset: "Sunset (12000 ticks)"
|
||||
Night: "Night (13000 ticks)"
|
||||
MidNight: "MidNight (18000 ticks)"
|
||||
MidNight: "Midnight (18000 ticks)"
|
||||
Sunrise: "Sunrise (23000 ticks)"
|
||||
Changed: "%plugin_prefix% Time has been changed to %value%"
|
||||
Biome:
|
||||
@@ -571,5 +573,5 @@ Leaderboard:
|
||||
# Really, don't edit ;p
|
||||
# You edited it, huh? Next time hurt yourself!
|
||||
Do-Not-Edit:
|
||||
File-Version: 1
|
||||
Core-Version: 1
|
||||
File-Version: 2
|
||||
Core-Version: 2
|
||||
@@ -228,7 +228,7 @@ In-Game:
|
||||
# Join cancelled via external plugin that uses the API of our plugin.
|
||||
Cancelled-Via-API: "%color_chat_issue%%plugin_prefix% You can't join this game!"
|
||||
As-Party-Member: "%color_chat_issue%%plugin_prefix% You joined %arena_name% because the party leader joined it!"
|
||||
Arena-Not-Configured: "%color_chat_issue%%plugin_prefix% BaseArena is not configured yet! Contact staff!"
|
||||
Arena-Not-Configured: "%color_chat_issue%%plugin_prefix% BaseArena is not configured yet! Contact your server's staff!"
|
||||
Title: "20,30,20;%arena_name%;%arena_players_size%/%arena_max_players%"
|
||||
Death:
|
||||
Tag: "&8Dead"
|
||||
@@ -290,7 +290,7 @@ In-Game:
|
||||
Own: "&aYou became #%number%"
|
||||
Admin:
|
||||
Set-Starting-In-To-0: "%plugin_prefix% An admin set waiting time to 0. The game starts now!"
|
||||
Changed-Theme: "%plugin_prefix% Admin has changed theme to %THEME%"
|
||||
Changed-Theme: "%plugin_prefix% Admin has changed theme to %value%"
|
||||
Plot:
|
||||
Nobody: "%color_chat_issue%Nobody"
|
||||
Time-Left:
|
||||
@@ -374,6 +374,8 @@ Menu:
|
||||
Item:
|
||||
Name: "&bGet player heads"
|
||||
Lore: "Click to get heads"
|
||||
Database:
|
||||
Lore: "Get Head %value%"
|
||||
Floor:
|
||||
Item:
|
||||
Name: "&bChange floor material"
|
||||
@@ -390,7 +392,7 @@ Menu:
|
||||
Noon: "Noon (6000 ticks)"
|
||||
Sunset: "Sunset (12000 ticks)"
|
||||
Night: "Night (13000 ticks)"
|
||||
MidNight: "MidNight (18000 ticks)"
|
||||
MidNight: "Midnight (18000 ticks)"
|
||||
Sunrise: "Sunrise (23000 ticks)"
|
||||
Changed: "%plugin_prefix% Time has been changed to %value%"
|
||||
Biome:
|
||||
@@ -568,5 +570,5 @@ Leaderboard:
|
||||
# Really, don't edit ;p
|
||||
# You edited it, huh? Next time hurt yourself!
|
||||
Do-Not-Edit:
|
||||
File-Version: 1
|
||||
Core-Version: 1
|
||||
File-Version: 2
|
||||
Core-Version: 2
|
||||
@@ -1,4 +1,4 @@
|
||||
name: ${description}
|
||||
name: BuildBattle
|
||||
main: plugily.projects.buildbattle.Main
|
||||
authors: [ PlugilyProjects, Tigerpanzer_02, Tigerpanzer, Plajer, TomTheDeveloper ]
|
||||
version: ${version}
|
||||
@@ -8,11 +8,11 @@ api-version: 1.13
|
||||
commands:
|
||||
buildbattle:
|
||||
description: BuildBattle Commands
|
||||
usage: "\u00A76Correct usage: /bb [option]"
|
||||
usage: "§6Correct usage: /bb [option]"
|
||||
aliases: [ bb, buildb ]
|
||||
buildbattleadmin:
|
||||
description: BuildBattle Admin Commands
|
||||
usage: "\u00A76Correct usage: /bba [option]"
|
||||
usage: "§6Correct usage: /bba [option]"
|
||||
aliases: [ bba, buildbadmin ]
|
||||
|
||||
permissions:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# BuildBattle rewards configuration
|
||||
#
|
||||
# Placeholders list:
|
||||
# %PLAYER% - Current player name
|
||||
# %player% - Current player name
|
||||
# %MAPNAME% - Name of map
|
||||
# %ARENA-ID% - BaseArena Identifier
|
||||
# %PLACE% - Player Place (Working on category place)
|
||||
@@ -17,11 +17,11 @@
|
||||
# - chance(1):p:say I was very lucky! # Player has 1% chance to say "I was very lucky!"
|
||||
# - p:chance(99):spawn # Player has 99% chance to teleport to spawn
|
||||
# ^ YOU CAN EVEN SWAP CHANCE WITH PLAYER!
|
||||
# - chance(50):eco give %PLAYER% 10 # Console has 10% chance to give player 10$
|
||||
# - chance(50):eco give %player% 10 # Console has 10% chance to give player 10$
|
||||
#
|
||||
# You can unlock full potential of rewards using our script engine! (since 4.0.0)
|
||||
# Just add example reward:
|
||||
# - script:player.sendMessage("oh, hi %PLAYER%"); # It will send "oh, hi <player name>" to player! 100% plain java!
|
||||
# - script:player.sendMessage("oh, hi %player%"); # It will send "oh, hi <player name>" to player! 100% plain java!
|
||||
# - script:server.broadcastMessage("hello everyone"); # Broadcasts "hello everyone" to whole server
|
||||
# - script:player.getInventory().addItem(new org.bukkit.inventory.ItemStack(org.bukkit.Material.DIRT));
|
||||
# ^ Gives player dirt item (you must always use direct package names for not provided objects)
|
||||
@@ -50,40 +50,40 @@ rewards:
|
||||
# Commands performed when all themes are guessed in GTB
|
||||
# Delete everything if you don't want to use this section
|
||||
guess:
|
||||
- eco give %PLAYER% 2
|
||||
- eco give %player% 2
|
||||
guess-all:
|
||||
- eco give %PLAYER% 2
|
||||
- eco give %player% 2
|
||||
# Commands executed when someone vote
|
||||
vote:
|
||||
- eco give %PLAYER% 2
|
||||
- chance(10):eco give %PLAYER% 8
|
||||
- eco give %player% 2
|
||||
- chance(10):eco give %player% 8
|
||||
# Commands executed when all voted for a plot
|
||||
vote-all:
|
||||
- eco give %PLAYER% 2
|
||||
- chance(10):eco give %PLAYER% 8
|
||||
- eco give %player% 2
|
||||
- chance(10):eco give %player% 8
|
||||
# Commands executed when someone report a building
|
||||
report:
|
||||
- eco give %PLAYER% 2
|
||||
- eco give %player% 2
|
||||
- script:player.sendMessage("You reported the building");
|
||||
# Commands executed on place X
|
||||
place:
|
||||
1:
|
||||
- eco give %PLAYER% 10
|
||||
- eco give %player% 10
|
||||
2:
|
||||
- eco give %PLAYER% 9
|
||||
- eco give %player% 9
|
||||
3:
|
||||
- eco give %PLAYER% 8
|
||||
- eco give %player% 8
|
||||
4:
|
||||
- eco give %PLAYER% 7
|
||||
- eco give %player% 7
|
||||
5:
|
||||
- eco give %PLAYER% 6
|
||||
- eco give %player% 6
|
||||
6:
|
||||
- eco give %PLAYER% 5
|
||||
- eco give %player% 5
|
||||
7:
|
||||
- eco give %PLAYER% 4
|
||||
- eco give %player% 4
|
||||
8:
|
||||
- eco give %PLAYER% 3
|
||||
- eco give %player% 3
|
||||
9:
|
||||
- eco give %PLAYER% 2
|
||||
- eco give %player% 2
|
||||
10:
|
||||
- eco give %PLAYER% 1
|
||||
- eco give %player% 1
|
||||
@@ -121,7 +121,7 @@ Back-To-Hub:
|
||||
Options-Menu:
|
||||
permission: ""
|
||||
execute:
|
||||
- ""
|
||||
- "p:bb menu"
|
||||
displayname: "&a&lOptions menu &7(Right Click)"
|
||||
lore:
|
||||
- "&7Right-click to open options menu"
|
||||
|
||||
@@ -9,31 +9,150 @@ Themes:
|
||||
- Emoji
|
||||
- House
|
||||
- Flower
|
||||
- Tree
|
||||
- Car
|
||||
- Book
|
||||
- Ocean
|
||||
- Mountain
|
||||
- Forest
|
||||
- Desert
|
||||
- Volcano
|
||||
- Island
|
||||
- Cave
|
||||
- Waterfall
|
||||
- River
|
||||
- Lake
|
||||
- Glacier
|
||||
- Jungle
|
||||
- Pizza
|
||||
- Burger
|
||||
- Cake
|
||||
- Ice Cream
|
||||
- Fruit
|
||||
- Vegetable
|
||||
- Candy
|
||||
- Sushi
|
||||
- Bread
|
||||
- Coffee
|
||||
- Dragon
|
||||
- Wizard Tower
|
||||
- Fairy Tale
|
||||
- Spaceship
|
||||
- Robot
|
||||
- Alien
|
||||
- Monster
|
||||
- Superhero
|
||||
- Pirate Ship
|
||||
- Ancient Ruin
|
||||
- Music
|
||||
- Dreams
|
||||
- Emotions
|
||||
- Future
|
||||
- Past
|
||||
- Chaos
|
||||
- Order
|
||||
- Light
|
||||
- Darkness
|
||||
- Time
|
||||
- Shoe
|
||||
- Chair
|
||||
- Lamp
|
||||
- Clock
|
||||
- Camera
|
||||
- Phone
|
||||
- Television
|
||||
- Pencil
|
||||
- Key
|
||||
- Umbrella
|
||||
# Team mode themes.
|
||||
Teams:
|
||||
- Well
|
||||
- Car
|
||||
- Rainbow
|
||||
- Arcade Machine
|
||||
- Bridge
|
||||
- Road
|
||||
- Train Tracks
|
||||
- Chain
|
||||
- Puzzle
|
||||
- Web
|
||||
- Rainbow
|
||||
- Secret Passage
|
||||
- Parallel Worlds
|
||||
- Lost and Found
|
||||
- A New Discovery
|
||||
- The Great Escape
|
||||
- Time Travel
|
||||
- A Legendary Battle
|
||||
# Guess the build themes.
|
||||
# Use the following layout to support multiple answers
|
||||
# Main theme, second possibility, x possibility
|
||||
# E.g. You want Castle as main Theme but also allow fortress and mansion as different possibility it would look like
|
||||
# - Castle, Fortress, Mansion
|
||||
Guess-The-Build:
|
||||
Easy:
|
||||
- Apple
|
||||
- Sun
|
||||
- Bread
|
||||
- Book
|
||||
- Dollar
|
||||
- Dollar, Money, Bill
|
||||
- Cloud
|
||||
- Tree
|
||||
- House, Home, Abode
|
||||
- Car, Automobile, Vehicle
|
||||
- Ball, Sphere
|
||||
- Chair, Seat
|
||||
- Lamp, Light
|
||||
- River, Stream
|
||||
- Mountain, Peak, Summit
|
||||
- Flower, Bloom
|
||||
- Boat, Ship
|
||||
- Hat, Cap
|
||||
- Shoe, Footwear
|
||||
- Door, Gateway
|
||||
- Window, Pane
|
||||
Medium:
|
||||
- School Bus
|
||||
- Horse
|
||||
- Horse, Steed, Pony
|
||||
- Fountain
|
||||
- Sumo
|
||||
- Bicycle
|
||||
- Bicycle, Bike
|
||||
- Lighthouse
|
||||
- Pyramid
|
||||
- Robot, Android, Golem
|
||||
- Spaceship, Rocket
|
||||
- Guitar, Instrument
|
||||
- Volcano, Mount Vesuvius
|
||||
- Castle, Fortress, Mansion
|
||||
- Bridge, Overpass, Viaduct
|
||||
- Windmill, Mill
|
||||
- Octopus, Cephalopod
|
||||
- Hot Air Balloon, Airship
|
||||
- Train, Locomotive
|
||||
- Carousel, Merry-go-round
|
||||
- Chess Piece, Knight, Rook
|
||||
- Telescope, Spyglass
|
||||
Hard:
|
||||
- Soccer
|
||||
- Birthday Cake
|
||||
- Soccer, Football
|
||||
- Birthday Cake, Celebration Cake
|
||||
- Typewriter
|
||||
- Solar System
|
||||
- Solar System, Galaxy, Cosmos
|
||||
- Eiffel Tower, Landmark
|
||||
- Dragon, Wyrm, Beast
|
||||
- Submarine, U-boat
|
||||
- Grandfather Clock, Timepiece
|
||||
- Rollercoaster, Amusement Ride
|
||||
- DNA, Helix
|
||||
- Globe, World Map, Earth
|
||||
- Opera House, Concert Hall
|
||||
- Satellite, Orbiter
|
||||
- Microscope, Magnifying Glass
|
||||
- Labyrinth, Maze
|
||||
- Golden Gate Bridge, Suspension Bridge
|
||||
- The Sphinx, Monument
|
||||
- Chandelier, Candelabra
|
||||
- Pirate Ship, Galleon, Brig
|
||||
- Globe Theater, Amphitheater
|
||||
|
||||
|
||||
# Special holiday themes
|
||||
@@ -45,27 +164,55 @@ Holiday:
|
||||
- Void
|
||||
- Minecraft
|
||||
- Mojang
|
||||
- Prank
|
||||
- Illusion
|
||||
- Trick
|
||||
- Joke
|
||||
- Upside Down
|
||||
Valentine:
|
||||
- Heart
|
||||
- Love
|
||||
- Cupid
|
||||
- Chocolate Box
|
||||
- Roses
|
||||
- Romance
|
||||
- Teddy Bear
|
||||
- Arrow
|
||||
- Poem
|
||||
- Sweet
|
||||
Halloween:
|
||||
- Pumpkin
|
||||
- Skeleton
|
||||
- Jack'o'Lantern
|
||||
- Candies
|
||||
- Ghost
|
||||
- Witch
|
||||
- Bat
|
||||
- Spiderweb
|
||||
- Vampire
|
||||
- Zombie
|
||||
Christmas:
|
||||
- Santa
|
||||
- Presents
|
||||
- Snowman
|
||||
- Stocking
|
||||
- Reindeer
|
||||
- Sleigh
|
||||
- Elf
|
||||
- Ornament
|
||||
- Gingerbread
|
||||
- Chimney
|
||||
NewYear:
|
||||
- Rocket
|
||||
- Firework
|
||||
- Party
|
||||
- Firecracker
|
||||
- Champagne
|
||||
- Clock
|
||||
- Countdown
|
||||
- Confetti
|
||||
- Ball Drop
|
||||
- Resolutions
|
||||
|
||||
# Theme names that are blacklisted.
|
||||
Blacklisted:
|
||||
@@ -76,5 +223,5 @@ Blacklisted:
|
||||
# Really, don't edit ;p
|
||||
# You edited it, huh? Next time hurt yourself!
|
||||
Do-Not-Edit:
|
||||
File-Version: 1
|
||||
File-Version: 2
|
||||
Core-Version: 1
|
||||
Reference in new issue
Block a user