Fixes code style
This commit is contained in:
parent
47fb6625dd
commit
be6ca823fe
38
.github/CONTRIBUTING.md
vendored
38
.github/CONTRIBUTING.md
vendored
@ -5,30 +5,43 @@ If you want to contribute to BlockHunt you're welcome to do so!
|
|||||||
Just code what you would like to see or help with "Accepted" issues.
|
Just code what you would like to see or help with "Accepted" issues.
|
||||||
|
|
||||||
When commiting use the following symbols:
|
When commiting use the following symbols:
|
||||||
* + For new features/code.
|
|
||||||
* - For removed code.
|
*
|
||||||
* * For fixes, like bugs.
|
+ For new features/code.
|
||||||
|
*
|
||||||
|
- For removed code.
|
||||||
|
*
|
||||||
|
* For fixes, like bugs.
|
||||||
* ~ Changed stuff/others.
|
* ~ Changed stuff/others.
|
||||||
|
|
||||||
Thanks for helping!
|
Thanks for helping!
|
||||||
|
|
||||||
Read before posting issue
|
Read before posting issue
|
||||||
====
|
====
|
||||||
So if you have an issue regarding BlockHunt that's fine, just go through this check list before you go writing up new issues that we have to deal with.
|
So if you have an issue regarding BlockHunt that's fine, just go through this check list before you go writing up new
|
||||||
|
issues that we have to deal with.
|
||||||
|
|
||||||
1: Plugins - The plugins that BlockHunt requires are ProtocolLib and LibsDisguise, both of these should be updated and should be tested to see if they are working.
|
1: Plugins - The plugins that BlockHunt requires are ProtocolLib and LibsDisguise, both of these should be updated and
|
||||||
|
should be tested to see if they are working.
|
||||||
|
|
||||||
2: Bugs - Have you found a bug? Make sure it isn't anything else to do with the plugin. If you are reporting a bug after you have updated to a new Bukkit/Spigot version then that is ok because with every new version comes new bugs
|
2: Bugs - Have you found a bug? Make sure it isn't anything else to do with the plugin. If you are reporting a bug after
|
||||||
|
you have updated to a new Bukkit/Spigot version then that is ok because with every new version comes new bugs
|
||||||
|
|
||||||
3: Conflicting plugin - These are the most common issue with BlockHunt, if you have installed a plugin and BlockHunt is giving an error, then remove that plugin and don't go putting issues on that aren't needed.
|
3: Conflicting plugin - These are the most common issue with BlockHunt, if you have installed a plugin and BlockHunt is
|
||||||
|
giving an error, then remove that plugin and don't go putting issues on that aren't needed.
|
||||||
|
|
||||||
4: Ideas - New ideas are needed as always but please don't go spamming us saying "Add MySQL", Add this and that and that. Some things we will add to improve BlockHunt but if we say that were not going to implement an idea into BlockHunt then we won't
|
4: Ideas - New ideas are needed as always but please don't go spamming us saying "Add MySQL", Add this and that and
|
||||||
|
that. Some things we will add to improve BlockHunt but if we say that were not going to implement an idea into BlockHunt
|
||||||
|
then we won't
|
||||||
|
|
||||||
5: False Reports - Adding false issues to this page will only make our lives more difficult, if your going to troll then do it on someone else's plugin because personally that is the last thing on my mind.
|
5: False Reports - Adding false issues to this page will only make our lives more difficult, if your going to troll then
|
||||||
|
do it on someone else's plugin because personally that is the last thing on my mind.
|
||||||
|
|
||||||
6: Check everything - If you can't PVP in a BlockHunt arena then check every single last setting including your WorldGuard settings and even your server.properties file as that has a true/false check for PVP
|
6: Check everything - If you can't PVP in a BlockHunt arena then check every single last setting including your
|
||||||
|
WorldGuard settings and even your server.properties file as that has a true/false check for PVP
|
||||||
|
|
||||||
7: Check if the issue already exists - Look on Github at all the issues first before you go posting an issue, we are again sick of marking issues as duplicates and then closing them
|
7: Check if the issue already exists - Look on Github at all the issues first before you go posting an issue, we are
|
||||||
|
again sick of marking issues as duplicates and then closing them
|
||||||
|
|
||||||
8: If it truly is an issue, report it and we will deal with it as soon as ;3
|
8: If it truly is an issue, report it and we will deal with it as soon as ;3
|
||||||
|
|
||||||
@ -36,7 +49,8 @@ NOTE: Bugs will always be fixed first before implementing ideas so please don't
|
|||||||
|
|
||||||
Also please do not message us via Bukkit as it is irritating and we only respond to Plugin Developers
|
Also please do not message us via Bukkit as it is irritating and we only respond to Plugin Developers
|
||||||
|
|
||||||
Thank you for reading this. The reason I have wrote this up is because we are sick to the back teeth of issues that don't need to be reported.
|
Thank you for reading this. The reason I have wrote this up is because we are sick to the back teeth of issues that
|
||||||
|
don't need to be reported.
|
||||||
|
|
||||||
Thank you,
|
Thank you,
|
||||||
|
|
||||||
|
72
README.md
72
README.md
@ -1,9 +1,12 @@
|
|||||||
BlockHunt
|
BlockHunt
|
||||||
====
|
====
|
||||||
|
|
||||||
# 
|
# 
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
Hide and seek is a popular game mode on Minecraft that allows you to hide as blocks and disguise as normal props from seekers. This plugin allows you to do that but with a lot more features added on such as: shops, stats etc...
|
|
||||||
|
Hide and seek is a popular game mode on Minecraft that allows you to hide as blocks and disguise as normal props from
|
||||||
|
seekers. This plugin allows you to do that but with a lot more features added on such as: shops, stats etc...
|
||||||
|
|
||||||
This plugin has been heavily inspired from the gamemode "PropHunt", from the game, "Garry's Mod".
|
This plugin has been heavily inspired from the gamemode "PropHunt", from the game, "Garry's Mod".
|
||||||
|
|
||||||
@ -13,17 +16,19 @@ This plugin has been heavily inspired from the gamemode "PropHunt", from the gam
|
|||||||
|
|
||||||
| Branch | Plugin version | Compatiable Minecraft version | Build status | Download |
|
| Branch | Plugin version | Compatiable Minecraft version | Build status | Download |
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| Release| **v0.2.1** | **v1.12.2** | [] | [DOWNLOAD](https://jenkins.addstar.com.au/job/Blockhunt/lastSuccessfulBuild/artifact/target/) |
|
| Release| **v0.2.1** | **
|
||||||
|
v1.12.2** | [] | [DOWNLOAD](https://jenkins.addstar.com.au/job/Blockhunt/lastSuccessfulBuild/artifact/target/) |
|
||||||
|
|
||||||
#### This plugin requires you to download and install two addinonal plugins! ([Lib's Disguises](https://www.spigotmc.org/resources/libs-disguises.81/) and [ProtocolLib](http://dev.bukkit.org/bukkit-plugins/protocollib/))
|
#### This plugin requires you to download and install two addinonal plugins! ([Lib's Disguises](https://www.spigotmc.org/resources/libs-disguises.81/) and [ProtocolLib](http://dev.bukkit.org/bukkit-plugins/protocollib/))
|
||||||
|
|
||||||
### Support
|
### Support
|
||||||
|
|
||||||
|Method|Link|
|
|Method|Link|
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| **Issues/Tickets on GitHub** | [Click Here](https://github.com/AddstarMC/BlockHunt/issues/) |
|
| **Issues/Tickets on GitHub** | [Click Here](https://github.com/AddstarMC/BlockHunt/issues/) |
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Custom wand for selection arena.
|
* Custom wand for selection arena.
|
||||||
* Multiple arenas.
|
* Multiple arenas.
|
||||||
* **Join/Leave signs!**
|
* **Join/Leave signs!**
|
||||||
@ -36,46 +41,43 @@ This plugin has been heavily inspired from the gamemode "PropHunt", from the gam
|
|||||||
* Instant respawn.
|
* Instant respawn.
|
||||||
* **_And more!_**
|
* **_And more!_**
|
||||||
|
|
||||||
##Commands & Permissions
|
## Commands & Permissions
|
||||||
|
|
||||||
_**Note:** Instead of using /BlockHunt you could use:_
|
_**Note:** Instead of using /BlockHunt you could use:_
|
||||||
|
|
||||||
* /bh
|
* /bh
|
||||||
* /hideandseek
|
* /hideandseek
|
||||||
* /seekandfind (from my old plugin)
|
* /seekandfind (from my old plugin)
|
||||||
|
|
||||||
<> = Required [] = Optional
|
<> = Required [] = Optional
|
||||||
|
|
||||||
|Command|Description|Permission||
|
|Command|Description|Permission|| |:--|:--|:--|:--| |`/BlockHunt [info/i]`|Displays the plugin's info.|blockhunt.info|_
|
||||||
|:--|:--|:--|:--|
|
All players have this permission from default._| |`/BlockHunt <help/h>`|Shows a list of commands.|blockhunt.help|_All
|
||||||
|`/BlockHunt [info/i]`|Displays the plugin's info.|blockhunt.info|_All players have this permission from default._|
|
players have this permission from default._| |`/BlockHunt <reload/r>`|Reloads all
|
||||||
|`/BlockHunt <help/h>`|Shows a list of commands.|blockhunt.help|_All players have this permission from default._|
|
configs.|blockhunt.reload|blockhunt.admin| |`/BlockHunt <join/j> <arenaname>`|Joins a BlockHunt
|
||||||
|`/BlockHunt <reload/r>`|Reloads all configs.|blockhunt.reload|blockhunt.admin|
|
game.|blockhunt.join|blockhunt.player| |`/BlockHunt <leave/l>`|Leave a BlockHunt game.|blockhunt.leave|blockhunt.player|
|
||||||
|`/BlockHunt <join/j> <arenaname>`|Joins a BlockHunt game.|blockhunt.join|blockhunt.player|
|
|`/BlockHunt <list/li>`|Shows a list of available arenas.|blockhunt.list|blockhunt.player| |`/BlockHunt <shop/sh>`|Opens
|
||||||
|`/BlockHunt <leave/l>`|Leave a BlockHunt game.|blockhunt.leave|blockhunt.player|
|
the BlockHunt shop.|blockhunt.shop|blockhunt.player| |`/BlockHunt <start/go> <arenaname>`|Forces an arena to
|
||||||
|`/BlockHunt <list/li>`|Shows a list of available arenas.|blockhunt.list|blockhunt.player|
|
start.|blockhunt.start|blockhunt.moderator| |`/BlockHunt <wand/w>`|Gives you the wand selection
|
||||||
|`/BlockHunt <shop/sh>`|Opens the BlockHunt shop.|blockhunt.shop|blockhunt.player|
|
tool.|blockhunt.create|blockhunt.admin| |`/BlockHunt <create/c> <arenaname>`|Creates an arena from your
|
||||||
|`/BlockHunt <start/go> <arenaname>`|Forces an arena to start.|blockhunt.start|blockhunt.moderator|
|
selection.|blockhunt.create|blockhunt.admin| |`/BlockHunt <set/s> <arenaname>`|Opens a panel to set
|
||||||
|`/BlockHunt <wand/w>`|Gives you the wand selection tool.|blockhunt.create|blockhunt.admin|
|
settings.|blockhunt.set|blockhunt.moderator| |`/BlockHunt <setwarp/sw> <lobby/hiders/seekers/spawn> <arenaname>`|Sets
|
||||||
|`/BlockHunt <create/c> <arenaname>`|Creates an arena from your selection.|blockhunt.create|blockhunt.admin|
|
warps for your arena.|blockhunt.setwarp|blockhunt.moderator| |`/BlockHunt <remove/delete> <arenaname>`|Deletes an
|
||||||
|`/BlockHunt <set/s> <arenaname>`|Opens a panel to set settings.|blockhunt.set|blockhunt.moderator|
|
Arena.|blockhunt.remove|blockhunt.admin| |`/BlockHunt <tokens/t> <set/add/take> <playername> <amount>`|Change someones
|
||||||
|`/BlockHunt <setwarp/sw> <lobby/hiders/seekers/spawn> <arenaname>`|Sets warps for your arena.|blockhunt.setwarp|blockhunt.moderator|
|
tokens.|blockhunt.tokens|blockhunt.admin| ||Able to join full games.|blockhunt.joinfull|blockhunt.moderator| ||Able to
|
||||||
|`/BlockHunt <remove/delete> <arenaname>`|Deletes an Arena.|blockhunt.remove|blockhunt.admin|
|
join/leave using join/leave signs.|blockhunt.joinsign|blockhunt.player| ||Able to create a join/leave
|
||||||
|`/BlockHunt <tokens/t> <set/add/take> <playername> <amount>`|Change someones tokens.|blockhunt.tokens|blockhunt.admin|
|
sign.|blockhunt.signcreate|blockhunt.moderator| ||Gives you the
|
||||||
||Able to join full games.|blockhunt.joinfull|blockhunt.moderator|
|
BlockChooser.|blockhunt.shop.blockchooser|blockhunt.admin| ||Gives you the ability to do all commands
|
||||||
||Able to join/leave using join/leave signs.|blockhunt.joinsign|blockhunt.player|
|
in-game.|blockhunt.allcommands|Operators|
|
||||||
||Able to create a join/leave sign.|blockhunt.signcreate|blockhunt.moderator|
|
|
||||||
||Gives you the BlockChooser.|blockhunt.shop.blockchooser|blockhunt.admin|
|
|
||||||
||Gives you the ability to do all commands in-game.|blockhunt.allcommands|Operators|
|
|
||||||
|
|
||||||
###Other special permissions
|
### Other special permissions
|
||||||
|Permission|Description|
|
|
||||||
|:--|:--|
|
|Permission|Description| |:--|:--| |`blockhunt.*`|All BlockHunt permissions.| |`blockhunt.player`|All player related
|
||||||
|`blockhunt.*`|All BlockHunt permissions.|
|
permissions.| |`blockhunt.moderator`|All moderator related permissions.| |`blockhunt.admin`|All admin related
|
||||||
|`blockhunt.player`|All player related permissions.|
|
permissions.| |`*`|All permissions on your server, including BlockHunt's permissions.|
|
||||||
|`blockhunt.moderator`|All moderator related permissions.|
|
|
||||||
|`blockhunt.admin`|All admin related permissions.|
|
## How to set-up?
|
||||||
|`*`|All permissions on your server, including BlockHunt's permissions.|
|
|
||||||
|
|
||||||
##How to set-up?
|
|
||||||
Use this video to manage your way through the set-up phase!
|
Use this video to manage your way through the set-up phase!
|
||||||
|
|
||||||
<a href="http://www.youtube.com/watch?feature=player_embedded&v=msPQ1UMiHWg
|
<a href="http://www.youtube.com/watch?feature=player_embedded&v=msPQ1UMiHWg
|
||||||
|
247
pom.xml
247
pom.xml
@ -1,126 +1,127 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<groupId>nl.Steffion</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>BlockHunt</artifactId>
|
<groupId>nl.Steffion</groupId>
|
||||||
<version>0.5.0-SNAPSHOT</version>
|
<artifactId>BlockHunt</artifactId>
|
||||||
<name>BlockHunt</name>
|
<version>0.5.0-SNAPSHOT</version>
|
||||||
<properties>
|
<name>BlockHunt</name>
|
||||||
<plugin.version>${project.version}-${buildnumber}</plugin.version>
|
<properties>
|
||||||
<buildnumber />
|
<plugin.version>${project.version}-${buildnumber}</plugin.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<buildnumber/>
|
||||||
<spigot.api.version>1.18</spigot.api.version>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<spigot.version>${spigot.api.version}.1-R0.1-SNAPSHOT</spigot.version>
|
<spigot.api.version>1.18</spigot.api.version>
|
||||||
</properties>
|
<spigot.version>${spigot.api.version}.1-R0.1-SNAPSHOT</spigot.version>
|
||||||
<scm>
|
</properties>
|
||||||
<connection>scm:git:git@github.com:AddstarMC/Blockhunt.git</connection>
|
<scm>
|
||||||
<developerConnection>scm:git:git@github.com:AddstarMC/Blockhunt.git</developerConnection>
|
<connection>scm:git:git@github.com:AddstarMC/Blockhunt.git</connection>
|
||||||
<url>https://github.com/AddstarMC/Blockhunt</url>
|
<developerConnection>scm:git:git@github.com:AddstarMC/Blockhunt.git</developerConnection>
|
||||||
<tag>master</tag>
|
<url>https://github.com/AddstarMC/Blockhunt</url>
|
||||||
</scm>
|
<tag>master</tag>
|
||||||
<distributionManagement>
|
</scm>
|
||||||
<repository>
|
<distributionManagement>
|
||||||
<id>maven.addstar.com.au</id>
|
<repository>
|
||||||
<name>maven.addstar.com.au-releases</name>
|
<id>maven.addstar.com.au</id>
|
||||||
<url>https://maven.addstar.com.au/artifactory/ext-release-local</url>
|
<name>maven.addstar.com.au-releases</name>
|
||||||
</repository>
|
<url>https://maven.addstar.com.au/artifactory/ext-release-local</url>
|
||||||
<snapshotRepository>
|
</repository>
|
||||||
<id>maven.addstar.com.au</id>
|
<snapshotRepository>
|
||||||
<name>maven.addstar.com.au-snapshots</name>
|
<id>maven.addstar.com.au</id>
|
||||||
<url>https://maven.addstar.com.au/artifactory/ext-snapshot-local</url>
|
<name>maven.addstar.com.au-snapshots</name>
|
||||||
</snapshotRepository>
|
<url>https://maven.addstar.com.au/artifactory/ext-snapshot-local</url>
|
||||||
</distributionManagement>
|
</snapshotRepository>
|
||||||
<repositories>
|
</distributionManagement>
|
||||||
<!-- Addstar repo -->
|
<repositories>
|
||||||
<repository>
|
<!-- Addstar repo -->
|
||||||
<snapshots>
|
<repository>
|
||||||
<enabled>false</enabled>
|
<snapshots>
|
||||||
</snapshots>
|
<enabled>false</enabled>
|
||||||
<id>addstar-repo</id>
|
</snapshots>
|
||||||
<name>all-release</name>
|
<id>addstar-repo</id>
|
||||||
<url>https://maven.addstar.com.au/artifactory/all-release</url>
|
<name>all-release</name>
|
||||||
</repository>
|
<url>https://maven.addstar.com.au/artifactory/all-release</url>
|
||||||
<repository>
|
</repository>
|
||||||
<snapshots />
|
<repository>
|
||||||
<id>addstar-snapshot-repo</id>
|
<snapshots/>
|
||||||
<name>all-snapshot</name>
|
<id>addstar-snapshot-repo</id>
|
||||||
<url>https://maven.addstar.com.au/artifactory/all-snapshot</url>
|
<name>all-snapshot</name>
|
||||||
</repository>
|
<url>https://maven.addstar.com.au/artifactory/all-snapshot</url>
|
||||||
<repository>
|
</repository>
|
||||||
<id>spigot-repo</id>
|
<repository>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<id>spigot-repo</id>
|
||||||
</repository>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
<repository>
|
</repository>
|
||||||
<id>md_5-releases</id>
|
<repository>
|
||||||
<url>https://repo.md-5.net/content/repositories/releases/</url>
|
<id>md_5-releases</id>
|
||||||
</repository>
|
<url>https://repo.md-5.net/content/repositories/releases/</url>
|
||||||
<repository>
|
</repository>
|
||||||
<id>md_5-snapshots</id>
|
<repository>
|
||||||
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
|
<id>md_5-snapshots</id>
|
||||||
</repository>
|
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
|
||||||
<repository>
|
</repository>
|
||||||
<id>dmulloy2-repo</id>
|
<repository>
|
||||||
<url>https://repo.dmulloy2.net/content/groups/public/</url>
|
<id>dmulloy2-repo</id>
|
||||||
</repository>
|
<url>https://repo.dmulloy2.net/content/groups/public/</url>
|
||||||
</repositories>
|
</repository>
|
||||||
<dependencies>
|
</repositories>
|
||||||
<dependency>
|
<dependencies>
|
||||||
<groupId>org.spigotmc</groupId>
|
<dependency>
|
||||||
<artifactId>spigot-api</artifactId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<version>${spigot.version}</version>
|
<artifactId>spigot-api</artifactId>
|
||||||
<scope>provided</scope>
|
<version>${spigot.version}</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<!-- LibsDiguises is required for hiding -->
|
</dependency>
|
||||||
<dependency>
|
<!-- LibsDiguises is required for hiding -->
|
||||||
<groupId>LibsDisguises</groupId>
|
<dependency>
|
||||||
<artifactId>LibsDisguises</artifactId>
|
<groupId>LibsDisguises</groupId>
|
||||||
<version>10.0.26</version>
|
<artifactId>LibsDisguises</artifactId>
|
||||||
<scope>provided</scope>
|
<version>10.0.26</version>
|
||||||
<exclusions>
|
<scope>provided</scope>
|
||||||
<exclusion>
|
<exclusions>
|
||||||
<groupId>com.comphenix.protocol</groupId>
|
<exclusion>
|
||||||
<artifactId>ProtocolLib</artifactId>
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
</exclusion>
|
<artifactId>ProtocolLib</artifactId>
|
||||||
</exclusions>
|
</exclusion>
|
||||||
</dependency>
|
</exclusions>
|
||||||
</dependencies>
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>.</targetPath>
|
<targetPath>.</targetPath>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
<directory>${basedir}/src/main/resources</directory>
|
<directory>${basedir}/src/main/resources</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>*.yml</include>
|
<include>*.yml</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>.</targetPath>
|
<targetPath>.</targetPath>
|
||||||
<directory>src/main/resources/lang</directory>
|
<directory>src/main/resources/lang</directory>
|
||||||
<filtering>false</filtering>
|
<filtering>false</filtering>
|
||||||
<includes>
|
<includes>
|
||||||
<include>*.properties</include>
|
<include>*.properties</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.10.0</version>
|
<version>3.10.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>17</source>
|
<source>17</source>
|
||||||
<target>17</target>
|
<target>17</target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<version>3.0.0-M5</version>
|
<version>3.0.0-M5</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
@ -13,169 +8,174 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@SerializableAs("BlockHuntArena")
|
@SerializableAs("BlockHuntArena")
|
||||||
public class Arena implements ConfigurationSerializable {
|
public class Arena implements ConfigurationSerializable {
|
||||||
public String arenaName;
|
public final String arenaName;
|
||||||
public Location pos1;
|
public final Location pos1;
|
||||||
public Location pos2;
|
public final Location pos2;
|
||||||
public int maxPlayers;
|
public int maxPlayers;
|
||||||
public int minPlayers;
|
public int minPlayers;
|
||||||
public int amountSeekersOnStart;
|
public int amountSeekersOnStart;
|
||||||
public int timeInLobbyUntilStart;
|
public int timeInLobbyUntilStart;
|
||||||
public int waitingTimeSeeker;
|
public int waitingTimeSeeker;
|
||||||
public int gameTime;
|
public int gameTime;
|
||||||
public int timeUntilHidersSword;
|
public int timeUntilHidersSword;
|
||||||
public int blockAnnouncerTime;
|
public int blockAnnouncerTime;
|
||||||
public boolean seekersCanHurtSeekers;
|
public final boolean seekersCanHurtSeekers;
|
||||||
public boolean hidersCanHurtSeekers;
|
public final boolean hidersCanHurtSeekers;
|
||||||
public boolean hidersCanHurtHiders;
|
public final boolean hidersCanHurtHiders;
|
||||||
public boolean seekersTakeFallDamage;
|
public final boolean seekersTakeFallDamage;
|
||||||
public boolean hidersTakeFallDamage;
|
public final boolean hidersTakeFallDamage;
|
||||||
public ArrayList<ItemStack> disguiseBlocks;
|
public ArrayList<ItemStack> disguiseBlocks;
|
||||||
public Location lobbyWarp;
|
public Location lobbyWarp;
|
||||||
public Location hidersWarp;
|
public Location hidersWarp;
|
||||||
public Location seekersWarp;
|
public Location seekersWarp;
|
||||||
public Location spawnWarp;
|
public Location spawnWarp;
|
||||||
public List<String> seekersWinCommands;
|
public final List<String> seekersWinCommands;
|
||||||
public List<String> hidersWinCommands;
|
public final List<String> hidersWinCommands;
|
||||||
public List<String> allowedCommands;
|
public final List<String> allowedCommands;
|
||||||
public int seekersTokenWin;
|
public int seekersTokenWin;
|
||||||
public int hidersTokenWin;
|
public int hidersTokenWin;
|
||||||
public int killTokens;
|
public int killTokens;
|
||||||
|
|
||||||
public List<Player> playersInArena;
|
public final List<Player> playersInArena;
|
||||||
public ArenaState gameState;
|
public ArenaState gameState;
|
||||||
public int timer;
|
public int timer;
|
||||||
public List<Player> seekers;
|
public final List<Player> seekers;
|
||||||
public Scoreboard scoreboard;
|
public final Scoreboard scoreboard;
|
||||||
|
|
||||||
public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
||||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime,
|
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime,
|
||||||
boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
||||||
ArrayList<ItemStack> disguiseBlocks, Location lobbyWarp, Location hidersWarp, Location seekersWarp, Location spawnWarp,
|
ArrayList<ItemStack> disguiseBlocks, Location lobbyWarp, Location hidersWarp, Location seekersWarp, Location spawnWarp,
|
||||||
List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
|
List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
|
||||||
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
||||||
this.arenaName = arenaName;
|
this.arenaName = arenaName;
|
||||||
this.pos1 = pos1;
|
this.pos1 = pos1;
|
||||||
this.pos2 = pos2;
|
this.pos2 = pos2;
|
||||||
this.maxPlayers = maxPlayers;
|
this.maxPlayers = maxPlayers;
|
||||||
this.minPlayers = minPlayers;
|
this.minPlayers = minPlayers;
|
||||||
this.amountSeekersOnStart = amountSeekersOnStart;
|
this.amountSeekersOnStart = amountSeekersOnStart;
|
||||||
this.timeInLobbyUntilStart = timeInLobbyUntilStart;
|
this.timeInLobbyUntilStart = timeInLobbyUntilStart;
|
||||||
this.waitingTimeSeeker = waitingTimeSeeker;
|
this.waitingTimeSeeker = waitingTimeSeeker;
|
||||||
this.gameTime = gameTime;
|
this.gameTime = gameTime;
|
||||||
this.timeUntilHidersSword = timeUntilHidersSword;
|
this.timeUntilHidersSword = timeUntilHidersSword;
|
||||||
this.blockAnnouncerTime = blockAnnouncerTime;
|
this.blockAnnouncerTime = blockAnnouncerTime;
|
||||||
this.seekersCanHurtSeekers = seekersCanHurtSeekers;
|
this.seekersCanHurtSeekers = seekersCanHurtSeekers;
|
||||||
this.hidersCanHurtHiders = hidersCanHurtHiders;
|
this.hidersCanHurtHiders = hidersCanHurtHiders;
|
||||||
this.hidersCanHurtSeekers = hidersCanHurtSeekers;
|
this.hidersCanHurtSeekers = hidersCanHurtSeekers;
|
||||||
this.seekersTakeFallDamage = seekersTakeFallDamage;
|
this.seekersTakeFallDamage = seekersTakeFallDamage;
|
||||||
this.hidersTakeFallDamage = hidersTakeFallDamage;
|
this.hidersTakeFallDamage = hidersTakeFallDamage;
|
||||||
this.disguiseBlocks = disguiseBlocks;
|
this.disguiseBlocks = disguiseBlocks;
|
||||||
this.lobbyWarp = lobbyWarp;
|
this.lobbyWarp = lobbyWarp;
|
||||||
this.hidersWarp = hidersWarp;
|
this.hidersWarp = hidersWarp;
|
||||||
this.seekersWarp = seekersWarp;
|
this.seekersWarp = seekersWarp;
|
||||||
this.spawnWarp = spawnWarp;
|
this.spawnWarp = spawnWarp;
|
||||||
this.seekersWinCommands = seekersWinCommands;
|
this.seekersWinCommands = seekersWinCommands;
|
||||||
this.hidersWinCommands = hidersWinCommands;
|
this.hidersWinCommands = hidersWinCommands;
|
||||||
this.allowedCommands = allowedCommands;
|
this.allowedCommands = allowedCommands;
|
||||||
this.seekersTokenWin = seekersTokenWin;
|
this.seekersTokenWin = seekersTokenWin;
|
||||||
this.hidersTokenWin = hidersTokenWin;
|
this.hidersTokenWin = hidersTokenWin;
|
||||||
this.killTokens = killTokens;
|
this.killTokens = killTokens;
|
||||||
this.playersInArena = playersInArena;
|
this.playersInArena = playersInArena;
|
||||||
this.gameState = gameState;
|
this.gameState = gameState;
|
||||||
this.timer = timer;
|
this.timer = timer;
|
||||||
this.seekers = seekers;
|
this.seekers = seekers;
|
||||||
this.scoreboard = scoreboard;
|
this.scoreboard = scoreboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ArenaType {
|
public enum ArenaType {
|
||||||
maxPlayers,
|
maxPlayers,
|
||||||
minPlayers,
|
minPlayers,
|
||||||
amountSeekersOnStart,
|
amountSeekersOnStart,
|
||||||
timeInLobbyUntilStart,
|
timeInLobbyUntilStart,
|
||||||
waitingTimeSeeker,
|
waitingTimeSeeker,
|
||||||
gameTime,
|
gameTime,
|
||||||
timeUntilHidersSword,
|
timeUntilHidersSword,
|
||||||
hidersTokenWin,
|
hidersTokenWin,
|
||||||
seekersTokenWin,
|
seekersTokenWin,
|
||||||
killTokens,
|
killTokens,
|
||||||
blockAnnouncerTime
|
blockAnnouncerTime
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ArenaState {
|
public enum ArenaState {
|
||||||
WAITING,
|
WAITING,
|
||||||
STARTING,
|
STARTING,
|
||||||
INGAME,
|
INGAME,
|
||||||
RESTARTING,
|
RESTARTING,
|
||||||
DISABLED
|
DISABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> serialize() {
|
public Map<String, Object> serialize() {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("arenaName", arenaName);
|
map.put("arenaName", arenaName);
|
||||||
map.put("pos1", pos1);
|
map.put("pos1", pos1);
|
||||||
map.put("pos2", pos2);
|
map.put("pos2", pos2);
|
||||||
map.put("maxPlayers", maxPlayers);
|
map.put("maxPlayers", maxPlayers);
|
||||||
map.put("minPlayers", minPlayers);
|
map.put("minPlayers", minPlayers);
|
||||||
map.put("amountSeekersOnStart", amountSeekersOnStart);
|
map.put("amountSeekersOnStart", amountSeekersOnStart);
|
||||||
map.put("timeInLobbyUntilStart", timeInLobbyUntilStart);
|
map.put("timeInLobbyUntilStart", timeInLobbyUntilStart);
|
||||||
map.put("waitingTimeSeeker", waitingTimeSeeker);
|
map.put("waitingTimeSeeker", waitingTimeSeeker);
|
||||||
map.put("gameTime", gameTime);
|
map.put("gameTime", gameTime);
|
||||||
map.put("timeUntilHidersSword", timeUntilHidersSword);
|
map.put("timeUntilHidersSword", timeUntilHidersSword);
|
||||||
map.put("blockAnnouncerTime", blockAnnouncerTime);
|
map.put("blockAnnouncerTime", blockAnnouncerTime);
|
||||||
map.put("seekersCanHurtSeekers", seekersCanHurtSeekers);
|
map.put("seekersCanHurtSeekers", seekersCanHurtSeekers);
|
||||||
map.put("hidersCanHurtSeekers", hidersCanHurtSeekers);
|
map.put("hidersCanHurtSeekers", hidersCanHurtSeekers);
|
||||||
map.put("hidersCanHurtHiders", hidersCanHurtHiders);
|
map.put("hidersCanHurtHiders", hidersCanHurtHiders);
|
||||||
map.put("seekersTakeFallDamage", seekersTakeFallDamage);
|
map.put("seekersTakeFallDamage", seekersTakeFallDamage);
|
||||||
map.put("hidersTakeFallDamage", hidersTakeFallDamage);
|
map.put("hidersTakeFallDamage", hidersTakeFallDamage);
|
||||||
map.put("disguiseBlocks", disguiseBlocks);
|
map.put("disguiseBlocks", disguiseBlocks);
|
||||||
map.put("lobbyWarp", lobbyWarp);
|
map.put("lobbyWarp", lobbyWarp);
|
||||||
map.put("hidersWarp", hidersWarp);
|
map.put("hidersWarp", hidersWarp);
|
||||||
map.put("seekersWarp", seekersWarp);
|
map.put("seekersWarp", seekersWarp);
|
||||||
map.put("spawnWarp", spawnWarp);
|
map.put("spawnWarp", spawnWarp);
|
||||||
map.put("seekersWinCommands", seekersWinCommands);
|
map.put("seekersWinCommands", seekersWinCommands);
|
||||||
map.put("hidersWinCommands", hidersWinCommands);
|
map.put("hidersWinCommands", hidersWinCommands);
|
||||||
map.put("allowedCommands", allowedCommands);
|
map.put("allowedCommands", allowedCommands);
|
||||||
map.put("seekersTokenWin", seekersTokenWin);
|
map.put("seekersTokenWin", seekersTokenWin);
|
||||||
map.put("hidersTokenWin", hidersTokenWin);
|
map.put("hidersTokenWin", hidersTokenWin);
|
||||||
map.put("killTokens", killTokens);
|
map.put("killTokens", killTokens);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static Arena deserialize(Map<String, Object> map) {
|
public static Arena deserialize(Map<String, Object> map) {
|
||||||
Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0);
|
Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0);
|
||||||
return new Arena(
|
return new Arena(
|
||||||
(String) map.getOrDefault("arenaName", "UNKNOWN_NAME"),
|
(String) map.getOrDefault("arenaName", "UNKNOWN_NAME"),
|
||||||
(Location) map.getOrDefault("pos1", loc),
|
(Location) map.getOrDefault("pos1", loc),
|
||||||
(Location) map.getOrDefault("pos2", loc),
|
(Location) map.getOrDefault("pos2", loc),
|
||||||
(Integer) map.getOrDefault("maxPlayers", 12),
|
(Integer) map.getOrDefault("maxPlayers", 12),
|
||||||
(Integer) map.getOrDefault("minPlayers", 3),
|
(Integer) map.getOrDefault("minPlayers", 3),
|
||||||
(Integer) map.getOrDefault("amountSeekersOnStart", 1),
|
(Integer) map.getOrDefault("amountSeekersOnStart", 1),
|
||||||
(Integer) map.getOrDefault("timeInLobbyUntilStart", 90),
|
(Integer) map.getOrDefault("timeInLobbyUntilStart", 90),
|
||||||
(Integer) map.getOrDefault("waitingTimeSeeker", 20),
|
(Integer) map.getOrDefault("waitingTimeSeeker", 20),
|
||||||
(Integer) map.getOrDefault("gameTime", 200),
|
(Integer) map.getOrDefault("gameTime", 200),
|
||||||
(Integer) map.getOrDefault("timeUntilHidersSword", 30),
|
(Integer) map.getOrDefault("timeUntilHidersSword", 30),
|
||||||
(Integer) map.getOrDefault("blockAnnouncerTime", 45),
|
(Integer) map.getOrDefault("blockAnnouncerTime", 45),
|
||||||
(Boolean) map.getOrDefault("seekersCanHurtSeekers", false),
|
(Boolean) map.getOrDefault("seekersCanHurtSeekers", false),
|
||||||
(Boolean) map.getOrDefault("hidersCanHurtSeekers", true),
|
(Boolean) map.getOrDefault("hidersCanHurtSeekers", true),
|
||||||
(Boolean) map.getOrDefault("hidersCanHurtHiders", false),
|
(Boolean) map.getOrDefault("hidersCanHurtHiders", false),
|
||||||
(Boolean) map.getOrDefault("seekersTakeFallDamage", false),
|
(Boolean) map.getOrDefault("seekersTakeFallDamage", false),
|
||||||
(Boolean) map.getOrDefault("hidersTakeFallDamage", false),
|
(Boolean) map.getOrDefault("hidersTakeFallDamage", false),
|
||||||
(ArrayList<ItemStack>) map.getOrDefault("disguiseBlocks", new ArrayList<ItemStack>()),
|
(ArrayList<ItemStack>) map.getOrDefault("disguiseBlocks", new ArrayList<ItemStack>()),
|
||||||
(Location) map.getOrDefault("lobbyWarp", loc),
|
(Location) map.getOrDefault("lobbyWarp", loc),
|
||||||
(Location) map.getOrDefault("hidersWarp", loc),
|
(Location) map.getOrDefault("hidersWarp", loc),
|
||||||
(Location) map.getOrDefault("seekersWarp", loc),
|
(Location) map.getOrDefault("seekersWarp", loc),
|
||||||
(Location) map.getOrDefault("spawnWarp", loc),
|
(Location) map.getOrDefault("spawnWarp", loc),
|
||||||
(ArrayList<String>) map.getOrDefault("seekersWinCommands", new ArrayList<String>()),
|
(ArrayList<String>) map.getOrDefault("seekersWinCommands", new ArrayList<String>()),
|
||||||
(ArrayList<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()),
|
(ArrayList<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()),
|
||||||
(ArrayList<String>) map.getOrDefault("allowedCommands", new ArrayList<String>()),
|
(ArrayList<String>) map.getOrDefault("allowedCommands", new ArrayList<String>()),
|
||||||
(Integer) map.getOrDefault("seekersTokenWin", 10),
|
(Integer) map.getOrDefault("seekersTokenWin", 10),
|
||||||
(Integer) map.getOrDefault("hidersTokenWin", 50),
|
(Integer) map.getOrDefault("hidersTokenWin", 50),
|
||||||
(Integer) map.getOrDefault("killTokens", 8),
|
(Integer) map.getOrDefault("killTokens", 8),
|
||||||
new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard()
|
new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.Events.EndArenaEvent;
|
import nl.Steffion.BlockHunt.Events.EndArenaEvent;
|
||||||
import nl.Steffion.BlockHunt.Events.JoinArenaEvent;
|
import nl.Steffion.BlockHunt.Events.JoinArenaEvent;
|
||||||
import nl.Steffion.BlockHunt.Events.LeaveArenaEvent;
|
import nl.Steffion.BlockHunt.Events.LeaveArenaEvent;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -20,435 +20,442 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ArenaHandler {
|
public class ArenaHandler {
|
||||||
public static void loadArenas() {
|
public static void loadArenas() {
|
||||||
MemoryStorage.arenaList.clear();
|
MemoryStorage.arenaList.clear();
|
||||||
for (String arenaName : MemoryStorage.arenas.getFile().getKeys(false)) {
|
for (String arenaName : MemoryStorage.arenas.getFile().getKeys(false)) {
|
||||||
MemoryStorage.arenaList.add((Arena) MemoryStorage.arenas.getFile().get(arenaName));
|
MemoryStorage.arenaList.add((Arena) MemoryStorage.arenas.getFile().get(arenaName));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
ScoreboardHandler.createScoreboard(arena);
|
ScoreboardHandler.createScoreboard(arena);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMessage(Arena arena, String message, String... vars) {
|
public static void sendMessage(Arena arena, String message, String... vars) {
|
||||||
for (Player player : arena.playersInArena) {
|
for (Player player : arena.playersInArena) {
|
||||||
String pMessage = message.replaceAll("%player%", player.getDisplayName());
|
String pMessage = message.replaceAll("%player%", player.getDisplayName());
|
||||||
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendFMessage(Arena arena, ConfigC location, String... vars) {
|
public static void sendFMessage(Arena arena, ConfigC location, String... vars) {
|
||||||
for (Player player : arena.playersInArena) {
|
for (Player player : arena.playersInArena) {
|
||||||
String pMessage = location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName());
|
String pMessage = location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName());
|
||||||
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playerJoinArena(Player player, String arenaname) {
|
public static void playerJoinArena(Player player, String arenaname) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
boolean alreadyJoined = false;
|
boolean alreadyJoined = false;
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena != null) {
|
if (arena.playersInArena != null) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
alreadyJoined = true;
|
alreadyJoined = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alreadyJoined) {
|
if (!alreadyJoined) {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
found = true;
|
found = true;
|
||||||
if (arena.disguiseBlocks.isEmpty()) {
|
if (arena.disguiseBlocks.isEmpty()) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinNoBlocksSet);
|
MessageManager.sendFMessage(player, ConfigC.error_joinNoBlocksSet);
|
||||||
} else {
|
} else {
|
||||||
boolean inventoryempty = true;
|
boolean inventoryempty = true;
|
||||||
for (ItemStack invitem : player.getInventory()) {
|
for (ItemStack invitem : player.getInventory()) {
|
||||||
if (invitem != null) {
|
if (invitem != null) {
|
||||||
if (invitem.getType() != Material.AIR) {
|
if (invitem.getType() != Material.AIR) {
|
||||||
inventoryempty = false;
|
inventoryempty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemStack invitem : player.getInventory().getArmorContents()) {
|
for (ItemStack invitem : player.getInventory().getArmorContents()) {
|
||||||
if (invitem != null) {
|
if (invitem != null) {
|
||||||
if (invitem.getType() != Material.AIR) {
|
if (invitem.getType() != Material.AIR) {
|
||||||
inventoryempty = false;
|
inventoryempty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) MemoryStorage.config.get(ConfigC.requireInventoryClearOnJoin) && !inventoryempty) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.requireInventoryClearOnJoin) && !inventoryempty) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty);
|
MessageManager.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location zero = new Location(Bukkit.getWorld(player.getWorld().getName()), 0, 0, 0, 0, 0);
|
Location zero = new Location(Bukkit.getWorld(player.getWorld().getName()), 0, 0, 0, 0, 0);
|
||||||
if (arena.lobbyWarp != null && arena.hidersWarp != null && arena.seekersWarp != null && arena.spawnWarp != null) {
|
if (arena.lobbyWarp != null && arena.hidersWarp != null && arena.seekersWarp != null && arena.spawnWarp != null) {
|
||||||
if (!arena.lobbyWarp.equals(zero) && !arena.hidersWarp.equals(zero) && !arena.seekersWarp.equals(zero) && !arena.spawnWarp.equals(zero)) {
|
if (!arena.lobbyWarp.equals(zero) && !arena.hidersWarp.equals(zero) && !arena.seekersWarp.equals(zero) && !arena.spawnWarp.equals(zero)) {
|
||||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||||
if (arena.playersInArena.size() >= arena.maxPlayers) {
|
if (arena.playersInArena.size() >= arena.maxPlayers) {
|
||||||
if (!PermissionsManager.hasPerm(player, Permissions.joinfull, false)) {
|
if (!PermissionsManager.hasPerm(player, Permissions.joinfull, false)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinFull);
|
MessageManager.sendFMessage(player, ConfigC.error_joinFull);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canWarp = PlayerHandler.teleport(player, arena.lobbyWarp);
|
boolean canWarp = PlayerHandler.teleport(player, arena.lobbyWarp);
|
||||||
if (!canWarp) {
|
if (!canWarp) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_teleportFailed);
|
MessageManager.sendFMessage(player, ConfigC.error_teleportFailed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[BlockHunt] " + player.getName() + " has joined " + arenaname);
|
System.out.println("[BlockHunt] " + player.getName() + " has joined " + arenaname);
|
||||||
arena.playersInArena.add(player);
|
arena.playersInArena.add(player);
|
||||||
JoinArenaEvent event = new JoinArenaEvent(player, arena);
|
JoinArenaEvent event = new JoinArenaEvent(player, arena);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
PlayerArenaData pad = new PlayerArenaData(player.getLocation(), player.getGameMode(), player.getInventory().getContents(), player
|
PlayerArenaData pad = new PlayerArenaData(player.getLocation(), player.getGameMode(), player.getInventory().getContents(), player
|
||||||
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player.getHealth(), player.getFoodLevel(),
|
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player.getHealth(), player.getFoodLevel(),
|
||||||
player.getActivePotionEffects(), player.getAllowFlight());
|
player.getActivePotionEffects(), player.getAllowFlight());
|
||||||
|
|
||||||
MemoryStorage.pData.put(player, pad);
|
MemoryStorage.pData.put(player, pad);
|
||||||
|
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
for (PotionEffect pe : player.getActivePotionEffects()) {
|
for (PotionEffect pe : player.getActivePotionEffects()) {
|
||||||
player.removePotionEffect(pe.getType());
|
player.removePotionEffect(pe.getType());
|
||||||
}
|
}
|
||||||
player.setFoodLevel(20);
|
player.setFoodLevel(20);
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||||
player.setLevel(arena.timer);
|
player.setLevel(arena.timer);
|
||||||
player.setExp(0);
|
player.setExp(0);
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||||
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
||||||
player.getInventory().setLeggings(new ItemStack(Material.AIR));
|
player.getInventory().setLeggings(new ItemStack(Material.AIR));
|
||||||
player.getInventory().setBoots(new ItemStack(Material.AIR));
|
player.getInventory().setBoots(new ItemStack(Material.AIR));
|
||||||
player.setFlying(false);
|
player.setFlying(false);
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
player.setWalkSpeed(0.2F);
|
player.setWalkSpeed(0.2F);
|
||||||
|
|
||||||
// Fix for client not showing players after
|
// Fix for client not showing players after
|
||||||
// they join
|
// they join
|
||||||
for (Player otherplayer : arena.playersInArena) {
|
for (Player otherplayer : arena.playersInArena) {
|
||||||
if (otherplayer.canSee(player))
|
if (otherplayer.canSee(player)) {
|
||||||
otherplayer.showPlayer(BlockHunt.plugin, player); // Make
|
otherplayer.showPlayer(BlockHunt.plugin, player); // Make
|
||||||
// new
|
}
|
||||||
// player
|
// new
|
||||||
// visible
|
// player
|
||||||
// to
|
// visible
|
||||||
// others
|
// to
|
||||||
if (player.canSee(otherplayer))
|
// others
|
||||||
|
if (player.canSee(otherplayer)) {
|
||||||
player.showPlayer(BlockHunt.plugin, otherplayer); // Make
|
player.showPlayer(BlockHunt.plugin, otherplayer); // Make
|
||||||
// other
|
|
||||||
// players
|
|
||||||
// visible
|
|
||||||
// to
|
|
||||||
// new
|
|
||||||
// player
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)) {
|
|
||||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") != null
|
|
||||||
|| PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false)) {
|
|
||||||
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
|
||||||
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
|
||||||
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
|
||||||
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
|
||||||
List<String> lores2 = new ArrayList<>();
|
|
||||||
for (String lore : lores) {
|
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
|
||||||
}
|
|
||||||
shopBlockChooser_IM.setLore(lores2);
|
|
||||||
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
|
||||||
|
|
||||||
player.getInventory().addItem(shopBlockChooser);
|
|
||||||
}
|
}
|
||||||
}
|
// other
|
||||||
|
// players
|
||||||
|
// visible
|
||||||
|
// to
|
||||||
|
// new
|
||||||
|
// player
|
||||||
|
}
|
||||||
|
|
||||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)) {
|
||||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") != 0) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") != null
|
||||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)),
|
|| PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false)) {
|
||||||
1);
|
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
||||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
||||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
||||||
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
||||||
List<String> lores2 = new ArrayList<>();
|
List<String> lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
}
|
}
|
||||||
|
shopBlockChooser_IM.setLore(lores2);
|
||||||
|
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
||||||
|
|
||||||
shopBlockHuntPass_IM.setLore(lores2);
|
player.getInventory().addItem(shopBlockChooser);
|
||||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
}
|
||||||
shopBlockHuntPass.setAmount(MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass"));
|
}
|
||||||
|
|
||||||
player.getInventory().addItem(shopBlockHuntPass);
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
||||||
}
|
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") != 0) {
|
||||||
}
|
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)),
|
||||||
player.updateInventory();
|
1);
|
||||||
|
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||||
|
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||||
|
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
||||||
|
List<String> lores2 = new ArrayList<>();
|
||||||
|
for (String lore : lores) {
|
||||||
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
|
}
|
||||||
|
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
shopBlockHuntPass_IM.setLore(lores2);
|
||||||
|
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||||
|
shopBlockHuntPass.setAmount(MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass"));
|
||||||
|
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_joinJoinedArena, "playername-" + player.getName(),
|
player.getInventory().addItem(shopBlockHuntPass);
|
||||||
"1-" + arena.playersInArena.size(), "2-" + arena.maxPlayers);
|
}
|
||||||
if (arena.playersInArena.size() < arena.minPlayers) {
|
}
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
player.updateInventory();
|
||||||
}
|
|
||||||
} else {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinArenaIngame);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinWarpsNotSet);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinWarpsNotSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinAlreadyJoined);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
|
||||||
}
|
|
||||||
|
|
||||||
SignsHandler.updateSigns();
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_joinJoinedArena, "playername-" + player.getName(),
|
||||||
}
|
"1-" + arena.playersInArena.size(), "2-" + arena.maxPlayers);
|
||||||
|
if (arena.playersInArena.size() < arena.minPlayers) {
|
||||||
|
ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_joinArenaIngame);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_joinWarpsNotSet);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_joinWarpsNotSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_joinAlreadyJoined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
public static void playerLeaveArena(Player player, boolean message, boolean cleanup) {
|
if (!found) {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
||||||
|
}
|
||||||
|
|
||||||
Arena arena = null;
|
SignsHandler.updateSigns();
|
||||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
}
|
||||||
if (arena2.playersInArena != null) {
|
|
||||||
if (arena2.playersInArena.contains(player)) {
|
|
||||||
arena = arena2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arena != null) {
|
public static void playerLeaveArena(Player player, boolean message, boolean cleanup) {
|
||||||
System.out.println("[BlockHunt] " + player.getName() + " has left " + arena.arenaName);
|
|
||||||
LeaveArenaEvent event = new LeaveArenaEvent(player, arena);
|
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (cleanup) {
|
Arena arena = null;
|
||||||
arena.playersInArena.remove(player);
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena.seekers.contains(player)) {
|
if (arena2.playersInArena != null) {
|
||||||
arena.seekers.remove(player);
|
if (arena2.playersInArena.contains(player)) {
|
||||||
}
|
arena = arena2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (arena.playersInArena.size() < arena.minPlayers && arena.gameState.equals(ArenaState.STARTING)) {
|
if (arena != null) {
|
||||||
arena.gameState = ArenaState.WAITING;
|
System.out.println("[BlockHunt] " + player.getName() + " has left " + arena.arenaName);
|
||||||
arena.timer = 0;
|
LeaveArenaEvent event = new LeaveArenaEvent(player, arena);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
if (cleanup) {
|
||||||
}
|
arena.playersInArena.remove(player);
|
||||||
|
if (arena.seekers.contains(player)) {
|
||||||
|
arena.seekers.remove(player);
|
||||||
|
}
|
||||||
|
|
||||||
if (arena.playersInArena.size() <= 1 && arena.gameState == ArenaState.INGAME) {
|
if (arena.playersInArena.size() < arena.minPlayers && arena.gameState.equals(ArenaState.STARTING)) {
|
||||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
arena.gameState = ArenaState.WAITING;
|
||||||
ArenaHandler.seekersWin(arena);
|
arena.timer = 0;
|
||||||
} else {
|
|
||||||
ArenaHandler.hidersWin(arena);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
||||||
ArenaHandler.seekersWin(arena);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (arena.seekers.size() <= 0 && arena.gameState == ArenaState.INGAME) {
|
if (arena.playersInArena.size() <= 1 && arena.gameState == ArenaState.INGAME) {
|
||||||
Player seeker = arena.playersInArena.get(MemoryStorage.random.nextInt(arena.playersInArena.size()));
|
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_ingameNEWSeekerChoosen, "seeker-" + seeker.getName());
|
ArenaHandler.seekersWin(arena);
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerChoosen, "seeker-" + seeker.getName());
|
} else {
|
||||||
DisguiseAPI.undisguiseToAll(seeker);
|
ArenaHandler.hidersWin(arena);
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
}
|
||||||
pl.showPlayer(BlockHunt.plugin, seeker);
|
}
|
||||||
}
|
|
||||||
seeker.getInventory().clear();
|
|
||||||
arena.seekers.add(seeker);
|
|
||||||
PlayerHandler.teleport(seeker, arena.seekersWarp);
|
|
||||||
MemoryStorage.seekertime.put(seeker, arena.waitingTimeSeeker);
|
|
||||||
seeker.setWalkSpeed(0.3F);
|
|
||||||
|
|
||||||
// Fix for client not showing players after they join
|
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||||
for (Player otherplayer : arena.playersInArena) {
|
ArenaHandler.seekersWin(arena);
|
||||||
if (otherplayer.canSee(player))
|
}
|
||||||
|
|
||||||
|
if (arena.seekers.size() <= 0 && arena.gameState == ArenaState.INGAME) {
|
||||||
|
Player seeker = arena.playersInArena.get(MemoryStorage.random.nextInt(arena.playersInArena.size()));
|
||||||
|
ArenaHandler.sendFMessage(arena, ConfigC.warning_ingameNEWSeekerChoosen, "seeker-" + seeker.getName());
|
||||||
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerChoosen, "seeker-" + seeker.getName());
|
||||||
|
DisguiseAPI.undisguiseToAll(seeker);
|
||||||
|
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||||
|
pl.showPlayer(BlockHunt.plugin, seeker);
|
||||||
|
}
|
||||||
|
seeker.getInventory().clear();
|
||||||
|
arena.seekers.add(seeker);
|
||||||
|
PlayerHandler.teleport(seeker, arena.seekersWarp);
|
||||||
|
MemoryStorage.seekertime.put(seeker, arena.waitingTimeSeeker);
|
||||||
|
seeker.setWalkSpeed(0.3F);
|
||||||
|
|
||||||
|
// Fix for client not showing players after they join
|
||||||
|
for (Player otherplayer : arena.playersInArena) {
|
||||||
|
if (otherplayer.canSee(player)) {
|
||||||
otherplayer.showPlayer(BlockHunt.plugin, player); // Make new player
|
otherplayer.showPlayer(BlockHunt.plugin, player); // Make new player
|
||||||
// visible to others
|
|
||||||
if (player.canSee(otherplayer))
|
|
||||||
player.showPlayer(BlockHunt.plugin, otherplayer); // Make other
|
|
||||||
// players visible
|
|
||||||
// to new player
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerArenaData pad = new PlayerArenaData(null, null, null, null, null, null, null, null, null, null, false);
|
|
||||||
|
|
||||||
if (MemoryStorage.pData.get(player) != null) {
|
|
||||||
pad = MemoryStorage.pData.get(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.getInventory().clear();
|
|
||||||
player.getInventory().setContents(pad.pInventory);
|
|
||||||
player.getInventory().setArmorContents(pad.pArmor);
|
|
||||||
player.updateInventory();
|
|
||||||
player.setExp(pad.pEXP);
|
|
||||||
player.setLevel(pad.pEXPL);
|
|
||||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(pad.pMaxHealth);
|
|
||||||
player.setHealth(pad.pHealth);
|
|
||||||
player.setFoodLevel(pad.pFood);
|
|
||||||
player.addPotionEffects(pad.pPotionEffects);
|
|
||||||
PlayerHandler.teleport(player, arena.spawnWarp);
|
|
||||||
player.setGameMode(pad.pGameMode);
|
|
||||||
player.setAllowFlight(pad.pFlying);
|
|
||||||
if (player.getAllowFlight()) {
|
|
||||||
player.setFlying(true);
|
|
||||||
}
|
|
||||||
player.setWalkSpeed(0.2F);
|
|
||||||
|
|
||||||
MemoryStorage.pData.remove(player);
|
|
||||||
MemoryStorage.choosenBlock.remove(player);
|
|
||||||
|
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
|
||||||
pl.showPlayer(BlockHunt.plugin, player);
|
|
||||||
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
|
||||||
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
|
||||||
Block pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
|
||||||
if (MemoryStorage.hiddenLocWater.get(player)) {
|
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
|
||||||
} else {
|
|
||||||
pl.sendBlockChange(pBlock.getLocation(),Bukkit.createBlockData(Material.AIR));
|
|
||||||
}
|
}
|
||||||
}
|
// visible to others
|
||||||
}
|
if (player.canSee(otherplayer)) {
|
||||||
|
player.showPlayer(BlockHunt.plugin, otherplayer); // Make other
|
||||||
|
}
|
||||||
|
// players visible
|
||||||
|
// to new player
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
PlayerArenaData pad = new PlayerArenaData(null, null, null, null, null, null, null, null, null, null, false);
|
||||||
}
|
|
||||||
|
|
||||||
ScoreboardHandler.removeScoreboard(player);
|
if (MemoryStorage.pData.get(player) != null) {
|
||||||
|
pad = MemoryStorage.pData.get(player);
|
||||||
|
}
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_leaveYouLeft);
|
player.getInventory().clear();
|
||||||
if (message) {
|
player.getInventory().setContents(pad.pInventory);
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_leaveLeftArena, "playername-" + player.getName(), "1-" + arena.playersInArena.size(), "2-"
|
player.getInventory().setArmorContents(pad.pArmor);
|
||||||
+ arena.maxPlayers);
|
player.updateInventory();
|
||||||
}
|
player.setExp(pad.pEXP);
|
||||||
} else {
|
player.setLevel(pad.pEXPL);
|
||||||
if (message) {
|
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(pad.pMaxHealth);
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_leaveNotInArena);
|
player.setHealth(pad.pHealth);
|
||||||
}
|
player.setFoodLevel(pad.pFood);
|
||||||
return;
|
player.addPotionEffects(pad.pPotionEffects);
|
||||||
}
|
PlayerHandler.teleport(player, arena.spawnWarp);
|
||||||
|
player.setGameMode(pad.pGameMode);
|
||||||
|
player.setAllowFlight(pad.pFlying);
|
||||||
|
if (player.getAllowFlight()) {
|
||||||
|
player.setFlying(true);
|
||||||
|
}
|
||||||
|
player.setWalkSpeed(0.2F);
|
||||||
|
|
||||||
SignsHandler.updateSigns();
|
MemoryStorage.pData.remove(player);
|
||||||
}
|
MemoryStorage.choosenBlock.remove(player);
|
||||||
|
|
||||||
public static void seekersWin(Arena arena) {
|
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||||
String cause = "[BlockHunt] Seekers have won " + arena.arenaName;
|
pl.showPlayer(BlockHunt.plugin, player);
|
||||||
|
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
||||||
|
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||||
|
Block pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
||||||
|
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||||
|
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
||||||
|
} else {
|
||||||
|
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<Player> winners = new ArrayList<>();
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
List<Player> losers = new ArrayList<>();
|
}
|
||||||
|
|
||||||
for (Player player : arena.playersInArena) {
|
ScoreboardHandler.removeScoreboard(player);
|
||||||
|
|
||||||
if (arena.seekers.contains(player)) {
|
MessageManager.sendFMessage(player, ConfigC.normal_leaveYouLeft);
|
||||||
|
if (message) {
|
||||||
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_leaveLeftArena, "playername-" + player.getName(), "1-" + arena.playersInArena.size(), "2-"
|
||||||
|
+ arena.maxPlayers);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (message) {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_leaveNotInArena);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
winners.add(player);
|
SignsHandler.updateSigns();
|
||||||
|
}
|
||||||
|
|
||||||
if (arena.seekersWinCommands != null) {
|
public static void seekersWin(Arena arena) {
|
||||||
for (String command : arena.seekersWinCommands) {
|
String cause = "[BlockHunt] Seekers have won " + arena.arenaName;
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
List<Player> winners = new ArrayList<>();
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
List<Player> losers = new ArrayList<>();
|
||||||
MemoryStorage.shop.save();
|
|
||||||
}
|
|
||||||
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.seekersTokenWin);
|
|
||||||
MemoryStorage.shop.save();
|
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.seekersTokenWin);
|
for (Player player : arena.playersInArena) {
|
||||||
|
|
||||||
}
|
if (arena.seekers.contains(player)) {
|
||||||
|
|
||||||
|
winners.add(player);
|
||||||
|
|
||||||
|
if (arena.seekersWinCommands != null) {
|
||||||
|
for (String command : arena.seekersWinCommands) {
|
||||||
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
|
MemoryStorage.shop.save();
|
||||||
|
}
|
||||||
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.seekersTokenWin);
|
||||||
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.seekersTokenWin);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
losers.add(player);
|
losers.add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
stopArena(arena, cause, ConfigC.normal_winSeekers);
|
stopArena(arena, cause, ConfigC.normal_winSeekers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void hidersWin(Arena arena) {
|
public static void hidersWin(Arena arena) {
|
||||||
String cause = "[BlockHunt] Hiders have won " + arena.arenaName;
|
String cause = "[BlockHunt] Hiders have won " + arena.arenaName;
|
||||||
|
|
||||||
List<Player> winners = new ArrayList<>();
|
List<Player> winners = new ArrayList<>();
|
||||||
List<Player> losers = new ArrayList<>();
|
List<Player> losers = new ArrayList<>();
|
||||||
|
|
||||||
for (Player player : arena.playersInArena) {
|
for (Player player : arena.playersInArena) {
|
||||||
|
|
||||||
if (arena.seekers.contains(player)) {
|
if (arena.seekers.contains(player)) {
|
||||||
losers.add(player);
|
losers.add(player);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
winners.add(player);
|
winners.add(player);
|
||||||
|
|
||||||
if (arena.hidersWinCommands != null) {
|
if (arena.hidersWinCommands != null) {
|
||||||
for (String command : arena.hidersWinCommands) {
|
for (String command : arena.hidersWinCommands) {
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.hidersTokenWin);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.hidersTokenWin);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.hidersTokenWin);
|
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.hidersTokenWin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
stopArena(arena, cause, ConfigC.normal_winHiders);
|
stopArena(arena, cause, ConfigC.normal_winHiders);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stopArena(Arena arena,String cause, ConfigC message) {
|
public static void stopArena(Arena arena, String cause, ConfigC message) {
|
||||||
System.out.println(cause);
|
System.out.println(cause);
|
||||||
ArenaHandler.sendFMessage(arena, message);
|
ArenaHandler.sendFMessage(arena, message);
|
||||||
arena.seekers.clear();
|
arena.seekers.clear();
|
||||||
|
|
||||||
for (Player player : arena.playersInArena) {
|
for (Player player : arena.playersInArena) {
|
||||||
playerLeaveArena(player, false, false);
|
playerLeaveArena(player, false, false);
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
arena.gameState = ArenaState.WAITING;
|
arena.gameState = ArenaState.WAITING;
|
||||||
arena.timer = 0;
|
arena.timer = 0;
|
||||||
arena.playersInArena.clear();
|
arena.playersInArena.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean noPlayersInArenas() {
|
public static boolean noPlayersInArenas() {
|
||||||
// Check if there are any players in any arena (quick way to early exit for event handlers)
|
// Check if there are any players in any arena (quick way to early exit for event handlers)
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.size() > 0) {
|
if (arena.playersInArena.size() > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.Listeners.*;
|
import nl.Steffion.BlockHunt.Commands.CMDTokens;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
|
||||||
import nl.Steffion.BlockHunt.Commands.CMDcreate;
|
import nl.Steffion.BlockHunt.Commands.CMDcreate;
|
||||||
import nl.Steffion.BlockHunt.Commands.CMDhelp;
|
import nl.Steffion.BlockHunt.Commands.CMDhelp;
|
||||||
import nl.Steffion.BlockHunt.Commands.CMDinfo;
|
import nl.Steffion.BlockHunt.Commands.CMDinfo;
|
||||||
@ -22,13 +18,26 @@ import nl.Steffion.BlockHunt.Commands.CMDset;
|
|||||||
import nl.Steffion.BlockHunt.Commands.CMDsetwarp;
|
import nl.Steffion.BlockHunt.Commands.CMDsetwarp;
|
||||||
import nl.Steffion.BlockHunt.Commands.CMDshop;
|
import nl.Steffion.BlockHunt.Commands.CMDshop;
|
||||||
import nl.Steffion.BlockHunt.Commands.CMDstart;
|
import nl.Steffion.BlockHunt.Commands.CMDstart;
|
||||||
import nl.Steffion.BlockHunt.Commands.CMDtokens;
|
|
||||||
import nl.Steffion.BlockHunt.Commands.CMDwand;
|
import nl.Steffion.BlockHunt.Commands.CMDwand;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnBlockBreakEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnBlockPlaceEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageByEntityEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnFoodLevelChangeEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnInventoryClickEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnInventoryCloseEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerDropItemEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerInteractEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerMoveEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerQuitEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerSwapHandItemsEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnPlayerTeleportEvent;
|
||||||
|
import nl.Steffion.BlockHunt.Listeners.OnSignChangeEvent;
|
||||||
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -48,139 +57,138 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockHunt extends JavaPlugin implements Listener {
|
public class BlockHunt extends JavaPlugin implements Listener {
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static PluginDescriptionFile pdfFile;
|
public static PluginDescriptionFile pdfFile;
|
||||||
public static BlockHunt plugin;
|
public static BlockHunt plugin;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public static List<String> BlockHuntCMD = new ArrayList<String>() {
|
public static final List<String> BlockHuntCMD = new ArrayList<String>() {
|
||||||
{
|
{
|
||||||
add("info");
|
add("info");
|
||||||
add("help");
|
add("help");
|
||||||
add("reload");
|
add("reload");
|
||||||
add("join");
|
add("join");
|
||||||
add("leave");
|
add("leave");
|
||||||
add("list");
|
add("list");
|
||||||
add("shop");
|
add("shop");
|
||||||
add("start");
|
add("start");
|
||||||
add("wand");
|
add("wand");
|
||||||
add("create");
|
add("create");
|
||||||
add("set");
|
add("set");
|
||||||
add("setwarp");
|
add("setwarp");
|
||||||
add("remove");
|
add("remove");
|
||||||
add("tokens");
|
add("tokens");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static CommandManager CMD;
|
public static CommandManager CMD;
|
||||||
public static CommandManager CMDinfo;
|
public static CommandManager CMDinfo;
|
||||||
public static CommandManager CMDhelp;
|
public static CommandManager CMDhelp;
|
||||||
public static CommandManager CMDreload;
|
public static CommandManager CMDreload;
|
||||||
public static CommandManager CMDjoin;
|
public static CommandManager CMDjoin;
|
||||||
public static CommandManager CMDleave;
|
public static CommandManager CMDleave;
|
||||||
public static CommandManager CMDlist;
|
public static CommandManager CMDlist;
|
||||||
public static CommandManager CMDshop;
|
public static CommandManager CMDshop;
|
||||||
public static CommandManager CMDstart;
|
public static CommandManager CMDstart;
|
||||||
public static CommandManager CMDwand;
|
public static CommandManager CMDwand;
|
||||||
public static CommandManager CMDcreate;
|
public static CommandManager CMDcreate;
|
||||||
public static CommandManager CMDset;
|
public static CommandManager CMDset;
|
||||||
public static CommandManager CMDsetwarp;
|
public static CommandManager CMDsetwarp;
|
||||||
public static CommandManager CMDremove;
|
public static CommandManager CMDremove;
|
||||||
public static CommandManager CMDtokens;
|
public static CommandManager CMDtokens;
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new OnBlockBreakEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnBlockBreakEvent(), this);
|
||||||
getServer().getPluginManager().registerEvents(new OnBlockPlaceEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnBlockPlaceEvent(), this);
|
||||||
getServer().getPluginManager().registerEvents(new OnEntityDamageByEntityEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnEntityDamageByEntityEvent(), this);
|
||||||
getServer().getPluginManager().registerEvents(new OnEntityDamageEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnEntityDamageEvent(), this);
|
||||||
getServer().getPluginManager().registerEvents(new OnFoodLevelChangeEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnFoodLevelChangeEvent(), this);
|
||||||
getServer().getPluginManager().registerEvents(new OnInventoryClickEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnInventoryClickEvent(), this);
|
||||||
getServer().getPluginManager().registerEvents(new OnInventoryCloseEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnInventoryCloseEvent(), this);
|
||||||
getServer().getPluginManager().registerEvents(new OnPlayerSwapHandItemsEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnPlayerSwapHandItemsEvent(), this);
|
||||||
|
|
||||||
// Removed - This is handled by WorldGuard now.
|
getServer().getPluginManager().registerEvents(new OnPlayerDropItemEvent(), this);
|
||||||
// getServer().getPluginManager().registerEvents(
|
getServer().getPluginManager().registerEvents(new OnPlayerInteractEvent(), this);
|
||||||
// new OnPlayerCommandPreprocessEvent(), this);
|
getServer().getPluginManager().registerEvents(new OnPlayerMoveEvent(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new OnPlayerTeleportEvent(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new OnPlayerQuitEvent(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new OnSignChangeEvent(), this);
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new OnPlayerDropItemEvent(), this);
|
ConfigurationSerialization.registerClass(Arena.class, "BlockHuntArena");
|
||||||
getServer().getPluginManager().registerEvents(new OnPlayerInteractEvent(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new OnPlayerMoveEvent(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new OnPlayerTeleportEvent(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new OnPlayerQuitEvent(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new OnSignChangeEvent(), this);
|
|
||||||
|
|
||||||
ConfigurationSerialization.registerClass(Arena.class, "BlockHuntArena");
|
pdfFile = getDescription();
|
||||||
|
plugin = this;
|
||||||
|
|
||||||
pdfFile = getDescription();
|
ConfigManager.newFiles();
|
||||||
plugin = this;
|
|
||||||
|
|
||||||
ConfigManager.newFiles();
|
CMD = new CommandManager("BlockHunt", "BlockHunt", null, null, Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info), BlockHuntCMD,
|
||||||
|
new CMDinfo(), null);
|
||||||
|
CMDinfo = new CommandManager("BlockHunt INFO", "BlockHunt", "info", "i", Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info),
|
||||||
|
BlockHuntCMD, new CMDinfo(), "/BlockHunt [info|i]");
|
||||||
|
CMDhelp = new CommandManager("BlockHunt HELP", "BlockHunt", "help", "h", Permissions.help, ConfigC.help_help, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_help),
|
||||||
|
BlockHuntCMD, new CMDhelp(), "/BlockHunt <help|h> [page number]");
|
||||||
|
CMDreload = new CommandManager("BlockHunt RELOAD", "BlockHunt", "reload", "r", Permissions.reload, ConfigC.help_reload,
|
||||||
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_reload), BlockHuntCMD, new CMDreload(), "/BlockHunt <reload|r>");
|
||||||
|
CMDjoin = new CommandManager("BlockHunt JOIN", "BlockHunt", "join", "j", Permissions.join, ConfigC.help_join, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_join),
|
||||||
|
BlockHuntCMD, new CMDjoin(), "/BlockHunt <join|j> <arenaname>");
|
||||||
|
CMDleave = new CommandManager("BlockHunt LEAVE", "BlockHunt", "leave", "l", Permissions.leave, ConfigC.help_leave,
|
||||||
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_leave), BlockHuntCMD, new CMDleave(), "/BlockHunt <leave|l>");
|
||||||
|
CMDlist = new CommandManager("BlockHunt LIST", "BlockHunt", "list", "li", Permissions.list, ConfigC.help_list, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_list),
|
||||||
|
BlockHuntCMD, new CMDlist(), "/BlockHunt <list|li>");
|
||||||
|
CMDshop = new CommandManager("BlockHunt SHOP", "BlockHunt", "shop", "sh", Permissions.shop, ConfigC.help_shop, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_shop),
|
||||||
|
BlockHuntCMD, new CMDshop(), "/BlockHunt <shop|sh>");
|
||||||
|
CMDstart = new CommandManager("BlockHunt START", "BlockHunt", "start", "go", Permissions.start, ConfigC.help_start,
|
||||||
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_start), BlockHuntCMD, new CMDstart(), "/BlockHunt <start|go> <arenaname>");
|
||||||
|
CMDwand = new CommandManager("BlockHunt WAND", "BlockHunt", "wand", "w", Permissions.create, ConfigC.help_wand, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_wand),
|
||||||
|
BlockHuntCMD, new CMDwand(), "/BlockHunt <wand|w>");
|
||||||
|
CMDcreate = new CommandManager("BlockHunt CREATE", "BlockHunt", "create", "c", Permissions.create, ConfigC.help_create,
|
||||||
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_create), BlockHuntCMD, new CMDcreate(), "/BlockHunt <create|c> <arenaname>");
|
||||||
|
CMDset = new CommandManager("BlockHunt SET", "BlockHunt", "set", "s", Permissions.set, ConfigC.help_set, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_set),
|
||||||
|
BlockHuntCMD, new CMDset(), "/BlockHunt <set|s> <arenaname>");
|
||||||
|
CMDsetwarp = new CommandManager("BlockHunt SETWARP", "BlockHunt", "setwarp", "sw", Permissions.setwarp, ConfigC.help_setwarp,
|
||||||
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_setwarp), BlockHuntCMD, new CMDsetwarp(),
|
||||||
|
"/BlockHunt <setwarp|sw> <lobby|hiders|seekers|spawn> <arenaname>");
|
||||||
|
CMDremove = new CommandManager("BlockHunt REMOVE", "BlockHunt", "remove", "delete", Permissions.remove, ConfigC.help_remove,
|
||||||
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_remove), BlockHuntCMD, new CMDremove(), "/BlockHunt <remove|delete> <arenaname>");
|
||||||
|
CMDtokens = new CommandManager("BlockHunt TOKENS", "BlockHunt", "tokens", "t", Permissions.tokens, ConfigC.help_tokens,
|
||||||
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_tokens), BlockHuntCMD, new CMDTokens(), "/BlockHunt <tokens|t> <set|add|take> <playername> <amount>");
|
||||||
|
|
||||||
CMD = new CommandManager("BlockHunt", "BlockHunt", null, null, Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info), BlockHuntCMD,
|
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
|
||||||
new CMDinfo(), null);
|
MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
|
||||||
CMDinfo = new CommandManager("BlockHunt INFO", "BlockHunt", "info", "i", Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info),
|
|
||||||
BlockHuntCMD, new CMDinfo(), "/BlockHunt [info|i]");
|
|
||||||
CMDhelp = new CommandManager("BlockHunt HELP", "BlockHunt", "help", "h", Permissions.help, ConfigC.help_help, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_help),
|
|
||||||
BlockHuntCMD, new CMDhelp(), "/BlockHunt <help|h> [page number]");
|
|
||||||
CMDreload = new CommandManager("BlockHunt RELOAD", "BlockHunt", "reload", "r", Permissions.reload, ConfigC.help_reload,
|
|
||||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_reload), BlockHuntCMD, new CMDreload(), "/BlockHunt <reload|r>");
|
|
||||||
CMDjoin = new CommandManager("BlockHunt JOIN", "BlockHunt", "join", "j", Permissions.join, ConfigC.help_join, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_join),
|
|
||||||
BlockHuntCMD, new CMDjoin(), "/BlockHunt <join|j> <arenaname>");
|
|
||||||
CMDleave = new CommandManager("BlockHunt LEAVE", "BlockHunt", "leave", "l", Permissions.leave, ConfigC.help_leave,
|
|
||||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_leave), BlockHuntCMD, new CMDleave(), "/BlockHunt <leave|l>");
|
|
||||||
CMDlist = new CommandManager("BlockHunt LIST", "BlockHunt", "list", "li", Permissions.list, ConfigC.help_list, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_list),
|
|
||||||
BlockHuntCMD, new CMDlist(), "/BlockHunt <list|li>");
|
|
||||||
CMDshop = new CommandManager("BlockHunt SHOP", "BlockHunt", "shop", "sh", Permissions.shop, ConfigC.help_shop, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_shop),
|
|
||||||
BlockHuntCMD, new CMDshop(), "/BlockHunt <shop|sh>");
|
|
||||||
CMDstart = new CommandManager("BlockHunt START", "BlockHunt", "start", "go", Permissions.start, ConfigC.help_start,
|
|
||||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_start), BlockHuntCMD, new CMDstart(), "/BlockHunt <start|go> <arenaname>");
|
|
||||||
CMDwand = new CommandManager("BlockHunt WAND", "BlockHunt", "wand", "w", Permissions.create, ConfigC.help_wand, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_wand),
|
|
||||||
BlockHuntCMD, new CMDwand(), "/BlockHunt <wand|w>");
|
|
||||||
CMDcreate = new CommandManager("BlockHunt CREATE", "BlockHunt", "create", "c", Permissions.create, ConfigC.help_create,
|
|
||||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_create), BlockHuntCMD, new CMDcreate(), "/BlockHunt <create|c> <arenaname>");
|
|
||||||
CMDset = new CommandManager("BlockHunt SET", "BlockHunt", "set", "s", Permissions.set, ConfigC.help_set, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_set),
|
|
||||||
BlockHuntCMD, new CMDset(), "/BlockHunt <set|s> <arenaname>");
|
|
||||||
CMDsetwarp = new CommandManager("BlockHunt SETWARP", "BlockHunt", "setwarp", "sw", Permissions.setwarp, ConfigC.help_setwarp,
|
|
||||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_setwarp), BlockHuntCMD, new CMDsetwarp(),
|
|
||||||
"/BlockHunt <setwarp|sw> <lobby|hiders|seekers|spawn> <arenaname>");
|
|
||||||
CMDremove = new CommandManager("BlockHunt REMOVE", "BlockHunt", "remove", "delete", Permissions.remove, ConfigC.help_remove,
|
|
||||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_remove), BlockHuntCMD, new CMDremove(), "/BlockHunt <remove|delete> <arenaname>");
|
|
||||||
CMDtokens = new CommandManager("BlockHunt TOKENS", "BlockHunt", "tokens", "t", Permissions.tokens, ConfigC.help_tokens,
|
|
||||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_tokens), BlockHuntCMD, new CMDtokens(), "/BlockHunt <tokens|t> <set|add|take> <playername> <amount>");
|
|
||||||
|
|
||||||
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
|
|
||||||
MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
|
|
||||||
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||||
MessageManager.broadcastFMessage(ConfigC.error_protocolLibNotInstalled);
|
MessageManager.broadcastFMessage(ConfigC.error_protocolLibNotInstalled);
|
||||||
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
|
|
||||||
MessageManager.sendFMessage(null, ConfigC.log_enabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
MessageManager.sendFMessage(null, ConfigC.log_enabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
||||||
+ BlockHunt.pdfFile.getAuthors().get(0));
|
+ BlockHunt.pdfFile.getAuthors().get(0));
|
||||||
|
|
||||||
// Welcome to the massive game loop!!
|
// Welcome to the massive game loop!!
|
||||||
getServer().getScheduler().runTaskTimer(this, () -> {
|
getServer().getScheduler().runTaskTimer(this, () -> {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.gameState == ArenaState.WAITING) {
|
if (arena.gameState == ArenaState.WAITING) {
|
||||||
if (arena.playersInArena.size() >= arena.minPlayers) {
|
if (arena.playersInArena.size() >= arena.minPlayers) {
|
||||||
@ -442,117 +450,112 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
SignsHandler.updateSigns(); //TODO Only do this when needed (gamestate change or player count change)
|
SignsHandler.updateSigns(); //TODO Only do this when needed (gamestate change or player count change)
|
||||||
}, 0, 20);
|
}, 0, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||||
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.sendFMessage(null, ConfigC.log_disabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
MessageManager.sendFMessage(null, ConfigC.log_disabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
||||||
+ BlockHunt.pdfFile.getAuthors().get(0));
|
+ BlockHunt.pdfFile.getAuthors().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Args to String. Makes 1 string.
|
* Args to String. Makes 1 string.
|
||||||
*
|
*
|
||||||
* @param input
|
* @param input String list which should be converted to a string.
|
||||||
* String list which should be converted to a string.
|
* @param startArg Start on this length.
|
||||||
* @param startArg
|
* @return The converted string.
|
||||||
* Start on this length.
|
*/
|
||||||
*
|
public static String stringBuilder(String[] input, int startArg) {
|
||||||
* @return The converted string.
|
if (input.length - startArg <= 0) {
|
||||||
*/
|
return null;
|
||||||
public static String stringBuilder(String[] input, int startArg) {
|
}
|
||||||
if (input.length - startArg <= 0) {
|
StringBuilder sb = new StringBuilder(input[startArg]);
|
||||||
return null;
|
for (int i = ++startArg; i < input.length; i++) {
|
||||||
}
|
sb.append(' ').append(input[i]);
|
||||||
StringBuilder sb = new StringBuilder(input[startArg]);
|
}
|
||||||
for (int i = ++startArg; i < input.length; i++) {
|
return sb.toString();
|
||||||
sb.append(' ').append(input[i]);
|
}
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
Player player = null;
|
Player player = null;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CommandManager command : MemoryStorage.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
String[] argsSplit = null;
|
String[] argsSplit = null;
|
||||||
String[] argsSplitAlias = null;
|
String[] argsSplitAlias = null;
|
||||||
|
|
||||||
if (command.args != null && command.argsalias != null) {
|
if (command.args != null && command.argsalias != null) {
|
||||||
argsSplit = command.args.split("/");
|
argsSplit = command.args.split("/");
|
||||||
argsSplitAlias = command.argsalias.split("/");
|
argsSplitAlias = command.argsalias.split("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
||||||
boolean equals = true;
|
boolean equals = true;
|
||||||
|
|
||||||
if (argsSplit == null) {
|
if (argsSplit == null) {
|
||||||
equals = args.length == 0;
|
equals = args.length == 0;
|
||||||
} else {
|
} else {
|
||||||
if (args.length >= argsSplit.length) {
|
if (args.length >= argsSplit.length) {
|
||||||
for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) {
|
for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) {
|
||||||
int loc = argsSplit.length - i2 - 1;
|
int loc = argsSplit.length - i2 - 1;
|
||||||
if (!argsSplit[loc].equalsIgnoreCase(args[loc]) && !argsSplitAlias[loc].equalsIgnoreCase(args[loc])) {
|
if (!argsSplit[loc].equalsIgnoreCase(args[loc]) && !argsSplitAlias[loc].equalsIgnoreCase(args[loc])) {
|
||||||
equals = false;
|
equals = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
equals = false;
|
equals = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (equals) {
|
if (equals) {
|
||||||
if (PermissionsManager.hasPerm(player, command.permission, true)) {
|
if (PermissionsManager.hasPerm(player, command.permission, true)) {
|
||||||
if (command.enabled) {
|
if (command.enabled) {
|
||||||
command.CMD.execute(player, cmd, label, args);
|
return command.CMD.execute(player, cmd, label, args);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotEnabled);
|
MessageManager.sendFMessage(player, ConfigC.error_commandNotEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new CMDnotfound().execute(player,cmd,label, args);
|
new CMDnotfound().execute(player, cmd, label, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
|
||||||
for (CommandManager command : MemoryStorage.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
return command.mainTABlist;
|
return command.mainTABlist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short a String for like the Scoreboard title.
|
* Short a String for like the Scoreboard title.
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string String to be shorten.
|
||||||
* String to be shorten.
|
* @param maxLenght Max lenght of the characters.
|
||||||
* @param maxLenght
|
* @return Shorten string, else normal string.
|
||||||
* Max lenght of the characters.
|
*/
|
||||||
* @return Shorten string, else normal string.
|
public static String cutString(String string, int maxLenght) {
|
||||||
*/
|
if (string.length() > maxLenght) {
|
||||||
public static String cutString(String string, int maxLenght) {
|
string = string.substring(0, maxLenght);
|
||||||
if (string.length() > maxLenght) {
|
}
|
||||||
string = string.substring(0, maxLenght);
|
return string;
|
||||||
}
|
}
|
||||||
return string;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
79
src/main/java/nl/Steffion/BlockHunt/Commands/CMDTokens.java
Normal file
79
src/main/java/nl/Steffion/BlockHunt/Commands/CMDTokens.java
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
|
/**
|
||||||
|
* Steffion's Engine - Made by Steffion.
|
||||||
|
* <p>
|
||||||
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
|
* credit is placed somewhere in the plugin.
|
||||||
|
* <p>
|
||||||
|
* Thanks for your cooperate!
|
||||||
|
*
|
||||||
|
* @author Steffion
|
||||||
|
*/
|
||||||
|
|
||||||
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class CMDTokens extends DefaultCMD {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
|
if (args.length <= 3) {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDtokens.usage);
|
||||||
|
} else {
|
||||||
|
String option = args[1];
|
||||||
|
String playerName = args[2];
|
||||||
|
int amount;
|
||||||
|
try {
|
||||||
|
amount = Integer.parseInt(args[3]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_notANumber, "1-" + args[3]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player tokenPlayer = Bukkit.getPlayer(playerName);
|
||||||
|
if (tokenPlayer == null) {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_tokensPlayerNotOnline, "playername-" + playerName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String name = "\u00A78Console";
|
||||||
|
if (player != null) {
|
||||||
|
name = player.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (option.equalsIgnoreCase("set")) {
|
||||||
|
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", amount);
|
||||||
|
MemoryStorage.shop.save();
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Set", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
||||||
|
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-set", "playername-" + name, "option2-to", "amount-" + amount);
|
||||||
|
} else if (option.equalsIgnoreCase("add")) {
|
||||||
|
int tokens = 0;
|
||||||
|
if (MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
||||||
|
tokens = MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
||||||
|
}
|
||||||
|
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens + amount);
|
||||||
|
MemoryStorage.shop.save();
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Added", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
||||||
|
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-added", "playername-" + name, "option2-to", "amount-" + amount);
|
||||||
|
} else if (option.equalsIgnoreCase("take")) {
|
||||||
|
int tokens = 0;
|
||||||
|
if (MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
||||||
|
tokens = MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
||||||
|
}
|
||||||
|
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens - amount);
|
||||||
|
MemoryStorage.shop.save();
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Took", "playername-" + tokenPlayer.getName(), "option2-from", "amount-" + amount);
|
||||||
|
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-took", "playername-" + name, "option2-from", "amount-" + amount);
|
||||||
|
} else {
|
||||||
|
MessageManager.sendFMessage(player, ConfigC.error_tokensUnknownsetting, "option-" + option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -1,47 +1,49 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.*;
|
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
import nl.Steffion.BlockHunt.ScoreboardHandler;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class CMDcreate extends DefaultCMD {
|
public class CMDcreate extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage);
|
||||||
} else {
|
} else {
|
||||||
if (MemoryStorage.pos1.get(player) != null && MemoryStorage.pos2.get(player) != null) {
|
if (MemoryStorage.pos1.get(player) != null && MemoryStorage.pos2.get(player) != null) {
|
||||||
if (MemoryStorage.pos1.get(player).getWorld().equals(MemoryStorage.pos2.get(player).getWorld())) {
|
if (MemoryStorage.pos1.get(player).getWorld().equals(MemoryStorage.pos2.get(player).getWorld())) {
|
||||||
Arena arena = new Arena(args[1], MemoryStorage.pos1.get(player), MemoryStorage.pos2.get(player), 12, 3, 1, 50, 20, 300, 30, 45, false, false, false, false, false, new ArrayList<>(), null, null, null,
|
Arena arena = new Arena(args[1], MemoryStorage.pos1.get(player), MemoryStorage.pos2.get(player), 12, 3, 1, 50, 20, 300, 30, 45, false, false, false, false, false, new ArrayList<>(), null, null, null,
|
||||||
null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
|
null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
|
||||||
0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
MemoryStorage.arenas.getFile().set(args[1], arena);
|
MemoryStorage.arenas.getFile().set(args[1], arena);
|
||||||
MemoryStorage.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
MemoryStorage.signs.load();
|
MemoryStorage.signs.load();
|
||||||
|
|
||||||
MemoryStorage.arenaList.add(arena);
|
MemoryStorage.arenaList.add(arena);
|
||||||
ScoreboardHandler.createScoreboard(arena);
|
ScoreboardHandler.createScoreboard(arena);
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]);
|
MessageManager.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_createNotSameWorld);
|
MessageManager.sendFMessage(player, ConfigC.error_createNotSameWorld);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_createSelectionFirst);
|
MessageManager.sendFMessage(player, ConfigC.error_createSelectionFirst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,91 +1,88 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDhelp extends DefaultCMD {
|
public class CMDhelp extends DefaultCMD {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
int amountCommands = 0;
|
int amountCommands = 0;
|
||||||
for (CommandManager command : MemoryStorage.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (command.usage != null) {
|
if (command.usage != null) {
|
||||||
amountCommands = amountCommands + 1;
|
amountCommands = amountCommands + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxPages = Math.round(amountCommands / 3);
|
int maxPages = (int) Math.round(amountCommands / 3.0);
|
||||||
if (maxPages <= 0) {
|
if (maxPages <= 0) {
|
||||||
maxPages = 1;
|
maxPages = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 1) {
|
int page = 1;
|
||||||
int page = 1;
|
if (args.length == 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (CommandManager command : MemoryStorage.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (i <= 4) {
|
if (i <= 4) {
|
||||||
if (command.usage != null) {
|
if (command.usage != null) {
|
||||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page");
|
} else {
|
||||||
} else {
|
try {
|
||||||
int page = 1;
|
page = Integer.parseInt(args[1]);
|
||||||
try {
|
} catch (NumberFormatException ignored) {
|
||||||
page = Integer.valueOf(args[1]);
|
}
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxPages < page) {
|
if (maxPages < page) {
|
||||||
maxPages = page;
|
maxPages = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (CommandManager command : MemoryStorage.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (i <= (page * 4) + 4) {
|
if (i <= (page * 4) + 4) {
|
||||||
if (command.usage != null) {
|
if (command.usage != null) {
|
||||||
if (i >= ((page - 1) * 4) + 1 && i <= ((page - 1) * 4) + 4) {
|
if (i >= ((page - 1) * 4) + 1 && i <= ((page - 1) * 4) + 4) {
|
||||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page");
|
}
|
||||||
}
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDinfo extends DefaultCMD {
|
public class CMDinfo extends DefaultCMD {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
||||||
MessageManager.sendMessage(player, "%A%name%%N made by %A%authors%%N.", "name-" + BlockHunt.pdfFile.getName(), "authors-" + BlockHunt.pdfFile.getAuthors().get(0));
|
MessageManager.sendMessage(player, "%A%name%%N made by %A%authors%%N.", "name-" + BlockHunt.pdfFile.getName(), "authors-" + BlockHunt.pdfFile.getAuthors().get(0));
|
||||||
MessageManager.sendMessage(player, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion());
|
MessageManager.sendMessage(player, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion());
|
||||||
MessageManager.sendMessage(player, "%NType %A%helpusage% %Nfor help.", "helpusage-" + BlockHunt.CMDhelp.usage);
|
MessageManager.sendMessage(player, "%NType %A%helpusage% %Nfor help.", "helpusage-" + BlockHunt.CMDhelp.usage);
|
||||||
MessageManager.sendMessage(player, "%NDev-Page: %Ahttp://dev.bukkit.org/bukkit-plugins/blockhunt/");
|
MessageManager.sendMessage(player, "%NDev-Page: %Ahttp://dev.bukkit.org/bukkit-plugins/blockhunt/");
|
||||||
MessageManager.sendMessage(player, "%NDonations are welcome!");
|
MessageManager.sendMessage(player, "%NDonations are welcome!");
|
||||||
MessageManager.sendMessage(player, "%NMade by help from some friends &c<3%N!");
|
MessageManager.sendMessage(player, "%NMade by help from some friends &c<3%N!");
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oInfo Page");
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oInfo Page");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,23 +4,22 @@ import nl.Steffion.BlockHunt.ArenaHandler;
|
|||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDjoin extends DefaultCMD {
|
public class CMDjoin extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage);
|
||||||
} else {
|
} else {
|
||||||
ArenaHandler.playerJoinArena(player, args[1]);
|
ArenaHandler.playerJoinArena(player, args[1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,18 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDleave extends DefaultCMD {
|
public class CMDleave extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ArenaHandler.playerLeaveArena(player, true, true);
|
ArenaHandler.playerLeaveArena(player, true, true);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,27 +3,26 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDlist extends DefaultCMD {
|
public class CMDlist extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
||||||
if (MemoryStorage.arenaList.size() >= 1) {
|
if (MemoryStorage.arenaList.size() >= 1) {
|
||||||
MessageManager.sendMessage(player, "&7Available arena(s):");
|
MessageManager.sendMessage(player, "&7Available arena(s):");
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
MessageManager.sendMessage(player, "%A" + arena.arenaName);
|
MessageManager.sendMessage(player, "%A" + arena.arenaName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendMessage(player, "&7&oNo arenas available...");
|
MessageManager.sendMessage(player, "&7&oNo arenas available...");
|
||||||
MessageManager.sendMessage(player, "&7&oCreate an arena first please.");
|
MessageManager.sendMessage(player, "&7&oCreate an arena first please.");
|
||||||
}
|
}
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oArenas list");
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oArenas list");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDnotfound extends DefaultCMD {
|
public class CMDnotfound extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotFound);
|
MessageManager.sendFMessage(player, ConfigC.error_commandNotFound);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDreload extends DefaultCMD {
|
public class CMDreload extends DefaultCMD {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
ConfigManager.newFiles();
|
ConfigManager.newFiles();
|
||||||
|
|
||||||
MemoryStorage.config.load();
|
MemoryStorage.config.load();
|
||||||
MemoryStorage.messages.load();
|
MemoryStorage.messages.load();
|
||||||
MemoryStorage.arenas.load();
|
MemoryStorage.arenas.load();
|
||||||
MemoryStorage.signs.load();
|
MemoryStorage.signs.load();
|
||||||
MemoryStorage.shop.load();
|
MemoryStorage.shop.load();
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||||
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_reloadedConfigs);
|
MessageManager.sendFMessage(player, ConfigC.normal_reloadedConfigs);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,8 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -15,39 +14,39 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CMDremove extends DefaultCMD {
|
public class CMDremove extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage);
|
||||||
} else {
|
} else {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (args[1].equalsIgnoreCase(arena.arenaName)) {
|
if (args[1].equalsIgnoreCase(arena.arenaName)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]);
|
MessageManager.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]);
|
||||||
MemoryStorage.arenas.getFile().set(args[1], null);
|
MemoryStorage.arenas.getFile().set(args[1], null);
|
||||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
if (MemoryStorage.signs.getFile().get(sign + ".arenaName").toString().equalsIgnoreCase(args[1])) {
|
if (MemoryStorage.signs.getFile().get(sign + ".arenaName").toString().equalsIgnoreCase(args[1])) {
|
||||||
Location signLoc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
Location signLoc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
signLoc.getBlock().setType(Material.AIR);
|
signLoc.getBlock().setType(Material.AIR);
|
||||||
signLoc.getWorld().playEffect(signLoc, Effect.MOBSPAWNER_FLAMES, 0);
|
signLoc.getWorld().playEffect(signLoc, Effect.MOBSPAWNER_FLAMES, 0);
|
||||||
signLoc.getWorld().playSound(signLoc, Sound.ENTITY_ENDER_DRAGON_FLAP, 1, 1);
|
signLoc.getWorld().playSound(signLoc, Sound.ENTITY_ENDER_DRAGON_FLAP, 1, 1);
|
||||||
MemoryStorage.signs.getFile().set(sign, null);
|
MemoryStorage.signs.getFile().set(sign, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryStorage.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
MemoryStorage.signs.load();
|
MemoryStorage.signs.load();
|
||||||
|
|
||||||
MemoryStorage.arenaList.remove(arena);
|
MemoryStorage.arenaList.remove(arena);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,24 +4,23 @@ import nl.Steffion.BlockHunt.BlockHunt;
|
|||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDset extends DefaultCMD {
|
public class CMDset extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage);
|
||||||
} else {
|
} else {
|
||||||
String arenaname = args[1];
|
String arenaname = args[1];
|
||||||
InventoryHandler.openPanel(player, arenaname);
|
InventoryHandler.openPanel(player, arenaname);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,64 +1,66 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.*;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDsetwarp extends DefaultCMD {
|
public class CMDsetwarp extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 2) {
|
if (args.length <= 2) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage);
|
||||||
} else {
|
} else {
|
||||||
String arenaname = args[2];
|
String arenaname = args[2];
|
||||||
String warpname = args[1];
|
String warpname = args[1];
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arena != null) {
|
if (arena != null) {
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
if (warpname.equalsIgnoreCase("lobby")) {
|
if (warpname.equalsIgnoreCase("lobby")) {
|
||||||
arena.lobbyWarp = loc;
|
arena.lobbyWarp = loc;
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else if (warpname.equalsIgnoreCase("hiders")) {
|
} else if (warpname.equalsIgnoreCase("hiders")) {
|
||||||
arena.hidersWarp = loc;
|
arena.hidersWarp = loc;
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else if (warpname.equalsIgnoreCase("seekers")) {
|
} else if (warpname.equalsIgnoreCase("seekers")) {
|
||||||
arena.seekersWarp = loc;
|
arena.seekersWarp = loc;
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else if (warpname.equalsIgnoreCase("spawn")) {
|
} else if (warpname.equalsIgnoreCase("spawn")) {
|
||||||
arena.spawnWarp = loc;
|
arena.spawnWarp = loc;
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_setwarpWarpNotFound, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.error_setwarpWarpNotFound, "warp-" + warpname);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(Arena arena) {
|
public void save(Arena arena) {
|
||||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||||
MemoryStorage.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDshop extends DefaultCMD {
|
public class CMDshop extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
InventoryHandler.openShop(player);
|
InventoryHandler.openShop(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,54 +4,53 @@ import nl.Steffion.BlockHunt.Arena;
|
|||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDstart extends DefaultCMD {
|
public class CMDstart extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage);
|
||||||
} else {
|
} else {
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
|
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arena != null) {
|
if (arena != null) {
|
||||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||||
if (arena.playersInArena.size() >= 2) {
|
if (arena.playersInArena.size() >= 2) {
|
||||||
arena.timer = 11;
|
arena.timer = 11;
|
||||||
arena.gameState = ArenaState.STARTING;
|
arena.gameState = ArenaState.STARTING;
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.warning_lobbyNeedAtleast, "1-2");
|
MessageManager.sendFMessage(player, ConfigC.warning_lobbyNeedAtleast, "1-2");
|
||||||
}
|
}
|
||||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||||
if (arena.playersInArena.size() < arena.maxPlayers) {
|
if (arena.playersInArena.size() < arena.maxPlayers) {
|
||||||
if (arena.timer >= 10) {
|
if (arena.timer >= 10) {
|
||||||
arena.timer = 11;
|
arena.timer = 11;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
arena.timer = 1;
|
arena.timer = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
|
||||||
/**
|
|
||||||
* Steffion's Engine - Made by Steffion.
|
|
||||||
*
|
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
|
||||||
* credit is placed somewhere in the plugin.
|
|
||||||
*
|
|
||||||
* Thanks for your cooperate!
|
|
||||||
*
|
|
||||||
* @author Steffion
|
|
||||||
*/
|
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CMDtokens extends DefaultCMD {
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
|
||||||
if (args.length <= 3) {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDtokens.usage);
|
|
||||||
} else {
|
|
||||||
String option = args[1];
|
|
||||||
String playerName = args[2];
|
|
||||||
int amount = 0;
|
|
||||||
try {
|
|
||||||
amount = Integer.valueOf(args[3]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notANumber, "1-" + args[3]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player tokenPlayer = Bukkit.getPlayer(playerName);
|
|
||||||
if (tokenPlayer == null) {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_tokensPlayerNotOnline, "playername-" + playerName);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
String name = "\u00A78Console";
|
|
||||||
if (player != null) {
|
|
||||||
name = player.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.equalsIgnoreCase("set")) {
|
|
||||||
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", amount);
|
|
||||||
MemoryStorage.shop.save();
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Set", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
|
||||||
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-set", "playername-" + name, "option2-to", "amount-" + amount);
|
|
||||||
} else if (option.equalsIgnoreCase("add")) {
|
|
||||||
int tokens = 0;
|
|
||||||
if (MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
|
||||||
tokens = MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
|
||||||
}
|
|
||||||
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens + amount);
|
|
||||||
MemoryStorage.shop.save();
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Added", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
|
||||||
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-added", "playername-" + name, "option2-to", "amount-" + amount);
|
|
||||||
} else if (option.equalsIgnoreCase("take")) {
|
|
||||||
int tokens = 0;
|
|
||||||
if (MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
|
||||||
tokens = MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
|
||||||
}
|
|
||||||
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens - amount);
|
|
||||||
MemoryStorage.shop.save();
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Took", "playername-" + tokenPlayer.getName(), "option2-from", "amount-" + amount);
|
|
||||||
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-took", "playername-" + name, "option2-from", "amount-" + amount);
|
|
||||||
} else {
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_tokensUnknownsetting, "option-" + option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +1,8 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -14,29 +10,32 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CMDwand extends DefaultCMD {
|
public class CMDwand extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ItemStack wand = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.wandIDname)));
|
ItemStack wand = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.wandIDname)));
|
||||||
ItemMeta im = wand.getItemMeta();
|
ItemMeta im = wand.getItemMeta();
|
||||||
im.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)));
|
im.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)));
|
||||||
MemoryStorage.config.load();
|
MemoryStorage.config.load();
|
||||||
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.wandDescription.location);
|
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.wandDescription.location);
|
||||||
List<String> lores2 = new ArrayList<>();
|
List<String> lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
}
|
}
|
||||||
|
|
||||||
im.setLore(lores2);
|
im.setLore(lores2);
|
||||||
wand.setItemMeta(im);
|
wand.setItemMeta(im);
|
||||||
player.getInventory().addItem(wand);
|
player.getInventory().addItem(wand);
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 5, 0);
|
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 5, 0);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_wandGaveWand, "type-" + wand.getType().toString().replaceAll("_", " ").toLowerCase());
|
MessageManager.sendFMessage(player, ConfigC.normal_wandGaveWand, "type-" + wand.getType().toString().replaceAll("_", " ").toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
@ -16,6 +16,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public abstract class DefaultCMD {
|
public abstract class DefaultCMD {
|
||||||
|
|
||||||
|
public abstract boolean execute(Player player, Command cmd, String label, String[] args);
|
||||||
|
|
||||||
public abstract boolean execute(Player player, Command cmd, String label, String[] args);
|
|
||||||
}
|
}
|
||||||
|
@ -1,127 +1,128 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||||
|
|
||||||
public enum ConfigC {
|
public enum ConfigC {
|
||||||
|
|
||||||
|
|
||||||
chat_tag("[" + BlockHunt.pdfFile.getName() + "] ", MemoryStorage.config), chat_normal("&b", MemoryStorage.config), chat_warning("&c", MemoryStorage.config), chat_error("&c", MemoryStorage.config), chat_arg("&e",
|
chat_tag("[" + BlockHunt.pdfFile.getName() + "] ", MemoryStorage.config), chat_normal("&b", MemoryStorage.config), chat_warning("&c", MemoryStorage.config), chat_error("&c", MemoryStorage.config), chat_arg("&e",
|
||||||
MemoryStorage.config), chat_header("&9", MemoryStorage.config), chat_headerhigh("%H_______.[ %A%header%%H ]._______", MemoryStorage.config),
|
MemoryStorage.config), chat_header("&9", MemoryStorage.config), chat_headerhigh("%H_______.[ %A%header%%H ]._______", MemoryStorage.config),
|
||||||
|
|
||||||
commandEnabled_info(true, MemoryStorage.config), commandEnabled_help(true, MemoryStorage.config), commandEnabled_reload(true, MemoryStorage.config), commandEnabled_join(true, MemoryStorage.config), commandEnabled_leave(
|
commandEnabled_info(true, MemoryStorage.config), commandEnabled_help(true, MemoryStorage.config), commandEnabled_reload(true, MemoryStorage.config), commandEnabled_join(true, MemoryStorage.config), commandEnabled_leave(
|
||||||
true, MemoryStorage.config), commandEnabled_list(true, MemoryStorage.config), commandEnabled_shop(true, MemoryStorage.config), commandEnabled_start(true, MemoryStorage.config), commandEnabled_wand(true,
|
true, MemoryStorage.config), commandEnabled_list(true, MemoryStorage.config), commandEnabled_shop(true, MemoryStorage.config), commandEnabled_start(true, MemoryStorage.config), commandEnabled_wand(true,
|
||||||
MemoryStorage.config), commandEnabled_create(true, MemoryStorage.config), commandEnabled_set(true, MemoryStorage.config), commandEnabled_setwarp(true, MemoryStorage.config), commandEnabled_remove(true,
|
MemoryStorage.config), commandEnabled_create(true, MemoryStorage.config), commandEnabled_set(true, MemoryStorage.config), commandEnabled_setwarp(true, MemoryStorage.config), commandEnabled_remove(true,
|
||||||
MemoryStorage.config), commandEnabled_tokens(true, MemoryStorage.config),
|
MemoryStorage.config), commandEnabled_tokens(true, MemoryStorage.config),
|
||||||
|
|
||||||
autoUpdateCheck(true, MemoryStorage.config), autoDownloadUpdate(false, MemoryStorage.config),
|
autoUpdateCheck(true, MemoryStorage.config), autoDownloadUpdate(false, MemoryStorage.config),
|
||||||
|
|
||||||
wandIDname("STICK", MemoryStorage.config), wandName("%A&l" + BlockHunt.pdfFile.getName() + "%N's selection wand", MemoryStorage.config), wandDescription(new String[] {
|
wandIDname("STICK", MemoryStorage.config), wandName("%A&l" + BlockHunt.pdfFile.getName() + "%N's selection wand", MemoryStorage.config), wandDescription(new String[]{
|
||||||
"%NUse this item to select an arena for your arena.", "%ALeft-Click%N to select point #1.", "%ARight-Click%N to select point #2.",
|
"%NUse this item to select an arena for your arena.", "%ALeft-Click%N to select point #1.", "%ARight-Click%N to select point #2.",
|
||||||
"%NUse the create command to define your arena.", "%A/" + BlockHunt.pdfFile.getName() + " <help|h>" }, MemoryStorage.config),
|
"%NUse the create command to define your arena.", "%A/" + BlockHunt.pdfFile.getName() + " <help|h>"}, MemoryStorage.config),
|
||||||
|
|
||||||
shop_title("%H&lBlockHunt %NShop", MemoryStorage.config), shop_price("%NPrice: %A%amount% %Ntokens.", MemoryStorage.config),
|
shop_title("%H&lBlockHunt %NShop", MemoryStorage.config), shop_price("%NPrice: %A%amount% %Ntokens.", MemoryStorage.config),
|
||||||
|
|
||||||
shop_blockChooserv1Enabled(true, MemoryStorage.config), shop_blockChooserv1IDname("BOOK", MemoryStorage.config), shop_blockChooserv1Price(3000, MemoryStorage.config), shop_blockChooserv1Name(
|
shop_blockChooserv1Enabled(true, MemoryStorage.config), shop_blockChooserv1IDname("BOOK", MemoryStorage.config), shop_blockChooserv1Price(3000, MemoryStorage.config), shop_blockChooserv1Name(
|
||||||
"%H&lBlockHunt Chooser", MemoryStorage.config), shop_blockChooserv1Description(new String[] { "%NUse this item before the arena starts.",
|
"%H&lBlockHunt Chooser", MemoryStorage.config), shop_blockChooserv1Description(new String[]{"%NUse this item before the arena starts.",
|
||||||
"%ARight-Click%N in the lobby and choose", "%Nthe block you want to be!", "&6Unlimited uses." }, MemoryStorage.config),
|
"%ARight-Click%N in the lobby and choose", "%Nthe block you want to be!", "&6Unlimited uses."}, MemoryStorage.config),
|
||||||
|
|
||||||
shop_BlockHuntPassv2Enabled(true, MemoryStorage.config), shop_BlockHuntPassv2IDName("NAME_TAG", MemoryStorage.config), shop_BlockHuntPassv2Price(150, MemoryStorage.config), shop_BlockHuntPassv2Name(
|
shop_BlockHuntPassv2Enabled(true, MemoryStorage.config), shop_BlockHuntPassv2IDName("NAME_TAG", MemoryStorage.config), shop_BlockHuntPassv2Price(150, MemoryStorage.config), shop_BlockHuntPassv2Name(
|
||||||
"%H&lBlockHunt Pass", MemoryStorage.config), shop_BlockHuntPassv2Description(new String[] { "%NUse this item before the arena starts.",
|
"%H&lBlockHunt Pass", MemoryStorage.config), shop_BlockHuntPassv2Description(new String[]{"%NUse this item before the arena starts.",
|
||||||
"%ARight-Click%N in the lobby and choose", "%Nif you want to be a Hider or a Seeker!", "&61 time use.", }, MemoryStorage.config),
|
"%ARight-Click%N in the lobby and choose", "%Nif you want to be a Hider or a Seeker!", "&61 time use.",}, MemoryStorage.config),
|
||||||
|
|
||||||
sign_LEAVE(new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4LEAVE", "&8Right-Click", "&8To leave." }, MemoryStorage.config), sign_SHOP(new String[] {
|
sign_LEAVE(new String[]{"%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4LEAVE", "&8Right-Click", "&8To leave."}, MemoryStorage.config), sign_SHOP(new String[]{
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4SHOP", "&8Right-Click", "&8To shop." }, MemoryStorage.config), sign_WAITING(new String[] {
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4SHOP", "&8Right-Click", "&8To shop."}, MemoryStorage.config), sign_WAITING(new String[]{
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..." }, MemoryStorage.config), sign_STARTING(new String[] {
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..."}, MemoryStorage.config), sign_STARTING(new String[]{
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&2Start: %A%timeleft%" }, MemoryStorage.config), sign_INGAME(new String[] {
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&2Start: %A%timeleft%"}, MemoryStorage.config), sign_INGAME(new String[]{
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "%EIngame: %A%timeleft%" }, MemoryStorage.config),
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "%EIngame: %A%timeleft%"}, MemoryStorage.config),
|
||||||
|
|
||||||
scoreboard_enabled(true, MemoryStorage.config), scoreboard_title("%H[" + BlockHunt.pdfFile.getName() + "]", MemoryStorage.config), scoreboard_timeleft("%ATime left:", MemoryStorage.config), scoreboard_seekers(
|
scoreboard_enabled(true, MemoryStorage.config), scoreboard_title("%H[" + BlockHunt.pdfFile.getName() + "]", MemoryStorage.config), scoreboard_timeleft("%ATime left:", MemoryStorage.config), scoreboard_seekers(
|
||||||
"%NSeekers:", MemoryStorage.config), scoreboard_hiders("%NHiders:", MemoryStorage.config),
|
"%NSeekers:", MemoryStorage.config), scoreboard_hiders("%NHiders:", MemoryStorage.config),
|
||||||
|
|
||||||
requireInventoryClearOnJoin(false, MemoryStorage.config),
|
requireInventoryClearOnJoin(false, MemoryStorage.config),
|
||||||
|
|
||||||
log_enabledPlugin("%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%authors%%N.", MemoryStorage.messages), log_disabledPlugin(
|
log_enabledPlugin("%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%authors%%N.", MemoryStorage.messages), log_disabledPlugin(
|
||||||
"%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.", MemoryStorage.messages),
|
"%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.", MemoryStorage.messages),
|
||||||
|
|
||||||
help_info("%NDisplays the plugin's info.", MemoryStorage.messages), help_help("%NShows a list of commands.", MemoryStorage.messages), help_reload("%NReloads all configs.", MemoryStorage.messages), help_join(
|
help_info("%NDisplays the plugin's info.", MemoryStorage.messages), help_help("%NShows a list of commands.", MemoryStorage.messages), help_reload("%NReloads all configs.", MemoryStorage.messages), help_join(
|
||||||
"%NJoins a " + BlockHunt.pdfFile.getName() + " game.", MemoryStorage.messages), help_leave("%NLeave a " + BlockHunt.pdfFile.getName() + " game.", MemoryStorage.messages), help_list(
|
"%NJoins a " + BlockHunt.pdfFile.getName() + " game.", MemoryStorage.messages), help_leave("%NLeave a " + BlockHunt.pdfFile.getName() + " game.", MemoryStorage.messages), help_list(
|
||||||
"%NShows a list of available arenas.", MemoryStorage.messages), help_shop("%NOpens the " + BlockHunt.pdfFile.getName() + " shop.", MemoryStorage.messages), help_start(
|
"%NShows a list of available arenas.", MemoryStorage.messages), help_shop("%NOpens the " + BlockHunt.pdfFile.getName() + " shop.", MemoryStorage.messages), help_start(
|
||||||
"%NForces an arena to start.", MemoryStorage.messages), help_wand("%NGives you the wand selection tool.", MemoryStorage.messages), help_create(
|
"%NForces an arena to start.", MemoryStorage.messages), help_wand("%NGives you the wand selection tool.", MemoryStorage.messages), help_create(
|
||||||
"%NCreates an arena from your selection.", MemoryStorage.messages), help_set("%NOpens a panel to set settings.", MemoryStorage.messages), help_setwarp(
|
"%NCreates an arena from your selection.", MemoryStorage.messages), help_set("%NOpens a panel to set settings.", MemoryStorage.messages), help_setwarp(
|
||||||
"%NSets warps for your arena.", MemoryStorage.messages), help_remove("%NDeletes an Arena.", MemoryStorage.messages), help_tokens("%NChange someones tokens.", MemoryStorage.messages),
|
"%NSets warps for your arena.", MemoryStorage.messages), help_remove("%NDeletes an Arena.", MemoryStorage.messages), help_tokens("%NChange someones tokens.", MemoryStorage.messages),
|
||||||
|
|
||||||
button_add("%NAdd %A%1%%N to %A%2%%N", MemoryStorage.messages), button_add2("Add", MemoryStorage.messages), button_setting("%NSetting %A%1%%N is now: %A%2%%N.", MemoryStorage.messages), button_remove(
|
button_add("%NAdd %A%1%%N to %A%2%%N", MemoryStorage.messages), button_add2("Add", MemoryStorage.messages), button_setting("%NSetting %A%1%%N is now: %A%2%%N.", MemoryStorage.messages), button_remove(
|
||||||
"%NRemove %A%1%%N from %A%2%%N", MemoryStorage.messages), button_remove2("Remove", MemoryStorage.messages),
|
"%NRemove %A%1%%N from %A%2%%N", MemoryStorage.messages), button_remove2("Remove", MemoryStorage.messages),
|
||||||
|
|
||||||
normal_reloadedConfigs("%TAG&aReloaded all configs!", MemoryStorage.messages), normal_joinJoinedArena("%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)", MemoryStorage.messages), normal_leaveYouLeft(
|
normal_reloadedConfigs("%TAG&aReloaded all configs!", MemoryStorage.messages), normal_joinJoinedArena("%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)", MemoryStorage.messages), normal_leaveYouLeft(
|
||||||
"%TAG%NYou left the arena! Thanks for playing!", MemoryStorage.messages), normal_leaveLeftArena("%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)", MemoryStorage.messages), normal_startForced(
|
"%TAG%NYou left the arena! Thanks for playing!", MemoryStorage.messages), normal_leaveLeftArena("%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)", MemoryStorage.messages), normal_startForced(
|
||||||
"%TAG%NYou forced to start arena '%A%arenaname%%N'!", MemoryStorage.messages), normal_wandGaveWand("%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)", MemoryStorage.messages), normal_wandSetPosition(
|
"%TAG%NYou forced to start arena '%A%arenaname%%N'!", MemoryStorage.messages), normal_wandGaveWand("%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)", MemoryStorage.messages), normal_wandSetPosition(
|
||||||
"%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N, %A%z%%N).", MemoryStorage.messages), normal_createCreatedArena(
|
"%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N, %A%z%%N).", MemoryStorage.messages), normal_createCreatedArena(
|
||||||
"%TAG%NCreated an arena with the name '%A%name%%N'.", MemoryStorage.messages), normal_lobbyArenaIsStarting("%TAG%NThe arena will start in %A%1%%N second(s)!", MemoryStorage.messages), normal_lobbyArenaStarted(
|
"%TAG%NCreated an arena with the name '%A%name%%N'.", MemoryStorage.messages), normal_lobbyArenaIsStarting("%TAG%NThe arena will start in %A%1%%N second(s)!", MemoryStorage.messages), normal_lobbyArenaStarted(
|
||||||
"%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!", MemoryStorage.messages), normal_ingameSeekerChoosen(
|
"%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!", MemoryStorage.messages), normal_ingameSeekerChoosen(
|
||||||
"%TAG%NPlayer %A%seeker%%N has been choosen as seeker!", MemoryStorage.messages), normal_ingameBlock("%TAG%NYou're disguised as a(n) '%A%block%%N' block.", MemoryStorage.messages), normal_ingameArenaEnd(
|
"%TAG%NPlayer %A%seeker%%N has been choosen as seeker!", MemoryStorage.messages), normal_ingameBlock("%TAG%NYou're disguised as a(n) '%A%block%%N' block.", MemoryStorage.messages), normal_ingameArenaEnd(
|
||||||
"%TAG%NThe arena will end in %A%1%%N second(s)!", MemoryStorage.messages), normal_ingameSeekerSpawned("%TAG%A%playername%%N has spawned as a seeker!", MemoryStorage.messages), normal_ingameGivenSword(
|
"%TAG%NThe arena will end in %A%1%%N second(s)!", MemoryStorage.messages), normal_ingameSeekerSpawned("%TAG%A%playername%%N has spawned as a seeker!", MemoryStorage.messages), normal_ingameGivenSword(
|
||||||
"%TAG%NYou were given a sword!", MemoryStorage.messages), normal_ingameHiderDied("%TAG%NHider %A%playername%%N was killed by %A%killer%%N!", MemoryStorage.messages), normal_ingameHidersLeft(
|
"%TAG%NYou were given a sword!", MemoryStorage.messages), normal_ingameHiderDied("%TAG%NHider %A%playername%%N was killed by %A%killer%%N!", MemoryStorage.messages), normal_ingameHidersLeft(
|
||||||
"%NHider(s) left: %A%left%%N", MemoryStorage.messages), normal_ingameSeekerDied("%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!", MemoryStorage.messages), normal_winSeekers(
|
"%NHider(s) left: %A%left%%N", MemoryStorage.messages), normal_ingameSeekerDied("%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!", MemoryStorage.messages), normal_winSeekers(
|
||||||
"%TAG%NThe %ASEEKERS%N have won!", MemoryStorage.messages), normal_winHiders("%TAG%NThe %AHIDERS%N have won!", MemoryStorage.messages), normal_setwarpWarpSet(
|
"%TAG%NThe %ASEEKERS%N have won!", MemoryStorage.messages), normal_winHiders("%TAG%NThe %AHIDERS%N have won!", MemoryStorage.messages), normal_setwarpWarpSet(
|
||||||
"%TAG%NSet warp '%A%warp%%N' to your location!", MemoryStorage.messages), normal_addedToken("%TAG%A%amount%%N tokens were added to your account!", MemoryStorage.messages), normal_removeRemovedArena(
|
"%TAG%NSet warp '%A%warp%%N' to your location!", MemoryStorage.messages), normal_addedToken("%TAG%A%amount%%N tokens were added to your account!", MemoryStorage.messages), normal_removeRemovedArena(
|
||||||
"%TAG%NRemoved arena '%A%name%%N'!", MemoryStorage.messages), normal_tokensChanged("%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.", MemoryStorage.messages), normal_tokensChangedPerson(
|
"%TAG%NRemoved arena '%A%name%%N'!", MemoryStorage.messages), normal_tokensChanged("%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.", MemoryStorage.messages), normal_tokensChangedPerson(
|
||||||
"%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.", MemoryStorage.messages), normal_ingameNowSolid(
|
"%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.", MemoryStorage.messages), normal_ingameNowSolid(
|
||||||
"%TAG%NYou're now a solid '%A%block%%N' block!", MemoryStorage.messages), normal_ingameNoMoreSolid("%TAG%NYou're no longer a solid block!", MemoryStorage.messages), normal_shopBoughtItem(
|
"%TAG%NYou're now a solid '%A%block%%N' block!", MemoryStorage.messages), normal_ingameNoMoreSolid("%TAG%NYou're no longer a solid block!", MemoryStorage.messages), normal_shopBoughtItem(
|
||||||
"%TAG%NYou've bought the '%A%itemname%%N' item!", MemoryStorage.messages), normal_shopChoosenBlock("%TAG%NYou've choosen to be a(n) '%A%block%%N' block!", MemoryStorage.messages), normal_shopChoosenSeeker(
|
"%TAG%NYou've bought the '%A%itemname%%N' item!", MemoryStorage.messages), normal_shopChoosenBlock("%TAG%NYou've choosen to be a(n) '%A%block%%N' block!", MemoryStorage.messages), normal_shopChoosenSeeker(
|
||||||
"%TAG%NYou've choosen to be a %Aseeker%N!", MemoryStorage.messages), normal_shopChoosenHiders("%TAG%NYou've choosen to be a %Ahider%N!", MemoryStorage.messages), normal_ingameBlocksLeft("%TAG%NRemaining blocks: %A%1%%N", MemoryStorage.messages),
|
"%TAG%NYou've choosen to be a %Aseeker%N!", MemoryStorage.messages), normal_shopChoosenHiders("%TAG%NYou've choosen to be a %Ahider%N!", MemoryStorage.messages), normal_ingameBlocksLeft("%TAG%NRemaining blocks: %A%1%%N", MemoryStorage.messages),
|
||||||
|
|
||||||
warning_lobbyNeedAtleast("%TAG%WYou need atleast %A%1% player(s) to start the game!", MemoryStorage.messages), warning_ingameNEWSeekerChoosen(
|
warning_lobbyNeedAtleast("%TAG%WYou need atleast %A%1% player(s) to start the game!", MemoryStorage.messages), warning_ingameNEWSeekerChoosen(
|
||||||
"%TAG%WThe last seeker left and a new seeker has been choosen!", MemoryStorage.messages), warning_unableToCommand(
|
"%TAG%WThe last seeker left and a new seeker has been choosen!", MemoryStorage.messages), warning_unableToCommand(
|
||||||
"%TAG%WSorry but that command is disabled in the arena.", MemoryStorage.messages), warning_ingameNoSolidPlace("%TAG%WThat's not a valid place to become solid!",
|
"%TAG%WSorry but that command is disabled in the arena.", MemoryStorage.messages), warning_ingameNoSolidPlace("%TAG%WThat's not a valid place to become solid!",
|
||||||
MemoryStorage.messages), warning_arenaStopped("%TAG%WThe arena has been forced to stop!", MemoryStorage.messages),
|
MemoryStorage.messages), warning_arenaStopped("%TAG%WThe arena has been forced to stop!", MemoryStorage.messages),
|
||||||
|
|
||||||
error_noPermission("%TAG%EYou don't have the permissions to do that!", MemoryStorage.messages), error_notANumber("%TAG%E'%A%1%%E' is not a number!", MemoryStorage.messages), error_commandNotEnabled(
|
error_noPermission("%TAG%EYou don't have the permissions to do that!", MemoryStorage.messages), error_notANumber("%TAG%E'%A%1%%E' is not a number!", MemoryStorage.messages), error_commandNotEnabled(
|
||||||
"%TAG%EThis command has been disabled!", MemoryStorage.messages), error_commandNotFound("%TAG%ECouldn't find the command. Try %A/" + BlockHunt.pdfFile.getName()
|
"%TAG%EThis command has been disabled!", MemoryStorage.messages), error_commandNotFound("%TAG%ECouldn't find the command. Try %A/" + BlockHunt.pdfFile.getName()
|
||||||
+ " help %Efor more info.", MemoryStorage.messages), error_notEnoughArguments("%TAG%EYou're missing arguments, correct syntax: %A%syntax%", MemoryStorage.messages), error_libsDisguisesNotInstalled(
|
+ " help %Efor more info.", MemoryStorage.messages), error_notEnoughArguments("%TAG%EYou're missing arguments, correct syntax: %A%syntax%", MemoryStorage.messages), error_libsDisguisesNotInstalled(
|
||||||
"%TAG%EThe plugin '%ALib's Disguises%E' is required to run this plugin! Intall it or it won't work!", MemoryStorage.messages), error_protocolLibNotInstalled(
|
"%TAG%EThe plugin '%ALib's Disguises%E' is required to run this plugin! Intall it or it won't work!", MemoryStorage.messages), error_protocolLibNotInstalled(
|
||||||
"%TAG%EThe plugin '%AProtocolLib%E' is required to run this plugin! Intall it or it won't work!", MemoryStorage.messages), error_noArena(
|
"%TAG%EThe plugin '%AProtocolLib%E' is required to run this plugin! Intall it or it won't work!", MemoryStorage.messages), error_noArena(
|
||||||
"%TAG%ENo arena found with the name '%A%name%%E'.", MemoryStorage.messages), error_onlyIngame("%TAG%EThis is an only in-game command!", MemoryStorage.messages), error_joinAlreadyJoined(
|
"%TAG%ENo arena found with the name '%A%name%%E'.", MemoryStorage.messages), error_onlyIngame("%TAG%EThis is an only in-game command!", MemoryStorage.messages), error_joinAlreadyJoined(
|
||||||
"%TAG%EYou've already joined an arena!", MemoryStorage.messages), error_joinNoBlocksSet("%TAG%EThere are none blocks set for this arena. Notify the administrator.",
|
"%TAG%EYou've already joined an arena!", MemoryStorage.messages), error_joinNoBlocksSet("%TAG%EThere are none blocks set for this arena. Notify the administrator.",
|
||||||
MemoryStorage.messages), error_joinWarpsNotSet("%TAG%EThere are no warps set for this arena. Notify the administrator.", MemoryStorage.messages), error_joinArenaIngame(
|
MemoryStorage.messages), error_joinWarpsNotSet("%TAG%EThere are no warps set for this arena. Notify the administrator.", MemoryStorage.messages), error_joinArenaIngame(
|
||||||
"%TAG%EThis game has already started.", MemoryStorage.messages), error_joinFull("%TAG%EUnable to join this arena. It's full!", MemoryStorage.messages), error_joinInventoryNotEmpty(
|
"%TAG%EThis game has already started.", MemoryStorage.messages), error_joinFull("%TAG%EUnable to join this arena. It's full!", MemoryStorage.messages), error_joinInventoryNotEmpty(
|
||||||
"%TAG%EYour inventory should be empty before joining!", MemoryStorage.messages), error_leaveNotInArena("%TAG%EYou're not in an arena!", MemoryStorage.messages), error_createSelectionFirst(
|
"%TAG%EYour inventory should be empty before joining!", MemoryStorage.messages), error_leaveNotInArena("%TAG%EYou're not in an arena!", MemoryStorage.messages), error_createSelectionFirst(
|
||||||
"%TAG%EMake a selection first. Use the wand command: %A/" + BlockHunt.pdfFile.getName() + " <wand|w>%E.", MemoryStorage.messages), error_createNotSameWorld(
|
"%TAG%EMake a selection first. Use the wand command: %A/" + BlockHunt.pdfFile.getName() + " <wand|w>%E.", MemoryStorage.messages), error_createNotSameWorld(
|
||||||
"%TAG%EMake your selection points in the same world!", MemoryStorage.messages), error_setTooHighNumber("%TAG%EThat amount is too high! Max amount is: %A%max%%E.",
|
"%TAG%EMake your selection points in the same world!", MemoryStorage.messages), error_setTooHighNumber("%TAG%EThat amount is too high! Max amount is: %A%max%%E.",
|
||||||
MemoryStorage.messages), error_setTooLowNumber("%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.", MemoryStorage.messages), error_setNotABlock(
|
MemoryStorage.messages), error_setTooLowNumber("%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.", MemoryStorage.messages), error_setNotABlock(
|
||||||
"%TAG%EThat is not a block!", MemoryStorage.messages), error_setwarpWarpNotFound("%TAG%EWarp '%A%warp%%E' is not valid!", MemoryStorage.messages), error_tokensPlayerNotOnline(
|
"%TAG%EThat is not a block!", MemoryStorage.messages), error_setwarpWarpNotFound("%TAG%EWarp '%A%warp%%E' is not valid!", MemoryStorage.messages), error_tokensPlayerNotOnline(
|
||||||
"%TAG%ENo player found with the name '%A%playername%%E'!", MemoryStorage.messages), error_tokensUnknownsetting("%TAG%E'%A%option%%E' is not a known option!", MemoryStorage.messages), error_shopNeedMoreTokens(
|
"%TAG%ENo player found with the name '%A%playername%%E'!", MemoryStorage.messages), error_tokensUnknownsetting("%TAG%E'%A%option%%E' is not a known option!", MemoryStorage.messages), error_shopNeedMoreTokens(
|
||||||
"%TAG%EYou need more tokens before you can buy this item.", MemoryStorage.messages), error_shopMaxSeekersReached(
|
"%TAG%EYou need more tokens before you can buy this item.", MemoryStorage.messages), error_shopMaxSeekersReached(
|
||||||
"%TAG%ESorry, the maximum amount of seekers has been reached!", MemoryStorage.messages), error_shopMaxHidersReached(
|
"%TAG%ESorry, the maximum amount of seekers has been reached!", MemoryStorage.messages), error_shopMaxHidersReached(
|
||||||
"%TAG%ESorry, the maximum amount of hiders has been reached!", MemoryStorage.messages),
|
"%TAG%ESorry, the maximum amount of hiders has been reached!", MemoryStorage.messages),
|
||||||
error_teleportFailed("%TAG%EUnable to teleport you into the arena.", MemoryStorage.messages),
|
error_teleportFailed("%TAG%EUnable to teleport you into the arena.", MemoryStorage.messages),
|
||||||
error_teleportBlocked("%TAG%EYou cannot teleport while playing!", MemoryStorage.messages);
|
error_teleportBlocked("%TAG%EYou cannot teleport while playing!", MemoryStorage.messages);
|
||||||
|
|
||||||
public Object value;
|
public final Object value;
|
||||||
public ConfigManager config;
|
public final ConfigManager config;
|
||||||
public String location;
|
public final String location;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes an object from the list above.
|
* Makes an object from the list above.
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value
|
||||||
* Setting in the config file.
|
* Setting in the config file.
|
||||||
* @param config
|
* @param config
|
||||||
* The config file.
|
* The config file.
|
||||||
*/
|
*/
|
||||||
ConfigC(Object value, ConfigManager config) {
|
ConfigC(Object value, ConfigManager config) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.location = this.name().replaceAll("_", ".");
|
this.location = this.name().replaceAll("_", ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -15,244 +11,248 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class InventoryHandler {
|
public class InventoryHandler {
|
||||||
|
|
||||||
public static void openPanel(Player player, String arenaname) {
|
public static void openPanel(Player player, String arenaname) {
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arena != null) {
|
if (arena != null) {
|
||||||
String shorten = arena.arenaName;
|
String shorten = arena.arenaName;
|
||||||
arenaname = arena.arenaName;
|
arenaname = arena.arenaName;
|
||||||
if (shorten.length() > 6)
|
if (shorten.length() > 6) {
|
||||||
shorten = shorten.substring(0, 6);
|
shorten = shorten.substring(0, 6);
|
||||||
Inventory panel = Bukkit.createInventory(null, 54, MessageManager.replaceAll("\u00A7r%N&lBlockHunt Arena: %A" + shorten));
|
}
|
||||||
|
Inventory panel = Bukkit.createInventory(null, 54, MessageManager.replaceAll("\u00A7r%N&lBlockHunt Arena: %A" + shorten));
|
||||||
|
|
||||||
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
||||||
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
||||||
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NBlockHunt arena: %A" + arena.arenaName));
|
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NBlockHunt arena: %A" + arena.arenaName));
|
||||||
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
||||||
panel.setItem(0, arenaNameNote);
|
panel.setItem(0, arenaNameNote);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
ItemStack maxPlayers_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack maxPlayers_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack maxPlayers = new ItemStack(Material.BEDROCK, arena.maxPlayers);
|
ItemStack maxPlayers = new ItemStack(Material.BEDROCK, arena.maxPlayers);
|
||||||
ItemStack maxPlayers_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack maxPlayers_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack minPlayers_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack minPlayers_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack minPlayers = new ItemStack(Material.BEDROCK, arena.minPlayers);
|
ItemStack minPlayers = new ItemStack(Material.BEDROCK, arena.minPlayers);
|
||||||
ItemStack minPlayers_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack minPlayers_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack amountSeekersOnStart_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack amountSeekersOnStart_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack amountSeekersOnStart = new ItemStack(Material.BEDROCK, arena.amountSeekersOnStart);
|
ItemStack amountSeekersOnStart = new ItemStack(Material.BEDROCK, arena.amountSeekersOnStart);
|
||||||
ItemStack amountSeekersOnStart_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack amountSeekersOnStart_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack timeInLobbyUntilStart_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack timeInLobbyUntilStart_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack timeInLobbyUntilStart = new ItemStack(Material.BEDROCK, arena.timeInLobbyUntilStart);
|
ItemStack timeInLobbyUntilStart = new ItemStack(Material.BEDROCK, arena.timeInLobbyUntilStart);
|
||||||
ItemStack timeInLobbyUntilStart_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack timeInLobbyUntilStart_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack waitingTimeSeeker_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack waitingTimeSeeker_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack waitingTimeSeeker = new ItemStack(Material.BEDROCK, arena.waitingTimeSeeker);
|
ItemStack waitingTimeSeeker = new ItemStack(Material.BEDROCK, arena.waitingTimeSeeker);
|
||||||
ItemStack waitingTimeSeeker_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack waitingTimeSeeker_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack gameTime_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack gameTime_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack gameTime = new ItemStack(Material.BEDROCK, arena.gameTime);
|
ItemStack gameTime = new ItemStack(Material.BEDROCK, arena.gameTime);
|
||||||
ItemStack gameTime_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack gameTime_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack disguiseBlocks_NOTE = new ItemStack(Material.BOOK, 1);
|
ItemStack disguiseBlocks_NOTE = new ItemStack(Material.BOOK, 1);
|
||||||
ItemMeta disguiseBlocks_NOTE_IM = disguiseBlocks_NOTE.getItemMeta();
|
ItemMeta disguiseBlocks_NOTE_IM = disguiseBlocks_NOTE.getItemMeta();
|
||||||
disguiseBlocks_NOTE_IM.setDisplayName(MessageManager.replaceAll("%NSet the %AdisguiseBlocks%N."));
|
disguiseBlocks_NOTE_IM.setDisplayName(MessageManager.replaceAll("%NSet the %AdisguiseBlocks%N."));
|
||||||
disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM);
|
disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM);
|
||||||
panel.setItem(36, disguiseBlocks_NOTE);
|
panel.setItem(36, disguiseBlocks_NOTE);
|
||||||
|
|
||||||
ItemStack blockAnnouncerTime_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack blockAnnouncerTime_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack blockAnnouncerTime = new ItemStack(Material.BEDROCK, arena.blockAnnouncerTime);
|
ItemStack blockAnnouncerTime = new ItemStack(Material.BEDROCK, arena.blockAnnouncerTime);
|
||||||
ItemStack blockAnnouncerTime_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack blockAnnouncerTime_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack timeUntilHidersSword_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack timeUntilHidersSword_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack timeUntilHidersSword = new ItemStack(Material.BEDROCK, arena.timeUntilHidersSword);
|
ItemStack timeUntilHidersSword = new ItemStack(Material.BEDROCK, arena.timeUntilHidersSword);
|
||||||
ItemStack timeUntilHidersSword_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack timeUntilHidersSword_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack hidersTokenWin_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack hidersTokenWin_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack hidersTokenWin = new ItemStack(Material.BEDROCK, arena.hidersTokenWin);
|
ItemStack hidersTokenWin = new ItemStack(Material.BEDROCK, arena.hidersTokenWin);
|
||||||
ItemStack hidersTokenWin_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack hidersTokenWin_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack seekersTokenWin_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack seekersTokenWin_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack seekersTokenWin = new ItemStack(Material.BEDROCK, arena.seekersTokenWin);
|
ItemStack seekersTokenWin = new ItemStack(Material.BEDROCK, arena.seekersTokenWin);
|
||||||
ItemStack seekersTokenWin_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack seekersTokenWin_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
ItemStack killTokens_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack killTokens_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
ItemStack killTokens = new ItemStack(Material.BEDROCK, arena.killTokens);
|
ItemStack killTokens = new ItemStack(Material.BEDROCK, arena.killTokens);
|
||||||
ItemStack killTokens_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
ItemStack killTokens_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.maxPlayers, "maxPlayers", "1", maxPlayers_UP, maxPlayers, maxPlayers_DOWN, 1, 10, 19);
|
updownButton(panel, arena, ArenaType.maxPlayers, "maxPlayers", "1", maxPlayers_UP, maxPlayers, maxPlayers_DOWN, 1, 10, 19);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.minPlayers, "minPlayers", "1", minPlayers_UP, minPlayers, minPlayers_DOWN, 2, 11, 20);
|
updownButton(panel, arena, ArenaType.minPlayers, "minPlayers", "1", minPlayers_UP, minPlayers, minPlayers_DOWN, 2, 11, 20);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.amountSeekersOnStart, "amountSeekersOnStart", "1", amountSeekersOnStart_UP, amountSeekersOnStart,
|
updownButton(panel, arena, ArenaType.amountSeekersOnStart, "amountSeekersOnStart", "1", amountSeekersOnStart_UP, amountSeekersOnStart,
|
||||||
amountSeekersOnStart_DOWN, 4, 13, 22);
|
amountSeekersOnStart_DOWN, 4, 13, 22);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.timeInLobbyUntilStart, "timeInLobbyUntilStart", "1 %Nsecond", timeInLobbyUntilStart_UP, timeInLobbyUntilStart,
|
updownButton(panel, arena, ArenaType.timeInLobbyUntilStart, "timeInLobbyUntilStart", "1 %Nsecond", timeInLobbyUntilStart_UP, timeInLobbyUntilStart,
|
||||||
timeInLobbyUntilStart_DOWN, 6, 15, 24);
|
timeInLobbyUntilStart_DOWN, 6, 15, 24);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.waitingTimeSeeker, "waitingTimeSeeker", "1 %Nsecond", waitingTimeSeeker_UP, waitingTimeSeeker, waitingTimeSeeker_DOWN,
|
updownButton(panel, arena, ArenaType.waitingTimeSeeker, "waitingTimeSeeker", "1 %Nsecond", waitingTimeSeeker_UP, waitingTimeSeeker, waitingTimeSeeker_DOWN,
|
||||||
7, 16, 25);
|
7, 16, 25);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.gameTime, "gameTime", "1 %Nsecond", gameTime_UP, gameTime, gameTime_DOWN, 8, 17, 26);
|
updownButton(panel, arena, ArenaType.gameTime, "gameTime", "1 %Nsecond", gameTime_UP, gameTime, gameTime_DOWN, 8, 17, 26);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.blockAnnouncerTime, "blockAnnouncerTime", "5 %Nseconds", blockAnnouncerTime_UP, blockAnnouncerTime,
|
updownButton(panel, arena, ArenaType.blockAnnouncerTime, "blockAnnouncerTime", "5 %Nseconds", blockAnnouncerTime_UP, blockAnnouncerTime,
|
||||||
blockAnnouncerTime_DOWN, 29, 38, 47);
|
blockAnnouncerTime_DOWN, 29, 38, 47);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.timeUntilHidersSword, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword,
|
updownButton(panel, arena, ArenaType.timeUntilHidersSword, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword,
|
||||||
timeUntilHidersSword_DOWN, 30, 39, 48);
|
timeUntilHidersSword_DOWN, 30, 39, 48);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.hidersTokenWin, "hidersTokenWin", "1 %Ntoken", hidersTokenWin_UP, hidersTokenWin, hidersTokenWin_DOWN, 32, 41, 50);
|
updownButton(panel, arena, ArenaType.hidersTokenWin, "hidersTokenWin", "1 %Ntoken", hidersTokenWin_UP, hidersTokenWin, hidersTokenWin_DOWN, 32, 41, 50);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.seekersTokenWin, "seekersTokenWin", "1 %Ntoken", seekersTokenWin_UP, seekersTokenWin, seekersTokenWin_DOWN, 33, 42, 51);
|
updownButton(panel, arena, ArenaType.seekersTokenWin, "seekersTokenWin", "1 %Ntoken", seekersTokenWin_UP, seekersTokenWin, seekersTokenWin_DOWN, 33, 42, 51);
|
||||||
|
|
||||||
updownButton(panel, arena, ArenaType.killTokens, "killTokens", "1 %Ntoken", killTokens_UP, killTokens, killTokens_DOWN, 34, 43, 52);
|
updownButton(panel, arena, ArenaType.killTokens, "killTokens", "1 %Ntoken", killTokens_UP, killTokens, killTokens_DOWN, 34, 43, 52);
|
||||||
|
|
||||||
player.openInventory(panel);
|
player.openInventory(panel);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updownButton(Inventory panel, Arena arena, ArenaType at, String option, String addremove, ItemStack UP, ItemStack BUTTON, ItemStack DOWN, int up,
|
public static void updownButton(Inventory panel, Arena arena, ArenaType at, String option, String addremove, ItemStack UP, ItemStack BUTTON, ItemStack DOWN, int up,
|
||||||
int button, int down) {
|
int button, int down) {
|
||||||
ItemMeta UP_IM = UP.getItemMeta();
|
ItemMeta UP_IM = UP.getItemMeta();
|
||||||
UP_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option));
|
UP_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option));
|
||||||
UP.setItemMeta(UP_IM);
|
UP.setItemMeta(UP_IM);
|
||||||
|
|
||||||
int setting = 0;
|
int setting = 0;
|
||||||
switch (at) {
|
switch (at) {
|
||||||
case maxPlayers:
|
case maxPlayers:
|
||||||
setting = arena.maxPlayers;
|
setting = arena.maxPlayers;
|
||||||
break;
|
break;
|
||||||
case minPlayers:
|
case minPlayers:
|
||||||
setting = arena.minPlayers;
|
setting = arena.minPlayers;
|
||||||
break;
|
break;
|
||||||
case amountSeekersOnStart:
|
case amountSeekersOnStart:
|
||||||
setting = arena.amountSeekersOnStart;
|
setting = arena.amountSeekersOnStart;
|
||||||
break;
|
break;
|
||||||
case timeInLobbyUntilStart:
|
case timeInLobbyUntilStart:
|
||||||
setting = arena.timeInLobbyUntilStart;
|
setting = arena.timeInLobbyUntilStart;
|
||||||
break;
|
break;
|
||||||
case waitingTimeSeeker:
|
case waitingTimeSeeker:
|
||||||
setting = arena.waitingTimeSeeker;
|
setting = arena.waitingTimeSeeker;
|
||||||
break;
|
break;
|
||||||
case gameTime:
|
case gameTime:
|
||||||
setting = arena.gameTime;
|
setting = arena.gameTime;
|
||||||
break;
|
break;
|
||||||
case timeUntilHidersSword:
|
case timeUntilHidersSword:
|
||||||
setting = arena.timeUntilHidersSword;
|
setting = arena.timeUntilHidersSword;
|
||||||
break;
|
break;
|
||||||
case blockAnnouncerTime:
|
case blockAnnouncerTime:
|
||||||
setting = arena.blockAnnouncerTime;
|
setting = arena.blockAnnouncerTime;
|
||||||
break;
|
break;
|
||||||
case hidersTokenWin:
|
case hidersTokenWin:
|
||||||
setting = arena.hidersTokenWin;
|
setting = arena.hidersTokenWin;
|
||||||
break;
|
break;
|
||||||
case seekersTokenWin:
|
case seekersTokenWin:
|
||||||
setting = arena.seekersTokenWin;
|
setting = arena.seekersTokenWin;
|
||||||
break;
|
break;
|
||||||
case killTokens:
|
case killTokens:
|
||||||
setting = arena.killTokens;
|
setting = arena.killTokens;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemMeta BUTTON_IM = BUTTON.getItemMeta();
|
ItemMeta BUTTON_IM = BUTTON.getItemMeta();
|
||||||
BUTTON_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting));
|
BUTTON_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting));
|
||||||
BUTTON.setItemMeta(BUTTON_IM);
|
BUTTON.setItemMeta(BUTTON_IM);
|
||||||
|
|
||||||
ItemMeta DOWN_IM = DOWN.getItemMeta();
|
ItemMeta DOWN_IM = DOWN.getItemMeta();
|
||||||
DOWN_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option));
|
DOWN_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option));
|
||||||
DOWN.setItemMeta(DOWN_IM);
|
DOWN.setItemMeta(DOWN_IM);
|
||||||
|
|
||||||
panel.setItem(up, UP);
|
panel.setItem(up, UP);
|
||||||
panel.setItem(button, BUTTON);
|
panel.setItem(button, BUTTON);
|
||||||
panel.setItem(down, DOWN);
|
panel.setItem(down, DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openDisguiseBlocks(Arena arena, Player player) {
|
public static void openDisguiseBlocks(Arena arena, Player player) {
|
||||||
String arenaname = arena.arenaName;
|
String arenaname = arena.arenaName;
|
||||||
Inventory panel = Bukkit.createInventory(null, 36, MessageManager.replaceAll("%N&lDisguiseBlocks"));
|
Inventory panel = Bukkit.createInventory(null, 36, MessageManager.replaceAll("%N&lDisguiseBlocks"));
|
||||||
|
|
||||||
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
||||||
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
||||||
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname));
|
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname));
|
||||||
ArrayList<String> lores = new ArrayList<>();
|
ArrayList<String> lores = new ArrayList<>();
|
||||||
lores.add(MessageManager.replaceAll("%NPlace the DisguiseBlocks inside this inventory."));
|
lores.add(MessageManager.replaceAll("%NPlace the DisguiseBlocks inside this inventory."));
|
||||||
arenaNameNote_IM.setLore(lores);
|
arenaNameNote_IM.setLore(lores);
|
||||||
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
||||||
panel.setItem(0, arenaNameNote);
|
panel.setItem(0, arenaNameNote);
|
||||||
if (arena.disguiseBlocks != null) {
|
if (arena.disguiseBlocks != null) {
|
||||||
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
||||||
panel.setItem(i, arena.disguiseBlocks.get(i - 1));
|
panel.setItem(i, arena.disguiseBlocks.get(i - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.openInventory(panel);
|
player.openInventory(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openShop(Player player) {
|
public static void openShop(Player player) {
|
||||||
Inventory shop = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)));
|
Inventory shop = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)));
|
||||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
List<String> lores = new ArrayList<>();
|
List<String> lores = new ArrayList<>();
|
||||||
List<String> lores2 = new ArrayList<>();
|
List<String> lores2 = new ArrayList<>();
|
||||||
|
|
||||||
ItemStack shopTokens = new ItemStack(Material.EMERALD, 1);
|
ItemStack shopTokens = new ItemStack(Material.EMERALD, 1);
|
||||||
ItemMeta shopTokens_IM = shopTokens.getItemMeta();
|
ItemMeta shopTokens_IM = shopTokens.getItemMeta();
|
||||||
shopTokens_IM.setDisplayName(MessageManager.replaceAll("%N&lTokens: %A" + playerTokens));
|
shopTokens_IM.setDisplayName(MessageManager.replaceAll("%N&lTokens: %A" + playerTokens));
|
||||||
shopTokens.setItemMeta(shopTokens_IM);
|
shopTokens.setItemMeta(shopTokens_IM);
|
||||||
|
|
||||||
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
||||||
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
||||||
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
||||||
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
||||||
lores2 = new ArrayList<>();
|
lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
}
|
}
|
||||||
|
|
||||||
lores2.add(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_price), "amount-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)));
|
lores2.add(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_price), "amount-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)));
|
||||||
|
|
||||||
shopBlockChooser_IM.setLore(lores2);
|
shopBlockChooser_IM.setLore(lores2);
|
||||||
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
||||||
|
|
||||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1);
|
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1);
|
||||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||||
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
||||||
lores2 = new ArrayList<>();
|
lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
}
|
}
|
||||||
|
|
||||||
lores2.add(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_price), "amount-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price)));
|
lores2.add(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_price), "amount-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price)));
|
||||||
|
|
||||||
shopBlockHuntPass_IM.setLore(lores2);
|
shopBlockHuntPass_IM.setLore(lores2);
|
||||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||||
|
|
||||||
shop.setItem(0, shopTokens);
|
shop.setItem(0, shopTokens);
|
||||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)
|
||||||
&& (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) {
|
&& (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) {
|
||||||
shop.setItem(1, shopBlockChooser);
|
shop.setItem(1, shopBlockChooser);
|
||||||
}
|
}
|
||||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
||||||
shop.setItem(2, shopBlockHuntPass);
|
shop.setItem(2, shopBlockHuntPass);
|
||||||
}
|
}
|
||||||
player.openInventory(shop);
|
player.openInventory(shop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,18 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
|
|
||||||
public class OnBlockBreakEvent implements Listener {
|
public class OnBlockBreakEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockBreakEvent(BlockBreakEvent event) {
|
public void onBlockBreakEvent(BlockBreakEvent event) {
|
||||||
// Early exit if no one is in any arena
|
// Early exit if no one is in any arena
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -12,16 +11,18 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||||||
|
|
||||||
public class OnBlockPlaceEvent implements Listener {
|
public class OnBlockPlaceEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockPlaceEvent(BlockPlaceEvent event) {
|
public void onBlockPlaceEvent(BlockPlaceEvent event) {
|
||||||
// Early exit if no one is in any arena
|
// Early exit if no one is in any arena
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import nl.Steffion.BlockHunt.*;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
import nl.Steffion.BlockHunt.PlayerHandler;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -21,148 +21,156 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class OnEntityDamageByEntityEvent implements Listener {
|
public class OnEntityDamageByEntityEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||||
if (!(event.getEntity() instanceof Player) || event.getEntity() == null) {
|
if (!(event.getEntity() instanceof Player) || event.getEntity() == null) {
|
||||||
// We only care about player damage
|
// We only care about player damage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Early exit if no one is in any arena
|
// Early exit if no one is in any arena
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
Player damager = null;
|
Player damager = null;
|
||||||
if (event.getDamager() instanceof Player) {
|
if (event.getDamager() instanceof Player) {
|
||||||
damager = (Player) event.getDamager();
|
damager = (Player) event.getDamager();
|
||||||
} else {
|
} else {
|
||||||
if ((event.getCause() == DamageCause.PROJECTILE) && (event.getDamager() instanceof Arrow)) {
|
if ((event.getCause() == DamageCause.PROJECTILE) && (event.getDamager() instanceof Arrow)) {
|
||||||
// If damage was caused by an arrow, find out who shot the arrow
|
// If damage was caused by an arrow, find out who shot the arrow
|
||||||
Arrow arrow = (Arrow) event.getDamager();
|
Arrow arrow = (Arrow) event.getDamager();
|
||||||
ProjectileSource shooter = arrow.getShooter();
|
ProjectileSource shooter = arrow.getShooter();
|
||||||
if (shooter instanceof Player) {
|
if (shooter instanceof Player) {
|
||||||
damager = (Player) shooter;
|
damager = (Player) shooter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always block all damage not dealt by a player
|
// Always block all damage not dealt by a player
|
||||||
if (damager == null || !(damager instanceof Player)) {
|
if (damager == null || !(damager instanceof Player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||||
// Always cancel damage when players are waiting
|
// Always cancel damage when players are waiting
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Seeker receiving damage
|
// Seeker receiving damage
|
||||||
if (arena.seekers.contains(player)) {
|
if (arena.seekers.contains(player)) {
|
||||||
if (arena.seekers.contains(damager)) {
|
if (arena.seekers.contains(damager)) {
|
||||||
// Seeker damaged by seeker
|
// Seeker damaged by seeker
|
||||||
if (!arena.seekersCanHurtSeekers) {
|
if (!arena.seekersCanHurtSeekers) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Seeker damaged by hider
|
// Seeker damaged by hider
|
||||||
if (!arena.hidersCanHurtSeekers) {
|
if (!arena.hidersCanHurtSeekers) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Hider damaged by hider
|
// Hider damaged by hider
|
||||||
if (!arena.hidersCanHurtHiders && !arena.seekers.contains(damager)) {
|
if (!arena.hidersCanHurtHiders && !arena.seekers.contains(damager)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The damage is allowed, so lets handle it!
|
// The damage is allowed, so lets handle it!
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
||||||
|
|
||||||
if (event.getDamage() >= player.getHealth()) {
|
if (event.getDamage() >= player.getHealth()) {
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
// try moving everything to the next tick to prevent "Removing entity while ticking" errors
|
// try moving everything to the next tick to prevent "Removing entity while ticking" errors
|
||||||
Player finalDamager = damager;
|
Player finalDamager = damager;
|
||||||
player.getServer().getScheduler().runTask(BlockHunt.plugin, () -> {
|
player.getServer().getScheduler().runTask(BlockHunt.plugin, () -> {
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
MemoryStorage.pBlock.remove(player);
|
MemoryStorage.pBlock.remove(player);
|
||||||
|
|
||||||
if (!arena.seekers.contains(player)) {
|
if (!arena.seekers.contains(player)) {
|
||||||
if (MemoryStorage.shop.getFile().get(finalDamager.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(finalDamager.getName() + ".tokens") == null) {
|
||||||
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", 0);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int damagerTokens = MemoryStorage.shop.getFile().getInt(finalDamager.getName() + ".tokens");
|
int damagerTokens = MemoryStorage.shop.getFile().getInt(finalDamager.getName() + ".tokens");
|
||||||
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", damagerTokens + arena.killTokens);
|
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", damagerTokens + arena.killTokens);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
MessageManager.sendFMessage(finalDamager, ConfigC.normal_addedToken, "amount-" + arena.killTokens);
|
MessageManager.sendFMessage(finalDamager, ConfigC.normal_addedToken, "amount-" + arena.killTokens);
|
||||||
|
|
||||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
float addingTokens = ((float) arena.hidersTokenWin - (((float) arena.timer / (float) arena.gameTime) * (float) arena.hidersTokenWin));
|
float addingTokens = ((float) arena.hidersTokenWin - (((float) arena.timer / (float) arena.gameTime) * (float) arena.hidersTokenWin));
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + (int) addingTokens);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + (int) addingTokens);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens);
|
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens);
|
||||||
|
|
||||||
arena.seekers.add(player);
|
arena.seekers.add(player);
|
||||||
player.setWalkSpeed(0.3F);
|
player.setWalkSpeed(0.3F);
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHiderDied, "playername-" + player.getDisplayName(), "killer-" + finalDamager.getDisplayName());
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHiderDied, "playername-" + player.getDisplayName(), "killer-" + finalDamager.getDisplayName());
|
||||||
|
|
||||||
int hidercount = (arena.playersInArena.size() - arena.seekers.size());
|
int hidercount = (arena.playersInArena.size() - arena.seekers.size());
|
||||||
if ((hidercount <= 3) && (hidercount > 0)) {
|
if ((hidercount <= 3) && (hidercount > 0)) {
|
||||||
List<String> hiders = new ArrayList<>();
|
List<String> hiders = new ArrayList<>();
|
||||||
for (Player p : arena.playersInArena) {
|
for (Player p : arena.playersInArena) {
|
||||||
if (!arena.seekers.contains(p)) {
|
if (!arena.seekers.contains(p)) {
|
||||||
hiders.add(p.getName());
|
hiders.add(p.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(hiders);
|
Collections.sort(hiders);
|
||||||
|
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + StringUtils.join(hiders.toArray(), ", "));
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + StringUtils.join(hiders.toArray(), ", "));
|
||||||
} else {
|
} else {
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + hidercount);
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + hidercount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
|
|
||||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||||
ArenaHandler.seekersWin(arena);
|
ArenaHandler.seekersWin(arena);
|
||||||
} else {
|
} else {
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
MemoryStorage.seekertime.put(player, arena.waitingTimeSeeker);
|
MemoryStorage.seekertime.put(player, arena.waitingTimeSeeker);
|
||||||
PlayerHandler.teleport(player, arena.seekersWarp);
|
PlayerHandler.teleport(player, arena.seekersWarp);
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
player.setWalkSpeed(0.3F);
|
player.setWalkSpeed(0.3F);
|
||||||
|
|
||||||
// Fix for client not showing players after they join
|
// Fix for client not showing players after they join
|
||||||
for (Player otherplayer : arena.playersInArena) {
|
for (Player otherplayer : arena.playersInArena) {
|
||||||
if (otherplayer.canSee(player))
|
if (otherplayer.canSee(player)) {
|
||||||
otherplayer.showPlayer(BlockHunt.plugin, player); // Make new player visible to others
|
otherplayer.showPlayer(BlockHunt.plugin, player); // Make new player visible to others
|
||||||
if (player.canSee(otherplayer))
|
}
|
||||||
player.showPlayer(BlockHunt.plugin, otherplayer); // Make other players visible to new player
|
if (player.canSee(otherplayer)) {
|
||||||
}
|
player.showPlayer(BlockHunt.plugin, otherplayer); // Make other players visible to new player
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -14,47 +13,49 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|||||||
|
|
||||||
public class OnEntityDamageEvent implements Listener {
|
public class OnEntityDamageEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityDamageEvent(EntityDamageEvent event) {
|
public void onEntityDamageEvent(EntityDamageEvent event) {
|
||||||
// Early exit if no one is in any arena
|
// Early exit if no one is in any arena
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Entity ent = event.getEntity();
|
Entity ent = event.getEntity();
|
||||||
if (ent instanceof Player) {
|
if (ent instanceof Player) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
DamageCause cause = event.getCause();
|
DamageCause cause = event.getCause();
|
||||||
switch (cause) {
|
switch (cause) {
|
||||||
case ENTITY_ATTACK:
|
case ENTITY_ATTACK:
|
||||||
case PROJECTILE:
|
case PROJECTILE:
|
||||||
// Do nothing about damage from an entity
|
// Do nothing about damage from an entity
|
||||||
// Any entity damage that makes it to here was already allowed by the EntityDamageByEntity event
|
// Any entity damage that makes it to here was already allowed by the EntityDamageByEntity event
|
||||||
break;
|
break;
|
||||||
case FALL:
|
case FALL:
|
||||||
// Should we prevent the fall damage?
|
// Should we prevent the fall damage?
|
||||||
if (arena.seekers.contains(player)) {
|
if (arena.seekers.contains(player)) {
|
||||||
if (!arena.seekersTakeFallDamage) {
|
if (!arena.seekersTakeFallDamage) {
|
||||||
// Prevent seeker fall damage (if configured)
|
// Prevent seeker fall damage (if configured)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!arena.hidersTakeFallDamage) {
|
if (!arena.hidersTakeFallDamage) {
|
||||||
// Prevent hider fall damage (if configured)
|
// Prevent hider fall damage (if configured)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Cancel all non-entity damage for all players (lava, drowning, fire, etc)
|
// Cancel all non-entity damage for all players (lava, drowning, fire, etc)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -11,14 +10,14 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
|||||||
|
|
||||||
public class OnFoodLevelChangeEvent implements Listener {
|
public class OnFoodLevelChangeEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onFoodLevelChangeEvent(FoodLevelChangeEvent event) {
|
public void onFoodLevelChangeEvent(FoodLevelChangeEvent event) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.*;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
|
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -20,299 +22,306 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class OnInventoryClickEvent implements Listener {
|
public class OnInventoryClickEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Inventory inv = event.getInventory();
|
Inventory inv = event.getInventory();
|
||||||
InventoryView invView = event.getView();
|
InventoryView invView = event.getView();
|
||||||
if (inv.getType().equals(InventoryType.CHEST)) {
|
if (inv.getType().equals(InventoryType.CHEST)) {
|
||||||
if (invView.getTitle().contains("DisguiseBlocks")) {
|
if (invView.getTitle().contains("DisguiseBlocks")) {
|
||||||
if (event.getCurrentItem() != null) {
|
if (event.getCurrentItem() != null) {
|
||||||
if (!event.getCurrentItem().getType().isBlock()) {
|
if (!event.getCurrentItem().getType().isBlock()) {
|
||||||
if (!event.getCurrentItem().getType().equals(Material.FLOWER_POT)) {
|
if (!event.getCurrentItem().getType().equals(Material.FLOWER_POT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Early exit if this isnt a blockhunt inventory
|
// Early exit if this isnt a blockhunt inventory
|
||||||
if (!invView.getTitle().contains("BlockHunt"))
|
if (!invView.getTitle().contains("BlockHunt")) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (invView.getTitle().startsWith("\u00A7r")) {
|
if (invView.getTitle().startsWith("\u00A7r")) {
|
||||||
if (invView.getTitle().equals(MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)))) {
|
if (invView.getTitle().equals(MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
ItemStack item = event.getCurrentItem();
|
ItemStack item = event.getCurrentItem();
|
||||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
if (item == null)
|
if (item == null) {
|
||||||
return;
|
return;
|
||||||
if (item.getType().equals(Material.AIR))
|
}
|
||||||
return;
|
if (item.getType().equals(Material.AIR)) {
|
||||||
if (item.getItemMeta().getDisplayName() == null)
|
return;
|
||||||
return;
|
}
|
||||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name).toString()))) {
|
if (item.getItemMeta().getDisplayName() == null) {
|
||||||
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)) {
|
return;
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockchooser", true);
|
}
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price));
|
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name).toString()))) {
|
||||||
MemoryStorage.shop.save();
|
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name));
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockchooser", true);
|
||||||
} else {
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price));
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
MemoryStorage.shop.save();
|
||||||
}
|
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name));
|
||||||
} else if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) {
|
} else {
|
||||||
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price)) {
|
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockhuntpass") == null) {
|
}
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", 0);
|
} else if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) {
|
||||||
MemoryStorage.shop.save();
|
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price)) {
|
||||||
}
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockhuntpass") == null) {
|
||||||
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", 0);
|
||||||
|
MemoryStorage.shop.save();
|
||||||
|
}
|
||||||
|
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", (Integer) MemoryStorage.shop.getFile().get(player.getName() + ".blockhuntpass") + 1);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", (Integer) MemoryStorage.shop.getFile().get(player.getName() + ".blockhuntpass") + 1);
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price));
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price));
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name));
|
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name));
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryHandler.openShop(player);
|
InventoryHandler.openShop(player);
|
||||||
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (event.getCurrentItem() != null) {
|
if (event.getCurrentItem() != null) {
|
||||||
if (event.getCurrentItem().getType().isBlock()) {
|
if (event.getCurrentItem().getType().isBlock()) {
|
||||||
MemoryStorage.choosenBlock.put(player, event.getCurrentItem());
|
MemoryStorage.choosenBlock.put(player, event.getCurrentItem());
|
||||||
String blockName = event.getCurrentItem().getType().name();
|
String blockName = event.getCurrentItem().getType().name();
|
||||||
blockName = WordUtils.capitalizeFully(blockName.replace("_", " "));
|
blockName = WordUtils.capitalizeFully(blockName.replace("_", " "));
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-"
|
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-"
|
||||||
+ blockName);
|
+ blockName);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (event.getCurrentItem() != null) {
|
if (event.getCurrentItem() != null) {
|
||||||
if (event.getCurrentItem().getType().equals(Material.BLUE_WOOL)) {
|
if (event.getCurrentItem().getType().equals(Material.BLUE_WOOL)) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
for (Player playerCheck : arena.playersInArena) {
|
for (Player playerCheck : arena.playersInArena) {
|
||||||
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||||
if (MemoryStorage.choosenSeeker.get(playerCheck)) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= arena.amountSeekersOnStart) {
|
if (i >= arena.amountSeekersOnStart) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached);
|
MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached);
|
||||||
} else {
|
} else {
|
||||||
MemoryStorage.choosenSeeker.put(player, true);
|
MemoryStorage.choosenSeeker.put(player, true);
|
||||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker);
|
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker);
|
||||||
inv.clear();
|
inv.clear();
|
||||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
} else {
|
} else {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (event.getCurrentItem().getType().equals(Material.RED_WOOL)) {
|
} else if (event.getCurrentItem().getType().equals(Material.RED_WOOL)) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
for (Player playerCheck : arena.playersInArena) {
|
for (Player playerCheck : arena.playersInArena) {
|
||||||
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||||
if (!MemoryStorage.choosenSeeker.get(playerCheck)) {
|
if (!MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= (arena.playersInArena.size() - 1)) {
|
if (i >= (arena.playersInArena.size() - 1)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached);
|
MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached);
|
||||||
} else {
|
} else {
|
||||||
MemoryStorage.choosenSeeker.put(player, false);
|
MemoryStorage.choosenSeeker.put(player, false);
|
||||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders);
|
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders);
|
||||||
inv.clear();
|
inv.clear();
|
||||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
} else {
|
} else {
|
||||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||||
MemoryStorage.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
ItemStack item = event.getCurrentItem();
|
ItemStack item = event.getCurrentItem();
|
||||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NBlockHunt arena: %A"), "");
|
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NBlockHunt arena: %A"), "");
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item == null) {
|
||||||
return;
|
return;
|
||||||
if (item.getType().equals(Material.AIR))
|
}
|
||||||
return;
|
if (item.getType().equals(Material.AIR)) {
|
||||||
if (!item.getItemMeta().hasDisplayName())
|
return;
|
||||||
return;
|
}
|
||||||
if (item.getType().equals(Material.GOLD_NUGGET)) {
|
if (!item.getItemMeta().hasDisplayName()) {
|
||||||
if (item.getItemMeta().getDisplayName().contains("maxPlayers")) {
|
return;
|
||||||
updownButton(player, item, arena, ArenaType.maxPlayers, arena.maxPlayers, Bukkit.getMaxPlayers(), 2, 1, 1);
|
}
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("minPlayers")) {
|
if (item.getType().equals(Material.GOLD_NUGGET)) {
|
||||||
updownButton(player, item, arena, ArenaType.minPlayers, arena.minPlayers, Bukkit.getMaxPlayers() - 1, 2, 1, 1);
|
if (item.getItemMeta().getDisplayName().contains("maxPlayers")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("amountSeekersOnStart")) {
|
updownButton(player, item, arena, ArenaType.maxPlayers, arena.maxPlayers, Bukkit.getMaxPlayers(), 2, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.amountSeekersOnStart, arena.amountSeekersOnStart, arena.maxPlayers - 1, 1, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("minPlayers")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("timeInLobbyUntilStart")) {
|
updownButton(player, item, arena, ArenaType.minPlayers, arena.minPlayers, Bukkit.getMaxPlayers() - 1, 2, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.timeInLobbyUntilStart, arena.timeInLobbyUntilStart, 1000, 5, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("amountSeekersOnStart")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("waitingTimeSeeker")) {
|
updownButton(player, item, arena, ArenaType.amountSeekersOnStart, arena.amountSeekersOnStart, arena.maxPlayers - 1, 1, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.waitingTimeSeeker, arena.waitingTimeSeeker, 1000, 5, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("timeInLobbyUntilStart")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("gameTime")) {
|
updownButton(player, item, arena, ArenaType.timeInLobbyUntilStart, arena.timeInLobbyUntilStart, 1000, 5, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.gameTime, arena.gameTime, 1000, 5, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("waitingTimeSeeker")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("blockAnnouncerTime")) {
|
updownButton(player, item, arena, ArenaType.waitingTimeSeeker, arena.waitingTimeSeeker, 1000, 5, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.blockAnnouncerTime, arena.blockAnnouncerTime, 1000, 0, 5, 5);
|
} else if (item.getItemMeta().getDisplayName().contains("gameTime")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("timeUntilHidersSword")) {
|
updownButton(player, item, arena, ArenaType.gameTime, arena.gameTime, 1000, 5, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.timeUntilHidersSword, arena.timeUntilHidersSword, 1000, 0, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("blockAnnouncerTime")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("hidersTokenWin")) {
|
updownButton(player, item, arena, ArenaType.blockAnnouncerTime, arena.blockAnnouncerTime, 1000, 0, 5, 5);
|
||||||
updownButton(player, item, arena, ArenaType.hidersTokenWin, arena.hidersTokenWin, 1000, 0, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("timeUntilHidersSword")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("seekersTokenWin")) {
|
updownButton(player, item, arena, ArenaType.timeUntilHidersSword, arena.timeUntilHidersSword, 1000, 0, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.seekersTokenWin, arena.seekersTokenWin, 1000, 0, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("hidersTokenWin")) {
|
||||||
} else if (item.getItemMeta().getDisplayName().contains("killTokens")) {
|
updownButton(player, item, arena, ArenaType.hidersTokenWin, arena.hidersTokenWin, 1000, 0, 1, 1);
|
||||||
updownButton(player, item, arena, ArenaType.killTokens, arena.killTokens, 1000, 0, 1, 1);
|
} else if (item.getItemMeta().getDisplayName().contains("seekersTokenWin")) {
|
||||||
}
|
updownButton(player, item, arena, ArenaType.seekersTokenWin, arena.seekersTokenWin, 1000, 0, 1, 1);
|
||||||
|
} else if (item.getItemMeta().getDisplayName().contains("killTokens")) {
|
||||||
|
updownButton(player, item, arena, ArenaType.killTokens, arena.killTokens, 1000, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
save(arena);
|
save(arena);
|
||||||
InventoryHandler.openPanel(player, arena.arenaName);
|
InventoryHandler.openPanel(player, arena.arenaName);
|
||||||
|
|
||||||
} else if (item.getType().equals(Material.BOOK)) {
|
} else if (item.getType().equals(Material.BOOK)) {
|
||||||
if (item.getItemMeta().getDisplayName().contains("disguiseBlocks")) {
|
if (item.getItemMeta().getDisplayName().contains("disguiseBlocks")) {
|
||||||
InventoryHandler.openDisguiseBlocks(arena, player);
|
InventoryHandler.openDisguiseBlocks(arena, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(Arena arena) {
|
public void save(Arena arena) {
|
||||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||||
MemoryStorage.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updownButton(Player player, ItemStack item, Arena arena, ArenaType at, int option, int max, int min, int add, int remove) {
|
public static void updownButton(Player player, ItemStack item, Arena arena, ArenaType at, int option, int max, int min, int add, int remove) {
|
||||||
if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_add2))) {
|
if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_add2))) {
|
||||||
if (option < max) {
|
if (option < max) {
|
||||||
switch (at) {
|
switch (at) {
|
||||||
case maxPlayers:
|
case maxPlayers:
|
||||||
arena.maxPlayers = option + add;
|
arena.maxPlayers = option + add;
|
||||||
break;
|
break;
|
||||||
case minPlayers:
|
case minPlayers:
|
||||||
arena.minPlayers = option + add;
|
arena.minPlayers = option + add;
|
||||||
break;
|
break;
|
||||||
case amountSeekersOnStart:
|
case amountSeekersOnStart:
|
||||||
arena.amountSeekersOnStart = option + add;
|
arena.amountSeekersOnStart = option + add;
|
||||||
break;
|
break;
|
||||||
case timeInLobbyUntilStart:
|
case timeInLobbyUntilStart:
|
||||||
arena.timeInLobbyUntilStart = option + add;
|
arena.timeInLobbyUntilStart = option + add;
|
||||||
break;
|
break;
|
||||||
case waitingTimeSeeker:
|
case waitingTimeSeeker:
|
||||||
arena.waitingTimeSeeker = option + add;
|
arena.waitingTimeSeeker = option + add;
|
||||||
break;
|
break;
|
||||||
case gameTime:
|
case gameTime:
|
||||||
arena.gameTime = option + add;
|
arena.gameTime = option + add;
|
||||||
break;
|
break;
|
||||||
case blockAnnouncerTime:
|
case blockAnnouncerTime:
|
||||||
arena.blockAnnouncerTime = option + add;
|
arena.blockAnnouncerTime = option + add;
|
||||||
break;
|
break;
|
||||||
case timeUntilHidersSword:
|
case timeUntilHidersSword:
|
||||||
arena.timeUntilHidersSword = option + add;
|
arena.timeUntilHidersSword = option + add;
|
||||||
break;
|
break;
|
||||||
case hidersTokenWin:
|
case hidersTokenWin:
|
||||||
arena.hidersTokenWin = option + add;
|
arena.hidersTokenWin = option + add;
|
||||||
break;
|
break;
|
||||||
case seekersTokenWin:
|
case seekersTokenWin:
|
||||||
arena.seekersTokenWin = option + add;
|
arena.seekersTokenWin = option + add;
|
||||||
break;
|
break;
|
||||||
case killTokens:
|
case killTokens:
|
||||||
arena.killTokens = option + add;
|
arena.killTokens = option + add;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_setTooHighNumber, "max-" + max);
|
MessageManager.sendFMessage(player, ConfigC.error_setTooHighNumber, "max-" + max);
|
||||||
}
|
}
|
||||||
} else if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_remove2))) {
|
} else if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_remove2))) {
|
||||||
if (option > min) {
|
if (option > min) {
|
||||||
switch (at) {
|
switch (at) {
|
||||||
case maxPlayers:
|
case maxPlayers:
|
||||||
arena.maxPlayers = option - remove;
|
arena.maxPlayers = option - remove;
|
||||||
break;
|
break;
|
||||||
case minPlayers:
|
case minPlayers:
|
||||||
arena.minPlayers = option - remove;
|
arena.minPlayers = option - remove;
|
||||||
break;
|
break;
|
||||||
case amountSeekersOnStart:
|
case amountSeekersOnStart:
|
||||||
arena.amountSeekersOnStart = option - remove;
|
arena.amountSeekersOnStart = option - remove;
|
||||||
break;
|
break;
|
||||||
case timeInLobbyUntilStart:
|
case timeInLobbyUntilStart:
|
||||||
arena.timeInLobbyUntilStart = option - remove;
|
arena.timeInLobbyUntilStart = option - remove;
|
||||||
break;
|
break;
|
||||||
case waitingTimeSeeker:
|
case waitingTimeSeeker:
|
||||||
arena.waitingTimeSeeker = option - remove;
|
arena.waitingTimeSeeker = option - remove;
|
||||||
break;
|
break;
|
||||||
case gameTime:
|
case gameTime:
|
||||||
arena.gameTime = option - remove;
|
arena.gameTime = option - remove;
|
||||||
break;
|
break;
|
||||||
case blockAnnouncerTime:
|
case blockAnnouncerTime:
|
||||||
arena.blockAnnouncerTime = option - remove;
|
arena.blockAnnouncerTime = option - remove;
|
||||||
break;
|
break;
|
||||||
case timeUntilHidersSword:
|
case timeUntilHidersSword:
|
||||||
arena.timeUntilHidersSword = option - remove;
|
arena.timeUntilHidersSword = option - remove;
|
||||||
break;
|
break;
|
||||||
case hidersTokenWin:
|
case hidersTokenWin:
|
||||||
arena.hidersTokenWin = option - remove;
|
arena.hidersTokenWin = option - remove;
|
||||||
break;
|
break;
|
||||||
case seekersTokenWin:
|
case seekersTokenWin:
|
||||||
arena.seekersTokenWin = option - remove;
|
arena.seekersTokenWin = option - remove;
|
||||||
break;
|
break;
|
||||||
case killTokens:
|
case killTokens:
|
||||||
arena.killTokens = option - remove;
|
arena.killTokens = option - remove;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_setTooLowNumber, "min-" + min);
|
MessageManager.sendFMessage(player, ConfigC.error_setTooLowNumber, "min-" + min);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -17,45 +14,47 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class OnInventoryCloseEvent implements Listener {
|
public class OnInventoryCloseEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryCloseEvent(InventoryCloseEvent event) {
|
public void onInventoryCloseEvent(InventoryCloseEvent event) {
|
||||||
Inventory inv = event.getInventory();
|
Inventory inv = event.getInventory();
|
||||||
InventoryView invView = event.getView();
|
InventoryView invView = event.getView();
|
||||||
if (inv.getType().equals(InventoryType.CHEST)) {
|
if (inv.getType().equals(InventoryType.CHEST)) {
|
||||||
if (invView.getTitle().contains("DisguiseBlocks")) {
|
if (invView.getTitle().contains("DisguiseBlocks")) {
|
||||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A"), "");
|
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A"), "");
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<ItemStack> blocks = new ArrayList<>();
|
ArrayList<ItemStack> blocks = new ArrayList<>();
|
||||||
for (ItemStack item : inv.getContents()) {
|
for (ItemStack item : inv.getContents()) {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (!item.getType().equals(Material.PAPER)) {
|
if (!item.getType().equals(Material.PAPER)) {
|
||||||
if (item.getType().equals(Material.FLOWER_POT)) {
|
if (item.getType().equals(Material.FLOWER_POT)) {
|
||||||
blocks.add(new ItemStack(Material.FLOWER_POT));
|
blocks.add(new ItemStack(Material.FLOWER_POT));
|
||||||
} else {
|
} else {
|
||||||
blocks.add(item);
|
blocks.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arena.disguiseBlocks = blocks;
|
arena.disguiseBlocks = blocks;
|
||||||
save(arena);
|
save(arena);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(Arena arena) {
|
public void save(Arena arena) {
|
||||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||||
MemoryStorage.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -11,14 +10,14 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
|||||||
|
|
||||||
public class OnPlayerDropItemEvent implements Listener {
|
public class OnPlayerDropItemEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.*;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
|
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
|
import nl.Steffion.BlockHunt.SignsHandler;
|
||||||
|
import nl.Steffion.BlockHunt.SolidBlockHandler;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -25,140 +29,140 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
|
|
||||||
public class OnPlayerInteractEvent implements Listener {
|
public class OnPlayerInteractEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteractEvent(PlayerInteractEvent event) {
|
public void onPlayerInteractEvent(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.create, false)) {
|
if (PermissionsManager.hasPerm(player, Permissions.create, false)) {
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
if (item.getType() != Material.AIR) {
|
if (item.getType() != Material.AIR) {
|
||||||
if (item.getItemMeta().hasDisplayName()) {
|
if (item.getItemMeta().hasDisplayName()) {
|
||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
if (im.getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)))) {
|
if (im.getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)))) {
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
if (event.hasBlock()) {
|
if (event.hasBlock()) {
|
||||||
Location location = event.getClickedBlock().getLocation();
|
Location location = event.getClickedBlock().getLocation();
|
||||||
if (action.equals(Action.LEFT_CLICK_BLOCK)) {
|
if (action.equals(Action.LEFT_CLICK_BLOCK)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (MemoryStorage.pos1.get(player) == null || !MemoryStorage.pos1.get(player).equals(location)) {
|
if (MemoryStorage.pos1.get(player) == null || !MemoryStorage.pos1.get(player).equals(location)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-1",
|
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-1",
|
||||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||||
MemoryStorage.pos1.put(player, location);
|
MemoryStorage.pos1.put(player, location);
|
||||||
}
|
}
|
||||||
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (MemoryStorage.pos2.get(player) == null || !MemoryStorage.pos2.get(player).equals(location)) {
|
if (MemoryStorage.pos2.get(player) == null || !MemoryStorage.pos2.get(player).equals(location)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-2",
|
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-2",
|
||||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||||
MemoryStorage.pos2.put(player, location);
|
MemoryStorage.pos2.put(player, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (event.getClickedBlock() != null) {
|
if (event.getClickedBlock() != null) {
|
||||||
if (event.getClickedBlock().getState() instanceof Sign) {
|
if (event.getClickedBlock().getState() instanceof Sign) {
|
||||||
if (SignsHandler.isSign(event.getClickedBlock().getLocation())) {
|
if (SignsHandler.isSign(event.getClickedBlock().getLocation())) {
|
||||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||||
if (sign.getLine(1) != null) {
|
if (sign.getLine(1) != null) {
|
||||||
if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) {
|
if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) {
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||||
ArenaHandler.playerLeaveArena(player, true, true);
|
ArenaHandler.playerLeaveArena(player, true, true);
|
||||||
}
|
}
|
||||||
} else if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location).get(1)))) {
|
} else if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location).get(1)))) {
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.shop, true)) {
|
if (PermissionsManager.hasPerm(player, Permissions.shop, true)) {
|
||||||
InventoryHandler.openShop(player);
|
InventoryHandler.openShop(player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (sign.getLines()[1].contains(arena.arenaName)) {
|
if (sign.getLines()[1].contains(arena.arenaName)) {
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||||
ArenaHandler.playerJoinArena(player, arena.arenaName);
|
ArenaHandler.playerJoinArena(player, arena.arenaName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
if (event.getClickedBlock().getType() != Material.AIR) {
|
if (event.getClickedBlock().getType() != Material.AIR) {
|
||||||
if (event.getClickedBlock().getType().equals(Material.ENCHANTING_TABLE) || event.getClickedBlock().getType().equals(Material.CRAFTING_TABLE)
|
if (event.getClickedBlock().getType().equals(Material.ENCHANTING_TABLE) || event.getClickedBlock().getType().equals(Material.CRAFTING_TABLE)
|
||||||
|| event.getClickedBlock().getType().equals(Material.FURNACE) || event.getClickedBlock().getType().equals(Material.CHEST)
|
|| event.getClickedBlock().getType().equals(Material.FURNACE) || event.getClickedBlock().getType().equals(Material.CHEST)
|
||||||
|| event.getClickedBlock().getType().equals(Material.ANVIL) || event.getClickedBlock().getType().equals(Material.ENDER_CHEST)
|
|| event.getClickedBlock().getType().equals(Material.ANVIL) || event.getClickedBlock().getType().equals(Material.ENDER_CHEST)
|
||||||
|| event.getClickedBlock().getType().equals(Material.JUKEBOX) || block.getRelative(event.getBlockFace()).getType().equals(Material.FIRE)) {
|
|| event.getClickedBlock().getType().equals(Material.JUKEBOX) || block.getRelative(event.getBlockFace()).getType().equals(Material.FIRE)) {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.seekers.contains(player)) {
|
if (arena.seekers.contains(player)) {
|
||||||
for (Player pl : arena.playersInArena) {
|
for (Player pl : arena.playersInArena) {
|
||||||
if (MemoryStorage.hiddenLoc.get(pl) != null) {
|
if (MemoryStorage.hiddenLoc.get(pl) != null) {
|
||||||
Block pLoc = event.getClickedBlock();
|
Block pLoc = event.getClickedBlock();
|
||||||
Block moveLocBlock = MemoryStorage.hiddenLoc.get(pl).getBlock();
|
Block moveLocBlock = MemoryStorage.hiddenLoc.get(pl).getBlock();
|
||||||
if (moveLocBlock.getX() == pLoc.getX() && moveLocBlock.getY() == pLoc.getY() && moveLocBlock.getZ() == pLoc.getZ()) {
|
if (moveLocBlock.getX() == pLoc.getX() && moveLocBlock.getY() == pLoc.getY() && moveLocBlock.getZ() == pLoc.getZ()) {
|
||||||
MemoryStorage.moveLoc.put(pl, new Location(pl.getWorld(), 0, 0, 0));
|
MemoryStorage.moveLoc.put(pl, new Location(pl.getWorld(), 0, 0, 0));
|
||||||
pl.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
pl.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
||||||
SolidBlockHandler.makePlayerUnsolid(pl);
|
SolidBlockHandler.makePlayerUnsolid(pl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) {
|
if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
if (item.getType() != Material.AIR) {
|
if (item.getType() != Material.AIR) {
|
||||||
if (item.getItemMeta().getDisplayName() != null) {
|
if (item.getItemMeta().getDisplayName() != null) {
|
||||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
||||||
Inventory blockChooser = Bukkit.createInventory(null, 36, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
Inventory blockChooser = Bukkit.createInventory(null, 36, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
||||||
if (arena.disguiseBlocks != null) {
|
if (arena.disguiseBlocks != null) {
|
||||||
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
||||||
blockChooser.setItem(i - 1, arena.disguiseBlocks.get(i - 1));
|
blockChooser.setItem(i - 1, arena.disguiseBlocks.get(i - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.openInventory(blockChooser);
|
player.openInventory(blockChooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
||||||
Inventory BlockHuntPass = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
Inventory BlockHuntPass = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||||
ItemStack BlockHuntPassSEEKER = new ItemStack(Material.BLUE_WOOL, 1);
|
ItemStack BlockHuntPassSEEKER = new ItemStack(Material.BLUE_WOOL, 1);
|
||||||
ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER.getItemMeta();
|
ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER.getItemMeta();
|
||||||
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eSEEKER"));
|
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eSEEKER"));
|
||||||
BlockHuntPassSEEKER.setItemMeta(BlockHuntPassIM);
|
BlockHuntPassSEEKER.setItemMeta(BlockHuntPassIM);
|
||||||
BlockHuntPass.setItem(1, BlockHuntPassSEEKER);
|
BlockHuntPass.setItem(1, BlockHuntPassSEEKER);
|
||||||
|
|
||||||
ItemStack BlockHuntPassHIDER = new ItemStack(Material.RED_WOOL, 1);
|
ItemStack BlockHuntPassHIDER = new ItemStack(Material.RED_WOOL, 1);
|
||||||
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eHIDER"));
|
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eHIDER"));
|
||||||
BlockHuntPassHIDER.setItemMeta(BlockHuntPassIM);
|
BlockHuntPassHIDER.setItemMeta(BlockHuntPassIM);
|
||||||
BlockHuntPass.setItem(7, BlockHuntPassHIDER);
|
BlockHuntPass.setItem(7, BlockHuntPassHIDER);
|
||||||
|
|
||||||
player.openInventory(BlockHuntPass);
|
player.openInventory(BlockHuntPass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.*;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
import nl.Steffion.BlockHunt.PlayerHandler;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -14,69 +17,71 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
|
|
||||||
public class OnPlayerMoveEvent implements Listener {
|
public class OnPlayerMoveEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerMoveEvent(PlayerMoveEvent event) {
|
public void onPlayerMoveEvent(PlayerMoveEvent event) {
|
||||||
// Early exit if no one is in any arena
|
// Early exit if no one is in any arena
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) {
|
||||||
Player player = event.getPlayer();
|
return;
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
}
|
||||||
if (arena.playersInArena.contains(player)) {
|
Player player = event.getPlayer();
|
||||||
if (arena.gameState == ArenaState.INGAME) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
MemoryStorage.moveLoc.put(player, player.getLocation());
|
if (arena.playersInArena.contains(player)) {
|
||||||
if(arena.pos1 == null || arena.pos2 == null){
|
if (arena.gameState == ArenaState.INGAME) {
|
||||||
BlockHunt.plugin.getLogger().info("Arena:"+
|
MemoryStorage.moveLoc.put(player, player.getLocation());
|
||||||
arena.arenaName+" appears to have bad coords : pos1:"+
|
if (arena.pos1 == null || arena.pos2 == null) {
|
||||||
((arena.pos1 != null)?arena.pos1.toString():" NULL")+ " Pos2:" +
|
BlockHunt.plugin.getLogger().info("Arena:" +
|
||||||
((arena.pos2 != null)?arena.pos2.toString():" NULL"));
|
arena.arenaName + " appears to have bad coords : pos1:" +
|
||||||
|
((arena.pos1 != null) ? arena.pos1.toString() : " NULL") + " Pos2:" +
|
||||||
|
((arena.pos2 != null) ? arena.pos2.toString() : " NULL"));
|
||||||
BlockHunt.plugin.getLogger().info("Player has been returned to hiderswarp due to bad arena state");
|
BlockHunt.plugin.getLogger().info("Player has been returned to hiderswarp due to bad arena state");
|
||||||
//event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double maxX = Math.max(arena.pos1.getX(), arena.pos2.getX());
|
double maxX = Math.max(arena.pos1.getX(), arena.pos2.getX());
|
||||||
double minX = Math.min(arena.pos1.getX(), arena.pos2.getX());
|
double minX = Math.min(arena.pos1.getX(), arena.pos2.getX());
|
||||||
double maxY = Math.max(arena.pos1.getY(), arena.pos2.getY());
|
double maxY = Math.max(arena.pos1.getY(), arena.pos2.getY());
|
||||||
double minY = Math.min(arena.pos1.getY(), arena.pos2.getY());
|
double minY = Math.min(arena.pos1.getY(), arena.pos2.getY());
|
||||||
double maxZ = Math.max(arena.pos1.getZ(), arena.pos2.getZ());
|
double maxZ = Math.max(arena.pos1.getZ(), arena.pos2.getZ());
|
||||||
double minZ = Math.min(arena.pos1.getZ(), arena.pos2.getZ());
|
double minZ = Math.min(arena.pos1.getZ(), arena.pos2.getZ());
|
||||||
|
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
if (loc.getBlockX() > maxX) {
|
if (loc.getBlockX() > maxX) {
|
||||||
//event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||||
} else if (loc.getBlockX() < minX) {
|
} else if (loc.getBlockX() < minX) {
|
||||||
//event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||||
} else if (loc.getBlockZ() > maxZ) {
|
} else if (loc.getBlockZ() > maxZ) {
|
||||||
//event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||||
} else if (loc.getBlockZ() < minZ) {
|
} else if (loc.getBlockZ() < minZ) {
|
||||||
//event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||||
} else if (loc.getBlockY() > maxY) {
|
} else if (loc.getBlockY() > maxY) {
|
||||||
//event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||||
} else if (loc.getBlockY() < minY) {
|
} else if (loc.getBlockY() < minY) {
|
||||||
//event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,30 +3,23 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
public class OnPlayerQuitEvent implements Listener {
|
public class OnPlayerQuitEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerQuitEvent(PlayerQuitEvent event) {
|
public void onPlayerQuitEvent(PlayerQuitEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
ArenaHandler.playerLeaveArena(player, true, true);
|
ArenaHandler.playerLeaveArena(player, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler(priority = EventPriority.HIGHEST)
|
|
||||||
// public void onPlayerJoinEvent(PlayerJoinEvent event) {
|
|
||||||
// Player playerJoining = event.getPlayer();
|
|
||||||
// playerJoining.teleport(playerJoining.getWorld().getSpawnLocation());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,9 @@ public class OnPlayerSwapHandItemsEvent implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent event) {
|
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent event) {
|
||||||
// Early exit if no one is in any arena
|
// Early exit if no one is in any arena
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
|
@ -12,25 +12,26 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
|
|
||||||
public class OnPlayerTeleportEvent implements Listener {
|
public class OnPlayerTeleportEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerTeleportEvent(PlayerTeleportEvent event) {
|
public void onPlayerTeleportEvent(PlayerTeleportEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (MemoryStorage.pData.get(player) != null) {
|
if (MemoryStorage.pData.get(player) != null) {
|
||||||
handlePlayer(event, player);
|
handlePlayer(event, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a player that is in an arena
|
* Handle a player that is in an arena
|
||||||
* @param event PlayerTeleportEvent
|
*
|
||||||
* @param player Player
|
* @param event PlayerTeleportEvent
|
||||||
*/
|
* @param player Player
|
||||||
private void handlePlayer(PlayerTeleportEvent event, Player player) {
|
*/
|
||||||
Location storedLoc = MemoryStorage.teleportLoc.remove(player);
|
private void handlePlayer(PlayerTeleportEvent event, Player player) {
|
||||||
Location to = event.getTo();
|
Location storedLoc = MemoryStorage.teleportLoc.remove(player);
|
||||||
if (storedLoc == null || storedLoc.getWorld() != to.getWorld() || to.distanceSquared(storedLoc) > 1) {
|
Location to = event.getTo();
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_teleportBlocked);
|
if (storedLoc == null || storedLoc.getWorld() != to.getWorld() || to.distanceSquared(storedLoc) > 1) {
|
||||||
event.setCancelled(true);
|
MessageManager.sendFMessage(player, ConfigC.error_teleportBlocked);
|
||||||
}
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
import nl.Steffion.BlockHunt.SignsHandler;
|
import nl.Steffion.BlockHunt.SignsHandler;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -13,16 +12,16 @@ import org.bukkit.event.block.SignChangeEvent;
|
|||||||
|
|
||||||
public class OnSignChangeEvent implements Listener {
|
public class OnSignChangeEvent implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onSignChangeEvent(SignChangeEvent event) {
|
public void onSignChangeEvent(SignChangeEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
String[] lines = event.getLines();
|
String[] lines = event.getLines();
|
||||||
if (lines[0] != null) {
|
if (lines[0] != null) {
|
||||||
if (lines[0].equalsIgnoreCase("[" + BlockHunt.pdfFile.getName() + "]")) {
|
if (lines[0].equalsIgnoreCase("[" + BlockHunt.pdfFile.getName() + "]")) {
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.signcreate, true)) {
|
if (PermissionsManager.hasPerm(player, Permissions.signcreate, true)) {
|
||||||
SignsHandler.createSign(event, lines, event.getBlock().getLocation());
|
SignsHandler.createSign(event, lines, event.getBlock().getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,49 +1,50 @@
|
|||||||
package nl.Steffion.BlockHunt.Managers;
|
package nl.Steffion.BlockHunt.Managers;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
|
||||||
import nl.Steffion.BlockHunt.Commands.DefaultCMD;
|
import nl.Steffion.BlockHunt.Commands.DefaultCMD;
|
||||||
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandManager {
|
public class CommandManager {
|
||||||
|
|
||||||
|
|
||||||
public String name;
|
public final String name;
|
||||||
public String label;
|
public final String label;
|
||||||
public String args;
|
public final String args;
|
||||||
public String argsalias;
|
public final String argsalias;
|
||||||
public Permissions permission;
|
public final Permissions permission;
|
||||||
public ConfigC help;
|
public final ConfigC help;
|
||||||
public boolean enabled;
|
public final boolean enabled;
|
||||||
public List<String> mainTABlist;
|
public final List<String> mainTABlist;
|
||||||
public DefaultCMD CMD;
|
public final DefaultCMD CMD;
|
||||||
public String usage;
|
public final String usage;
|
||||||
|
|
||||||
public CommandManager(String name, String label, String args, String argsalias, Permissions permission, ConfigC help, Boolean enabled, List<String> mainTABlist,
|
public CommandManager(String name, String label, String args, String argsalias, Permissions permission, ConfigC help, Boolean enabled, List<String> mainTABlist,
|
||||||
DefaultCMD CMD, String usage) {
|
DefaultCMD CMD, String usage) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.argsalias = argsalias;
|
this.argsalias = argsalias;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
this.help = help;
|
this.help = help;
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.mainTABlist = mainTABlist;
|
this.mainTABlist = mainTABlist;
|
||||||
this.CMD = CMD;
|
this.CMD = CMD;
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
|
|
||||||
MemoryStorage.commands.add(this);
|
MemoryStorage.commands.add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,153 +1,153 @@
|
|||||||
package nl.Steffion.BlockHunt.Managers;
|
package nl.Steffion.BlockHunt.Managers;
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
|
|
||||||
|
|
||||||
private String fileName;
|
private final String fileName;
|
||||||
private File file;
|
private final File file;
|
||||||
private FileConfiguration fileC;
|
private final FileConfiguration fileC;
|
||||||
private ConfigurationSection fileCS;
|
private final ConfigurationSection fileCS;
|
||||||
private File fileLocation;
|
private final File fileLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this class to create an automated config file.
|
* Use this class to create an automated config file.
|
||||||
*
|
*
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* Name of the file.
|
* Name of the file.
|
||||||
*/
|
*/
|
||||||
public ConfigManager(String fileName) {
|
public ConfigManager(String fileName) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.file = new File(BlockHunt.plugin.getDataFolder(), fileName + ".yml");
|
this.file = new File(BlockHunt.plugin.getDataFolder(), fileName + ".yml");
|
||||||
this.fileLocation = BlockHunt.plugin.getDataFolder();
|
this.fileLocation = BlockHunt.plugin.getDataFolder();
|
||||||
this.fileC = new YamlConfiguration();
|
this.fileC = new YamlConfiguration();
|
||||||
this.checkFile();
|
this.checkFile();
|
||||||
this.fileCS = fileC.getConfigurationSection("");
|
this.fileCS = fileC.getConfigurationSection("");
|
||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this class to create an automated config file.
|
* Use this class to create an automated config file.
|
||||||
*
|
*
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* Name of the file.
|
* Name of the file.
|
||||||
* @param subdirectory
|
* @param subdirectory
|
||||||
* Sub-Location of the file.
|
* Sub-Location of the file.
|
||||||
*/
|
*/
|
||||||
public ConfigManager(String fileName, String subdirectory) {
|
public ConfigManager(String fileName, String subdirectory) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
File directory = new File( BlockHunt.plugin.getDataFolder() , subdirectory );
|
File directory = new File(BlockHunt.plugin.getDataFolder(), subdirectory);
|
||||||
this.file = new File( directory,fileName + ".yml");
|
this.file = new File(directory, fileName + ".yml");
|
||||||
this.fileLocation = directory;
|
this.fileLocation = directory;
|
||||||
this.fileC = new YamlConfiguration();
|
this.fileC = new YamlConfiguration();
|
||||||
this.checkFile();
|
this.checkFile();
|
||||||
this.fileCS = fileC.getConfigurationSection("");
|
this.fileCS = fileC.getConfigurationSection("");
|
||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there are new files created if so, display a message to the
|
* Check if there are new files created if so, display a message to the
|
||||||
* console.
|
* console.
|
||||||
*/
|
*/
|
||||||
public static void newFiles() {
|
public static void newFiles() {
|
||||||
ConfigManager.setDefaults();
|
ConfigManager.setDefaults();
|
||||||
for (String fileName : MemoryStorage.newFiles) {
|
for (String fileName : MemoryStorage.newFiles) {
|
||||||
MessageManager.sendMessage(null, "%TAG%WCouldn't find '%A%fileName%.yml%W'%A creating new one.", "fileName-" + fileName);
|
MessageManager.sendMessage(null, "%TAG%WCouldn't find '%A%fileName%.yml%W'%A creating new one.", "fileName-" + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryStorage.newFiles.clear();
|
MemoryStorage.newFiles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add config settings to the files if they don't exist.
|
* Add config settings to the files if they don't exist.
|
||||||
*/
|
*/
|
||||||
public static void setDefaults() {
|
public static void setDefaults() {
|
||||||
for (ConfigC value : ConfigC.values()) {
|
for (ConfigC value : ConfigC.values()) {
|
||||||
value.config.load();
|
value.config.load();
|
||||||
if (value.config.getFile().get(value.location) == null) {
|
if (value.config.getFile().get(value.location) == null) {
|
||||||
value.config.getFile().set(value.location, value.value);
|
value.config.getFile().set(value.location, value.value);
|
||||||
value.config.save();
|
value.config.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if file exists, if not create one.
|
* Check if file exists, if not create one.
|
||||||
*/
|
*/
|
||||||
public void checkFile() {
|
public void checkFile() {
|
||||||
if (!this.file.exists()) {
|
if (!this.file.exists()) {
|
||||||
try {
|
try {
|
||||||
this.file.getParentFile().mkdirs();
|
this.file.getParentFile().mkdirs();
|
||||||
this.file.createNewFile();
|
this.file.createNewFile();
|
||||||
if(file.exists()) {
|
if (file.exists()) {
|
||||||
MemoryStorage.newFiles.add(this.fileName);
|
MemoryStorage.newFiles.add(this.fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the file.
|
* Save the file.
|
||||||
*/
|
*/
|
||||||
public void save() {
|
public void save() {
|
||||||
try {
|
try {
|
||||||
this.fileC.save(this.file);
|
this.fileC.save(this.file);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the file.
|
* Load the file.
|
||||||
*/
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
this.checkFile();
|
this.checkFile();
|
||||||
if (this.file.exists()) {
|
if (this.file.exists()) {
|
||||||
try {
|
try {
|
||||||
this.fileC.load(this.file);
|
this.fileC.load(this.file);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the File. Very useful for just loading/saving.
|
* Get the File. Very useful for just loading/saving.
|
||||||
*/
|
*/
|
||||||
public FileConfiguration getFile() {
|
public FileConfiguration getFile() {
|
||||||
return this.fileC;
|
return this.fileC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get object from a Config.
|
* Get object from a Config.
|
||||||
*
|
*
|
||||||
* @param location
|
* @param location
|
||||||
* Config location.
|
* Config location.
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
public Object get(ConfigC location) {
|
public Object get(ConfigC location) {
|
||||||
return this.getFile().get(location.location);
|
return this.getFile().get(location.location);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,190 +2,168 @@ package nl.Steffion.BlockHunt.Managers;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class MessageManager {
|
public class MessageManager {
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
*
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
*
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to a player. Also replaces the "%player%" variable to the
|
* Send a message to a player. Also replaces the "%player%" variable to the
|
||||||
* player's name.
|
* player's name.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player The player receiving the message.
|
||||||
* The player receiving the message.
|
* @param message Message which needs to be send to the player.
|
||||||
* @param message
|
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||||
* Message which needs to be send to the player.
|
* player.getName();
|
||||||
* @param vars
|
*/
|
||||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
public static void sendMessage(Player player, String message, String... vars) {
|
||||||
* player.getName();
|
if (player == null) {
|
||||||
*/
|
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", "Console"), vars));
|
||||||
public static void sendMessage(Player player, String message, String... vars) {
|
} else {
|
||||||
if (player == null) {
|
player.sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars));
|
||||||
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", "Console"), vars));
|
}
|
||||||
} else {
|
}
|
||||||
player.sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to a player from a Config. Also replaces the "%player%"
|
* Send a message to a player from a Config. Also replaces the "%player%"
|
||||||
* variable to the player's name.
|
* variable to the player's name.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player The player receiving the message.
|
||||||
* The player receiving the message.
|
* @param location Location in the config of the message being send.
|
||||||
* @param location
|
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||||
* Location in the config of the message being send.
|
* player.getName();
|
||||||
* @param vars
|
*/
|
||||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
public static void sendFMessage(Player player, ConfigC location, String... vars) {
|
||||||
* player.getName();
|
if (player == null) {
|
||||||
*/
|
Bukkit.getConsoleSender().sendMessage(
|
||||||
public static void sendFMessage(Player player, ConfigC location, String... vars) {
|
MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", "Console"), vars));
|
||||||
if (player == null) {
|
} else {
|
||||||
Bukkit.getConsoleSender().sendMessage(
|
player.sendMessage(MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()), vars));
|
||||||
MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", "Console"), vars));
|
}
|
||||||
} else {
|
}
|
||||||
player.sendMessage(MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()), vars));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to all players online. Also replaces the "%player%"
|
* Send a message to all players online. Also replaces the "%player%"
|
||||||
* variable to the player's name.
|
* variable to the player's name.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message Message which needs to be send to the player.
|
||||||
* Message which needs to be send to the player.
|
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||||
* @param vars
|
* player.getName();
|
||||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
*/
|
||||||
* player.getName();
|
public static void broadcastMessage(String message, String... vars) {
|
||||||
*/
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
public static void broadcastMessage(String message, String... vars) {
|
player.sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars));
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
}
|
||||||
// String pMessage = message.replaceAll("%player%",
|
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", "Console"), vars));
|
||||||
// player.getName());
|
}
|
||||||
player.sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars));
|
|
||||||
}
|
|
||||||
// message = message.replaceAll("%player%", "Console");
|
|
||||||
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", "Console"), vars));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to all players online from a Config. Also replaces the
|
* Send a message to all players online from a Config. Also replaces the
|
||||||
* "%player%" variable to the player's name.
|
* "%player%" variable to the player's name.
|
||||||
*
|
*
|
||||||
* @param location
|
* @param location Location in the config of the message being send.
|
||||||
* Location in the config of the message being send.
|
* @param vars Variables . Seperated with a - . Ex: "playerName-" +
|
||||||
* @param vars
|
* player.getName();
|
||||||
* Variables . Seperated with a - . Ex: "playerName-" +
|
*/
|
||||||
* player.getName();
|
public static void broadcastFMessage(ConfigC location, String... vars) {
|
||||||
*/
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
public static void broadcastFMessage(ConfigC location, String... vars) {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
// String pMessage =
|
|
||||||
// location.config.getFile().get(location.location)
|
|
||||||
// .toString().replaceAll("%player%", player.getName());
|
|
||||||
player.sendMessage(MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()), vars));
|
|
||||||
}
|
|
||||||
// String message = location.config.getFile().get(location.location)
|
|
||||||
// .toString().replaceAll("%player%", "Console");
|
|
||||||
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", "Console"), vars));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
player.sendMessage(MessageManager.replaceAll(location.config.getFile().get(
|
||||||
* Replace all variables.
|
location.location).toString().replaceAll("%player%", player.getDisplayName()), vars));
|
||||||
*
|
}
|
||||||
* @param message
|
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(location.config.getFile().get(
|
||||||
* Message which needs to be replaced.
|
location.location).toString().replaceAll("%player%", "Console"), vars));
|
||||||
* @param vars
|
}
|
||||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
|
||||||
* player.getName();
|
|
||||||
* @return String with the message with values replaced
|
|
||||||
*/
|
|
||||||
public static String replaceAll(String message, String... vars) {
|
|
||||||
return MessageManager.replaceColours(MessageManager.replaceColourVars(MessageManager.replaceVars(message, vars)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace default Minecraft colour codes.
|
* Replace all variables.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message Message which needs to be replaced.
|
||||||
* Message which needs to be replaced.
|
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||||
* @return Colour replaced message.
|
* player.getName();
|
||||||
*/
|
* @return String with the message with values replaced
|
||||||
public static String replaceColours(String message) {
|
*/
|
||||||
return message.replaceAll("(&([a-fk-or0-9]))", "\u00A7$2");
|
public static String replaceAll(String message, String... vars) {
|
||||||
}
|
return MessageManager.replaceColours(MessageManager.replaceColourVars(MessageManager.replaceVars(message, vars)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace colour codes of this plugin.
|
* Replace default Minecraft colour codes.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message Message which needs to be replaced.
|
||||||
* Message which needs to be replaced.
|
* @return Colour replaced message.
|
||||||
* @return Colour replaced message.
|
*/
|
||||||
*/
|
public static String replaceColours(String message) {
|
||||||
public static String replaceColourVars(String message) {
|
return message.replaceAll("(&([a-fk-or0-9]))", "\u00A7$2");
|
||||||
message = message.replaceAll("%N", CType.NORMAL());
|
}
|
||||||
message = message.replaceAll("%W", CType.WARNING());
|
|
||||||
message = message.replaceAll("%E", CType.ERROR());
|
|
||||||
message = message.replaceAll("%A", CType.ARG());
|
|
||||||
message = message.replaceAll("%H", CType.HEADER());
|
|
||||||
message = message.replaceAll("%TAG", CType.TAG());
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace custom variables.
|
* Replace colour codes of this plugin.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message Message which needs to be replaced.
|
||||||
* Message which needs to be replaced.
|
* @return Colour replaced message.
|
||||||
* @param vars
|
*/
|
||||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
public static String replaceColourVars(String message) {
|
||||||
* player.getName();
|
message = message.replaceAll("%N", CType.NORMAL());
|
||||||
* @return Replaced String.
|
message = message.replaceAll("%W", CType.WARNING());
|
||||||
*/
|
message = message.replaceAll("%E", CType.ERROR());
|
||||||
public static String replaceVars(String message, String... vars) {
|
message = message.replaceAll("%A", CType.ARG());
|
||||||
for (String var : vars) {
|
message = message.replaceAll("%H", CType.HEADER());
|
||||||
String[] split = var.split("-");
|
message = message.replaceAll("%TAG", CType.TAG());
|
||||||
message = message.replaceAll("%" + split[0] + "%", split[1]);
|
return message;
|
||||||
}
|
}
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CType {
|
/**
|
||||||
|
* Replace custom variables.
|
||||||
|
*
|
||||||
|
* @param message Message which needs to be replaced.
|
||||||
|
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||||
|
* player.getName();
|
||||||
|
* @return Replaced String.
|
||||||
|
*/
|
||||||
|
public static String replaceVars(String message, String... vars) {
|
||||||
|
for (String var : vars) {
|
||||||
|
String[] split = var.split("-");
|
||||||
|
message = message.replaceAll("%" + split[0] + "%", split[1]);
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
public static String NORMAL() {
|
public static class CType {
|
||||||
return (String) MemoryStorage.config.get(ConfigC.chat_normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String WARNING() {
|
public static String NORMAL() {
|
||||||
return (String) MemoryStorage.config.get(ConfigC.chat_warning);
|
return (String) MemoryStorage.config.get(ConfigC.chat_normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ERROR() {
|
public static String WARNING() {
|
||||||
return (String) MemoryStorage.config.get(ConfigC.chat_error);
|
return (String) MemoryStorage.config.get(ConfigC.chat_warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ARG() {
|
public static String ERROR() {
|
||||||
return (String) MemoryStorage.config.get(ConfigC.chat_arg);
|
return (String) MemoryStorage.config.get(ConfigC.chat_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String HEADER() {
|
public static String ARG() {
|
||||||
return (String) MemoryStorage.config.get(ConfigC.chat_header);
|
return (String) MemoryStorage.config.get(ConfigC.chat_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String TAG() {
|
public static String HEADER() {
|
||||||
return (String) MemoryStorage.config.get(ConfigC.chat_header) + MemoryStorage.config.get(ConfigC.chat_tag) + MemoryStorage.config.get(ConfigC.chat_normal);
|
return (String) MemoryStorage.config.get(ConfigC.chat_header);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static String TAG() {
|
||||||
|
return (String) MemoryStorage.config.get(ConfigC.chat_header) + MemoryStorage.config.get(ConfigC.chat_tag) + MemoryStorage.config.get(ConfigC.chat_normal);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,130 +4,122 @@ import nl.Steffion.BlockHunt.ConfigC;
|
|||||||
import nl.Steffion.BlockHunt.PermissionsC;
|
import nl.Steffion.BlockHunt.PermissionsC;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.PType;
|
import nl.Steffion.BlockHunt.PermissionsC.PType;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PermissionsManager {
|
public class PermissionsManager {
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
*
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
*
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if an player has the permission. Also checks * related permissions.
|
* Check if an player has the permission. Also checks * related permissions.
|
||||||
* This permission DOES HAVE TO be registered.
|
* This permission DOES HAVE TO be registered.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player The player who needs the permission.
|
||||||
* The player who needs the permission.
|
* @param perm The permission.
|
||||||
* @param perm
|
* @param message Send a message to the player saying you don't have the
|
||||||
* The permission.
|
* permission.
|
||||||
* @param message
|
* @return True/False when either the player has the permission.
|
||||||
* Send a message to the player saying you don't have the
|
*/
|
||||||
* permission.
|
public static boolean hasPerm(Player player, Permissions perm, Boolean message) {
|
||||||
* @return True/False when either the player has the permission.
|
PType type = perm.type;
|
||||||
*/
|
if (player == null) {
|
||||||
public static boolean hasPerm(Player player, Permissions perm, Boolean message) {
|
return true;
|
||||||
PType type = perm.type;
|
}
|
||||||
if (player == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == PType.ALL) {
|
if (type == PType.ALL) {
|
||||||
return true;
|
return true;
|
||||||
} else if (type == PType.OP) {
|
} else if (type == PType.OP) {
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (type == PType.ADMIN) {
|
} else if (type == PType.ADMIN) {
|
||||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (type == PType.MODERATOR) {
|
} else if (type == PType.MODERATOR) {
|
||||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (type == PType.PLAYER) {
|
} else if (type == PType.PLAYER) {
|
||||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.hasPermission("*")) {
|
if (player.hasPermission("*")) {
|
||||||
return true;
|
return true;
|
||||||
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
||||||
return true;
|
return true;
|
||||||
} else if (player.hasPermission(PermissionsC.main + perm.perm)) {
|
} else if (player.hasPermission(PermissionsC.main + perm.perm)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (player.hasPermission(PermissionsC.main + perm.perm + ".*")) {
|
} else if (player.hasPermission(PermissionsC.main + perm.perm + ".*")) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (message) {
|
if (message) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if an player has the permission. Also checks * related permissions.
|
* Check if an player has the permission. Also checks * related permissions.
|
||||||
* This permission does NOT have to be registered.
|
* This permission does NOT have to be registered.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player The player who needs the permission.
|
||||||
* The player who needs the permission.
|
* @param type Type permission.
|
||||||
* @param type
|
* @param perm The permission.
|
||||||
* Type permission.
|
* @param message Send a message to the player saying you don't have the
|
||||||
* @param perm
|
* permission.
|
||||||
* The permission.
|
* @return True/False when either the player has the permission.
|
||||||
* @param message
|
*/
|
||||||
* Send a message to the player saying you don't have the
|
public static boolean hasRawPerm(Player player, PType type, String perm, Boolean message) {
|
||||||
* permission.
|
if (player == null) {
|
||||||
* @return True/False when either the player has the permission.
|
return true;
|
||||||
*/
|
}
|
||||||
public static boolean hasRawPerm(Player player, PType type, String perm, Boolean message) {
|
|
||||||
if (player == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == PType.ALL) {
|
if (type == PType.ALL) {
|
||||||
return true;
|
return true;
|
||||||
} else if (type == PType.OP) {
|
} else if (type == PType.OP) {
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (type == PType.ADMIN) {
|
} else if (type == PType.ADMIN) {
|
||||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (type == PType.MODERATOR) {
|
} else if (type == PType.MODERATOR) {
|
||||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (type == PType.PLAYER) {
|
} else if (type == PType.PLAYER) {
|
||||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.hasPermission("*")) {
|
if (player.hasPermission("*")) {
|
||||||
return true;
|
return true;
|
||||||
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
||||||
return true;
|
return true;
|
||||||
} else if (player.hasPermission(perm)) {
|
} else if (player.hasPermission(perm)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (player.hasPermission(perm)) {
|
} else if (player.hasPermission(perm)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (message) {
|
if (message) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,64 +2,63 @@ package nl.Steffion.BlockHunt;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
||||||
|
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class MemoryStorage {
|
public class MemoryStorage {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Standard stuff.
|
* Standard stuff.
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> newFiles = new ArrayList<>();
|
public static final ArrayList<String> newFiles = new ArrayList<>();
|
||||||
public static ArrayList<CommandManager> commands = new ArrayList<>();
|
public static final ArrayList<CommandManager> commands = new ArrayList<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If you want another file to be created. Copy and paste this line.
|
* If you want another file to be created. Copy and paste this line.
|
||||||
*/
|
*/
|
||||||
public static ConfigManager config = new ConfigManager("config");
|
public static final ConfigManager config = new ConfigManager("config");
|
||||||
public static ConfigManager messages = new ConfigManager("messages");
|
public static final ConfigManager messages = new ConfigManager("messages");
|
||||||
public static ConfigManager arenas = new ConfigManager("arenas");
|
public static final ConfigManager arenas = new ConfigManager("arenas");
|
||||||
public static ConfigManager signs = new ConfigManager("signs");
|
public static final ConfigManager signs = new ConfigManager("signs");
|
||||||
public static ConfigManager shop = new ConfigManager("shop");
|
public static final ConfigManager shop = new ConfigManager("shop");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add any variable you need in different classes here:
|
* Add any variable you need in different classes here:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static HashMap<Player, Location> pos1 = new HashMap<>();
|
public static final HashMap<Player, Location> pos1 = new HashMap<>();
|
||||||
public static HashMap<Player, Location> pos2 = new HashMap<>();
|
public static final HashMap<Player, Location> pos2 = new HashMap<>();
|
||||||
|
|
||||||
public static ArrayList<Arena> arenaList = new ArrayList<>();
|
public static final ArrayList<Arena> arenaList = new ArrayList<>();
|
||||||
public static Random random = new Random();
|
public static final Random random = new Random();
|
||||||
public static HashMap<Player, Integer> seekertime = new HashMap<>();
|
public static final HashMap<Player, Integer> seekertime = new HashMap<>();
|
||||||
|
|
||||||
public static HashMap<Player, PlayerArenaData> pData = new HashMap<>();
|
public static final HashMap<Player, PlayerArenaData> pData = new HashMap<>();
|
||||||
public static HashMap<Player, ItemStack> choosenBlock = new HashMap<>();
|
public static final HashMap<Player, ItemStack> choosenBlock = new HashMap<>();
|
||||||
public static HashMap<Player, Boolean> choosenSeeker = new HashMap<>();
|
public static final HashMap<Player, Boolean> choosenSeeker = new HashMap<>();
|
||||||
|
|
||||||
public static HashMap<Player, ItemStack> pBlock = new HashMap<>();
|
public static final HashMap<Player, ItemStack> pBlock = new HashMap<>();
|
||||||
public static HashMap<Player, Location> moveLoc = new HashMap<>();
|
public static final HashMap<Player, Location> moveLoc = new HashMap<>();
|
||||||
public static HashMap<Player, Location> hiddenLoc = new HashMap<>();
|
public static final HashMap<Player, Location> hiddenLoc = new HashMap<>();
|
||||||
public static HashMap<Player, Boolean> hiddenLocWater = new HashMap<>();
|
public static final HashMap<Player, Boolean> hiddenLocWater = new HashMap<>();
|
||||||
|
|
||||||
public static Map<Player, Location> teleportLoc = new HashMap<>();
|
public static final Map<Player, Location> teleportLoc = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steffion's Engine - Made by Steffion.
|
* Steffion's Engine - Made by Steffion.
|
||||||
*
|
* <p>
|
||||||
* You're allowed to use this engine for own usage, you're not allowed to
|
* You're allowed to use this engine for own usage, you're not allowed to
|
||||||
* republish the engine. Using this for your own plugin is allowed when a
|
* republish the engine. Using this for your own plugin is allowed when a
|
||||||
* credit is placed somewhere in the plugin.
|
* credit is placed somewhere in the plugin.
|
||||||
*
|
* <p>
|
||||||
* Thanks for your cooperate!
|
* Thanks for your cooperate!
|
||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
@ -13,24 +14,24 @@ package nl.Steffion.BlockHunt;
|
|||||||
public class PermissionsC {
|
public class PermissionsC {
|
||||||
|
|
||||||
|
|
||||||
public static String main = BlockHunt.pdfFile.getName().toLowerCase() + ".";
|
public static final String main = BlockHunt.pdfFile.getName().toLowerCase() + ".";
|
||||||
|
|
||||||
public enum PType {
|
public enum PType {
|
||||||
ALL, PLAYER, MODERATOR, ADMIN, OP
|
ALL, PLAYER, MODERATOR, ADMIN, OP
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Permissions {
|
public enum Permissions {
|
||||||
info("info", PType.ALL), help("help", PType.ALL), reload("reload", PType.ADMIN), join("join", PType.PLAYER), joinfull("joinfull", PType.MODERATOR), joinsign(
|
info("info", PType.ALL), help("help", PType.ALL), reload("reload", PType.ADMIN), join("join", PType.PLAYER), joinfull("joinfull", PType.MODERATOR), joinsign(
|
||||||
"joinsign", PType.PLAYER), leave("leave", PType.PLAYER), list("list", PType.PLAYER), shop("shop", PType.PLAYER), shopblockchooser("shop.blockchooser",
|
"joinsign", PType.PLAYER), leave("leave", PType.PLAYER), list("list", PType.PLAYER), shop("shop", PType.PLAYER), shopblockchooser("shop.blockchooser",
|
||||||
PType.ADMIN), start("start", PType.MODERATOR), create("create", PType.ADMIN), set("set", PType.MODERATOR), setwarp("setwarp", PType.MODERATOR), signcreate(
|
PType.ADMIN), start("start", PType.MODERATOR), create("create", PType.ADMIN), set("set", PType.MODERATOR), setwarp("setwarp", PType.MODERATOR), signcreate(
|
||||||
"signcreate", PType.MODERATOR), remove("remove", PType.ADMIN), tokens("tokens", PType.ADMIN), allcommands("allcommands", PType.OP);
|
"signcreate", PType.MODERATOR), remove("remove", PType.ADMIN), tokens("tokens", PType.ADMIN), allcommands("allcommands", PType.OP);
|
||||||
|
|
||||||
public String perm;
|
public final String perm;
|
||||||
public PType type;
|
public final PType type;
|
||||||
|
|
||||||
Permissions(String perm, PType type) {
|
Permissions(String perm, PType type) {
|
||||||
this.perm = perm;
|
this.perm = perm;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
public class PlayerArenaData {
|
import java.util.Collection;
|
||||||
public GameMode pGameMode;
|
|
||||||
public ItemStack[] pInventory;
|
|
||||||
public ItemStack[] pArmor;
|
|
||||||
public Float pEXP;
|
|
||||||
public Integer pEXPL;
|
|
||||||
public Double pMaxHealth;
|
|
||||||
public Double pHealth;
|
|
||||||
public Integer pFood;
|
|
||||||
public Collection<PotionEffect> pPotionEffects;
|
|
||||||
public boolean pFlying;
|
|
||||||
|
|
||||||
public PlayerArenaData(Location pLocation, GameMode pGameMode, ItemStack[] pInventory, ItemStack[] pArmor, Float pEXP, Integer pEXPL, Double pMaxHealth, Double pHealth, Integer pFood,
|
public class PlayerArenaData {
|
||||||
Collection<PotionEffect> pPotionEffects, boolean pFlying) {
|
public final GameMode pGameMode;
|
||||||
this.pGameMode = pGameMode;
|
public final ItemStack[] pInventory;
|
||||||
this.pInventory = pInventory;
|
public final ItemStack[] pArmor;
|
||||||
this.pArmor = pArmor;
|
public final Float pEXP;
|
||||||
this.pEXP = pEXP;
|
public final Integer pEXPL;
|
||||||
this.pEXPL = pEXPL;
|
public final Double pMaxHealth;
|
||||||
this.pMaxHealth = pMaxHealth;
|
public final Double pHealth;
|
||||||
this.pHealth = pHealth;
|
public final Integer pFood;
|
||||||
this.pFood = pFood;
|
public final Collection<PotionEffect> pPotionEffects;
|
||||||
this.pPotionEffects = pPotionEffects;
|
public final boolean pFlying;
|
||||||
this.pFlying = pFlying;
|
|
||||||
}
|
public PlayerArenaData(Location pLocation, GameMode pGameMode, ItemStack[] pInventory, ItemStack[] pArmor, Float pEXP, Integer pEXPL, Double pMaxHealth, Double pHealth, Integer pFood,
|
||||||
|
Collection<PotionEffect> pPotionEffects, boolean pFlying) {
|
||||||
|
this.pGameMode = pGameMode;
|
||||||
|
this.pInventory = pInventory;
|
||||||
|
this.pArmor = pArmor;
|
||||||
|
this.pEXP = pEXP;
|
||||||
|
this.pEXPL = pEXPL;
|
||||||
|
this.pMaxHealth = pMaxHealth;
|
||||||
|
this.pHealth = pHealth;
|
||||||
|
this.pFood = pFood;
|
||||||
|
this.pPotionEffects = pPotionEffects;
|
||||||
|
this.pFlying = pFlying;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlayerHandler {
|
public class PlayerHandler {
|
||||||
public static boolean teleport(Player player, Location location) {
|
public static boolean teleport(Player player, Location location) {
|
||||||
MemoryStorage.teleportLoc.put(player, location);
|
MemoryStorage.teleportLoc.put(player, location);
|
||||||
return player.teleport(location);
|
return player.teleport(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.DisplaySlot;
|
import org.bukkit.scoreboard.DisplaySlot;
|
||||||
@ -11,74 +10,74 @@ import org.bukkit.scoreboard.Score;
|
|||||||
import org.bukkit.scoreboard.Scoreboard;
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
|
|
||||||
public class ScoreboardHandler {
|
public class ScoreboardHandler {
|
||||||
public static void createScoreboard(Arena arena) {
|
public static void createScoreboard(Arena arena) {
|
||||||
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||||
Scoreboard board = arena.scoreboard;
|
Scoreboard board = arena.scoreboard;
|
||||||
if (board.getObjective(arena.arenaName) != null) {
|
if (board.getObjective(arena.arenaName) != null) {
|
||||||
updateScoreboard(arena);
|
updateScoreboard(arena);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String displayName = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32);
|
String displayName = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32);
|
||||||
Objective object = board.registerNewObjective(BlockHunt.cutString(arena.arenaName, 32), "dummy", displayName);
|
Objective object = board.registerNewObjective(BlockHunt.cutString(arena.arenaName, 32), "dummy", displayName);
|
||||||
|
|
||||||
object.setDisplaySlot(DisplaySlot.SIDEBAR);
|
object.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
|
|
||||||
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
||||||
Score timeleft = object.getScore(temp);
|
Score timeleft = object.getScore(temp);
|
||||||
timeleft.setScore(arena.timer);
|
timeleft.setScore(arena.timer);
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||||
Score seekers = object.getScore(temp);
|
Score seekers = object.getScore(temp);
|
||||||
seekers.setScore(arena.seekers.size());
|
seekers.setScore(arena.seekers.size());
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||||
Score hiders = object.getScore(temp);
|
Score hiders = object.getScore(temp);
|
||||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||||
|
|
||||||
if (arena.gameState == ArenaState.INGAME) {
|
if (arena.gameState == ArenaState.INGAME) {
|
||||||
for (Player pl : arena.playersInArena) {
|
for (Player pl : arena.playersInArena) {
|
||||||
pl.setScoreboard(board);
|
pl.setScoreboard(board);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Player pl : arena.playersInArena) {
|
for (Player pl : arena.playersInArena) {
|
||||||
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateScoreboard(Arena arena) {
|
public static void updateScoreboard(Arena arena) {
|
||||||
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||||
Scoreboard board = arena.scoreboard;
|
Scoreboard board = arena.scoreboard;
|
||||||
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
|
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
|
||||||
object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32));
|
object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32));
|
||||||
|
|
||||||
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
||||||
Score timeleft = object.getScore(temp);
|
Score timeleft = object.getScore(temp);
|
||||||
timeleft.setScore(arena.timer);
|
timeleft.setScore(arena.timer);
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||||
Score seekers = object.getScore(temp);
|
Score seekers = object.getScore(temp);
|
||||||
seekers.setScore(arena.seekers.size());
|
seekers.setScore(arena.seekers.size());
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||||
Score hiders = object.getScore(temp);
|
Score hiders = object.getScore(temp);
|
||||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||||
|
|
||||||
if (arena.gameState == ArenaState.INGAME) {
|
if (arena.gameState == ArenaState.INGAME) {
|
||||||
for (Player pl : arena.playersInArena) {
|
for (Player pl : arena.playersInArena) {
|
||||||
pl.setScoreboard(board);
|
pl.setScoreboard(board);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Player pl : arena.playersInArena) {
|
for (Player pl : arena.playersInArena) {
|
||||||
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeScoreboard(Player player) {
|
public static void removeScoreboard(Player player) {
|
||||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,185 +1,184 @@
|
|||||||
package nl.Steffion.BlockHunt;
|
package nl.Steffion.BlockHunt;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class SignsHandler {
|
public class SignsHandler {
|
||||||
|
|
||||||
public static void createSign(SignChangeEvent event, String[] lines, Location location) {
|
public static void createSign(SignChangeEvent event, String[] lines, Location location) {
|
||||||
if (lines[1] != null) {
|
if (lines[1] != null) {
|
||||||
if (lines[1].equalsIgnoreCase("leave")) {
|
if (lines[1].equalsIgnoreCase("leave")) {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
int number = 1;
|
int number = 1;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
if (MemoryStorage.signs.getFile().get("leave_" + number) == null) {
|
if (MemoryStorage.signs.getFile().get("leave_" + number) == null) {
|
||||||
MemoryStorage.signs.getFile().set("leave_" + number + ".arenaName", "leave");
|
MemoryStorage.signs.getFile().set("leave_" + number + ".arenaName", "leave");
|
||||||
MemoryStorage.signs.getFile().set("leave_" + number + ".location", location);
|
MemoryStorage.signs.getFile().set("leave_" + number + ".location", location);
|
||||||
MemoryStorage.signs.save();
|
MemoryStorage.signs.save();
|
||||||
|
|
||||||
saved = true;
|
saved = true;
|
||||||
} else {
|
} else {
|
||||||
number = number + 1;
|
number = number + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (lines[1].equalsIgnoreCase("shop")) {
|
} else if (lines[1].equalsIgnoreCase("shop")) {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
int number = 1;
|
int number = 1;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
if (MemoryStorage.signs.getFile().get("shop_" + number) == null) {
|
if (MemoryStorage.signs.getFile().get("shop_" + number) == null) {
|
||||||
MemoryStorage.signs.getFile().set("shop_" + number + ".arenaName", "shop");
|
MemoryStorage.signs.getFile().set("shop_" + number + ".arenaName", "shop");
|
||||||
MemoryStorage.signs.getFile().set("shop_" + number + ".location", location);
|
MemoryStorage.signs.getFile().set("shop_" + number + ".location", location);
|
||||||
MemoryStorage.signs.save();
|
MemoryStorage.signs.save();
|
||||||
|
|
||||||
saved = true;
|
saved = true;
|
||||||
} else {
|
} else {
|
||||||
number = number + 1;
|
number = number + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (lines[1].equals(arena.arenaName)) {
|
if (lines[1].equals(arena.arenaName)) {
|
||||||
int number = 1;
|
int number = 1;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
if (MemoryStorage.signs.getFile().get(arena.arenaName + "_" + number) == null) {
|
if (MemoryStorage.signs.getFile().get(arena.arenaName + "_" + number) == null) {
|
||||||
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".arenaName", lines[1]);
|
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".arenaName", lines[1]);
|
||||||
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".location", location);
|
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".location", location);
|
||||||
MemoryStorage.signs.save();
|
MemoryStorage.signs.save();
|
||||||
|
|
||||||
saved = true;
|
saved = true;
|
||||||
} else {
|
} else {
|
||||||
number = number + 1;
|
number = number + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saved) {
|
if (!saved) {
|
||||||
MessageManager.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]);
|
MessageManager.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeSign(Location location) {
|
public static void removeSign(Location location) {
|
||||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
if (loc.equals(location)) {
|
if (loc.equals(location)) {
|
||||||
MemoryStorage.signs.getFile().set(sign, null);
|
MemoryStorage.signs.getFile().set(sign, null);
|
||||||
MemoryStorage.signs.save();
|
MemoryStorage.signs.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSign(Location location) {
|
public static boolean isSign(Location location) {
|
||||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
if (loc.equals(location)) {
|
if (loc.equals(location)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateSigns() {
|
public static void updateSigns() {
|
||||||
MemoryStorage.signs.load();
|
MemoryStorage.signs.load();
|
||||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
|
|
||||||
// check if that area is actually loaded. If not move on.
|
// check if that area is actually loaded. If not move on.
|
||||||
if (loc.getWorld().isChunkLoaded(loc.getBlockX() >> 4, loc.getBlockZ() >> 4)) {
|
if (loc.getWorld().isChunkLoaded(loc.getBlockX() >> 4, loc.getBlockZ() >> 4)) {
|
||||||
if (loc.getBlock().getState() instanceof Sign) {
|
if (loc.getBlock().getState() instanceof Sign) {
|
||||||
Sign signblock = (Sign) loc.getBlock().getState();
|
Sign signblock = (Sign) loc.getBlock().getState();
|
||||||
String[] lines = signblock.getLines();
|
String[] lines = signblock.getLines();
|
||||||
if (sign.contains("leave")) {
|
if (sign.contains("leave")) {
|
||||||
|
|
||||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
if (linecount <= 3) {
|
if (linecount <= 3) {
|
||||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||||
}
|
}
|
||||||
|
|
||||||
linecount = linecount + 1;
|
linecount = linecount + 1;
|
||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else if (sign.contains("shop")) {
|
} else if (sign.contains("shop")) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
if (linecount <= 3) {
|
if (linecount <= 3) {
|
||||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||||
}
|
}
|
||||||
|
|
||||||
linecount = linecount + 1;
|
linecount = linecount + 1;
|
||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else {
|
} else {
|
||||||
for (Arena arena : MemoryStorage.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (lines[1].endsWith(arena.arenaName)) {
|
if (lines[1].endsWith(arena.arenaName)) {
|
||||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_WAITING.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_WAITING.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
if (signLines != null) {
|
if (signLines != null) {
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
if (linecount <= 3) {
|
if (linecount <= 3) {
|
||||||
signblock.setLine(
|
signblock.setLine(
|
||||||
linecount,
|
linecount,
|
||||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||||
}
|
}
|
||||||
|
|
||||||
linecount = linecount + 1;
|
linecount = linecount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_STARTING.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_STARTING.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
if (signLines != null) {
|
if (signLines != null) {
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
if (linecount <= 3) {
|
if (linecount <= 3) {
|
||||||
signblock.setLine(
|
signblock.setLine(
|
||||||
linecount,
|
linecount,
|
||||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||||
}
|
}
|
||||||
|
|
||||||
linecount = linecount + 1;
|
linecount = linecount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else if (arena.gameState.equals(ArenaState.INGAME)) {
|
} else if (arena.gameState.equals(ArenaState.INGAME)) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_INGAME.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_INGAME.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
if (signLines != null) {
|
if (signLines != null) {
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
if (linecount <= 3) {
|
if (linecount <= 3) {
|
||||||
signblock.setLine(
|
signblock.setLine(
|
||||||
linecount,
|
linecount,
|
||||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||||
}
|
}
|
||||||
|
|
||||||
linecount = linecount + 1;
|
linecount = linecount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
removeSign(loc);
|
removeSign(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import me.libraryaddict.disguise.DisguiseAPI;
|
|||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -16,47 +15,47 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class SolidBlockHandler {
|
public class SolidBlockHandler {
|
||||||
|
|
||||||
public static void makePlayerUnsolid(Player player) {
|
public static void makePlayerUnsolid(Player player) {
|
||||||
ItemStack block = player.getInventory().getItem(8);
|
ItemStack block = player.getInventory().getItem(8);
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
player.sendMessage(ChatColor.RED + "Unable to hide you because your inventory block is missing!");
|
player.sendMessage(ChatColor.RED + "Unable to hide you because your inventory block is missing!");
|
||||||
System.out.println("[BlockHunt] ERROR: " + player.getName() + " could not be hidden because their inventory block was missing!");
|
System.out.println("[BlockHunt] ERROR: " + player.getName() + " could not be hidden because their inventory block was missing!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block pBlock = player.getLocation().getBlock();
|
Block pBlock = player.getLocation().getBlock();
|
||||||
|
|
||||||
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
||||||
pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
block.setAmount(5);
|
block.setAmount(5);
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||||
if (!pl.equals(player)) {
|
if (!pl.equals(player)) {
|
||||||
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||||
if (MemoryStorage.hiddenLocWater.get(player)) {
|
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
||||||
} else {
|
} else {
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryStorage.hiddenLocWater.remove(player);
|
MemoryStorage.hiddenLocWater.remove(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_BAT_HURT, 1, 1);
|
player.playSound(player.getLocation(), Sound.ENTITY_BAT_HURT, 1, 1);
|
||||||
block.removeEnchantment(Enchantment.DURABILITY);
|
block.removeEnchantment(Enchantment.DURABILITY);
|
||||||
|
|
||||||
for (Player playerShow : Bukkit.getOnlinePlayers()) {
|
for (Player playerShow : Bukkit.getOnlinePlayers()) {
|
||||||
playerShow.showPlayer(BlockHunt.plugin, player);
|
playerShow.showPlayer(BlockHunt.plugin, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType());
|
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType());
|
||||||
DisguiseAPI.disguiseToAll(player, disguise);
|
DisguiseAPI.disguiseToAll(player, disguise);
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid);
|
MessageManager.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,92 +1,90 @@
|
|||||||
log-enabledPlugin: '%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%authors%%N.'
|
log-enabledPlugin:'%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%authors%%N.'
|
||||||
log-disabledPlugin: '%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.'
|
log-disabledPlugin:'%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.'
|
||||||
info: '%NDisplays the plugin''s info.'
|
info:'%NDisplays the plugin''s info.'
|
||||||
help: '%NShows a list of commands.'
|
help:'%NShows a list of commands.'
|
||||||
reload: '%NReloads all configs.'
|
reload:'%NReloads all configs.'
|
||||||
join: '%NJoins a BlockHunt game.'
|
join:'%NJoins a BlockHunt game.'
|
||||||
leave: '%NLeave a BlockHunt game.'
|
leave:'%NLeave a BlockHunt game.'
|
||||||
list: '%NShows a list of available arenas.'
|
list:'%NShows a list of available arenas.'
|
||||||
shop: '%NOpens the BlockHunt shop.'
|
shop:'%NOpens the BlockHunt shop.'
|
||||||
start: '%NForces an arena to start.'
|
start:'%NForces an arena to start.'
|
||||||
wand: '%NGives you the wand selection tool.'
|
wand:'%NGives you the wand selection tool.'
|
||||||
create: '%NCreates an arena from your selection.'
|
create:'%NCreates an arena from your selection.'
|
||||||
set: '%NOpens a panel to set settings.'
|
set:'%NOpens a panel to set settings.'
|
||||||
setwarp: '%NSets warps for your arena.'
|
setwarp:'%NSets warps for your arena.'
|
||||||
remove: '%NDeletes an Arena.'
|
remove:'%NDeletes an Arena.'
|
||||||
tokens: '%NChange someones tokens.'
|
tokens:'%NChange someones tokens.'
|
||||||
#buttons
|
#buttons
|
||||||
button-add: '%NAdd %A%1%%N to %A%2%%N'
|
button-add:'%NAdd %A%1%%N to %A%2%%N'
|
||||||
button-add2: Add
|
button-add2:Add
|
||||||
button-setting: '%NSetting %A%1%%N is now: %A%2%%N.'
|
button-setting:'%NSetting %A%1%%N is now: %A%2%%N.'
|
||||||
button-remove: '%NRemove %A%1%%N from %A%2%%N'
|
button-remove:'%NRemove %A%1%%N from %A%2%%N'
|
||||||
button-remove2: Remove
|
button-remove2:Remove
|
||||||
#Normal
|
#Normal
|
||||||
reloadedConfigs: '%TAG&aReloaded all configs!'
|
reloadedConfigs:'%TAG&aReloaded all configs!'
|
||||||
joinJoinedArena: '%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
joinJoinedArena:'%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
||||||
leaveYouLeft: '%TAG%NYou left the arena! Thanks for playing!'
|
leaveYouLeft:'%TAG%NYou left the arena! Thanks for playing!'
|
||||||
leaveLeftArena: '%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
leaveLeftArena:'%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
||||||
startForced: '%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
startForced:'%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
||||||
wandGaveWand: '%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)'
|
wandGaveWand:'%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)'
|
||||||
wandSetPosition: '%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N,%A%z%%N).'
|
wandSetPosition:'%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N,%A%z%%N).'
|
||||||
createCreatedArena: '%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
createCreatedArena:'%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
||||||
lobbyArenaIsStarting: '%TAG%NThe arena will start in %A%1%%N second(s)!'
|
lobbyArenaIsStarting:'%TAG%NThe arena will start in %A%1%%N second(s)!'
|
||||||
lobbyArenaStarted: '%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!'
|
lobbyArenaStarted:'%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!'
|
||||||
ingameSeekerChoosen: '%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
ingameSeekerChoosen:'%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
||||||
ingameBlock: '%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
ingameBlock:'%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
||||||
ingameArenaEnd: '%TAG%NThe arena will end in %A%1%%N second(s)!'
|
ingameArenaEnd:'%TAG%NThe arena will end in %A%1%%N second(s)!'
|
||||||
ingameSeekerSpawned: '%TAG%A%playername%%N has spawned as a seeker!'
|
ingameSeekerSpawned:'%TAG%A%playername%%N has spawned as a seeker!'
|
||||||
ingameGivenSword: '%TAG%NYou were given a sword!'
|
ingameGivenSword:'%TAG%NYou were given a sword!'
|
||||||
ingameHiderDied: '%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
ingameHiderDied:'%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
||||||
ingameHidersLeft: '%NHider(s) left: %A%left%%N'
|
ingameHidersLeft:'%NHider(s) left: %A%left%%N'
|
||||||
ingameSeekerDied: '%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
ingameSeekerDied:'%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
||||||
winSeekers: '%TAG%NThe %ASEEKERS%N have won!'
|
winSeekers:'%TAG%NThe %ASEEKERS%N have won!'
|
||||||
winHiders: '%TAG%NThe %AHIDERS%N have won!'
|
winHiders:'%TAG%NThe %AHIDERS%N have won!'
|
||||||
setwarpWarpSet: '%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
setwarpWarpSet:'%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
||||||
addedToken: '%TAG%A%amount%%N tokens were added to your account!'
|
addedToken:'%TAG%A%amount%%N tokens were added to your account!'
|
||||||
removeRemovedArena: '%TAG%NRemoved arena ''%A%name%%N''!'
|
removeRemovedArena:'%TAG%NRemoved arena ''%A%name%%N''!'
|
||||||
tokensChanged: '%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.'
|
tokensChanged:'%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.'
|
||||||
tokensChangedPerson: '%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.'
|
tokensChangedPerson:'%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.'
|
||||||
ingameNowSolid: '%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
ingameNowSolid:'%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
||||||
ingameNoMoreSolid: '%TAG%NYou''re no longer a solid block!'
|
ingameNoMoreSolid:'%TAG%NYou''re no longer a solid block!'
|
||||||
shopBoughtItem: '%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
shopBoughtItem:'%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
||||||
shopChoosenBlock: '%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
shopChoosenBlock:'%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
||||||
shopChoosenSeeker: '%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
shopChoosenSeeker:'%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
||||||
shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!'
|
shopChoosenHiders:'%TAG%NYou''ve choosen to be a %Ahider%N!'
|
||||||
ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N'
|
ingameBlocksLeft:'%TAG%NRemaining blocks: %A%1%%N'
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
lobbyNeedAtleast: '%TAG%WYou need atleast %A%1%%W player(s) to start the game!'
|
lobbyNeedAtleast:'%TAG%WYou need atleast %A%1%%W player(s) to start the game!'
|
||||||
ingameNEWSeekerChoosen: '%TAG%WThe last seeker left and a new seeker has been choosen!'
|
ingameNEWSeekerChoosen:'%TAG%WThe last seeker left and a new seeker has been choosen!'
|
||||||
unableToCommand: '%TAG%WSorry but that command is disabled in the arena.'
|
unableToCommand:'%TAG%WSorry but that command is disabled in the arena.'
|
||||||
ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!'
|
ingameNoSolidPlace:'%TAG%WThat''s not a valid place to become solid!'
|
||||||
arenaStopped: '%TAG%WThe arena has been forced to stop!'
|
arenaStopped:'%TAG%WThe arena has been forced to stop!'
|
||||||
|
error-noPermission:'%TAG%EYou don''t have the permissions to do that!'
|
||||||
error-noPermission: '%TAG%EYou don''t have the permissions to do that!'
|
error-notANumber:'%TAG%E''%A%1%%E'' is not a number!'
|
||||||
error-notANumber: '%TAG%E''%A%1%%E'' is not a number!'
|
error-commandNotEnabled:'%TAG%EThis command has been disabled!'
|
||||||
error-commandNotEnabled: '%TAG%EThis command has been disabled!'
|
error-commandNotFound:'%TAG%ECouldn''t find the command. Try %A/BlockHunt help %Efor more info.'
|
||||||
error-commandNotFound: '%TAG%ECouldn''t find the command. Try %A/BlockHunt help %Efor more info.'
|
error-notEnoughArguments:'%TAG%EYou''re missing arguments, correct syntax: %A%syntax%'
|
||||||
error-notEnoughArguments: '%TAG%EYou''re missing arguments, correct syntax: %A%syntax%'
|
error-libsDisguisesNotInstalled:'%TAG%EThe plugin ''%ALib''s Disguises%E'' is required to run this plugin! Intall it or it won''t work!'
|
||||||
error-libsDisguisesNotInstalled: '%TAG%EThe plugin ''%ALib''s Disguises%E'' is required to run this plugin! Intall it or it won''t work!'
|
error-protocolLibNotInstalled:'%TAG%EThe plugin ''%AProtocolLib%E'' is required to run this plugin! Intall it or it won''t work!'
|
||||||
error-protocolLibNotInstalled: '%TAG%EThe plugin ''%AProtocolLib%E'' is required to run this plugin! Intall it or it won''t work!'
|
error-noArena:'%TAG%ENo arena found with the name ''%A%name%%E''.'
|
||||||
error-noArena: '%TAG%ENo arena found with the name ''%A%name%%E''.'
|
error-onlyIngame:'%TAG%EThis is an only in-game command!'
|
||||||
error-onlyIngame: '%TAG%EThis is an only in-game command!'
|
error-joinAlreadyJoined:'%TAG%EYou''ve already joined an arena!'
|
||||||
error-joinAlreadyJoined: '%TAG%EYou''ve already joined an arena!'
|
error-joinNoBlocksSet:'%TAG%EThere are none blocks set for this arena. Notify the administrator.'
|
||||||
error-joinNoBlocksSet: '%TAG%EThere are none blocks set for this arena. Notify the administrator.'
|
error-joinWarpsNotSet:'%TAG%EThere are no warps set for this arena. Notify the administrator.'
|
||||||
error-joinWarpsNotSet: '%TAG%EThere are no warps set for this arena. Notify the administrator.'
|
error-joinArenaIngame:'%TAG%EThis game has already started.'
|
||||||
error-joinArenaIngame: '%TAG%EThis game has already started.'
|
error-joinFull:'%TAG%EUnable to join this arena. It''s full!'
|
||||||
error-joinFull: '%TAG%EUnable to join this arena. It''s full!'
|
error-joinInventoryNotEmpty:'%TAG%EYour inventory should be empty before joining!'
|
||||||
error-joinInventoryNotEmpty: '%TAG%EYour inventory should be empty before joining!'
|
error-leaveNotInArena:'%TAG%EYou''re not in an arena!'
|
||||||
error-leaveNotInArena: '%TAG%EYou''re not in an arena!'
|
error-createSelectionFirst:'%TAG%EMake a selection first. Use the wand command: %A/BlockHunt <wand|w>%E.'
|
||||||
error-createSelectionFirst: '%TAG%EMake a selection first. Use the wand command: %A/BlockHunt <wand|w>%E.'
|
error-createNotSameWorld:'%TAG%EMake your selection points in the same world!'
|
||||||
error-createNotSameWorld: '%TAG%EMake your selection points in the same world!'
|
error-setTooHighNumber:'%TAG%EThat amount is too high! Max amount is: %A%max%%E.'
|
||||||
error-setTooHighNumber: '%TAG%EThat amount is too high! Max amount is: %A%max%%E.'
|
error-setTooLowNumber:'%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
||||||
error-setTooLowNumber: '%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
error-setNotABlock:'%TAG%EThat is not a block!'
|
||||||
error-setNotABlock: '%TAG%EThat is not a block!'
|
error-setwarpWarpNotFound:'%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
||||||
error-setwarpWarpNotFound: '%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
error-tokensPlayerNotOnline:'%TAG%ENo player found with the name ''%A%playername%%E''!'
|
||||||
error-tokensPlayerNotOnline: '%TAG%ENo player found with the name ''%A%playername%%E''!'
|
error-tokensUnknownsetting:'%TAG%E''%A%option%%E'' is not a known option!'
|
||||||
error-tokensUnknownsetting: '%TAG%E''%A%option%%E'' is not a known option!'
|
error-shopNeedMoreTokens:'%TAG%EYou need more tokens before you can buy this item.'
|
||||||
error-shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.'
|
error-shopMaxSeekersReached:'%TAG%ESorry, the maximum amount of seekers has been reached!'
|
||||||
error-shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!'
|
error-shopMaxHidersReached:'%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||||
error-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'
|
error-teleportFailed:'%TAG%EUnable to teleport you into the arena.'
|
||||||
error-teleportFailed: '%TAG%EUnable to teleport you into the arena.'
|
error-teleportBlocked:'%TAG%EYou cannot teleport while playing!'
|
||||||
error-teleportBlocked: '%TAG%EYou cannot teleport while playing!'
|
|
||||||
|
@ -1,92 +1,90 @@
|
|||||||
log-enabledPlugin: '%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%authors%%N.'
|
log-enabledPlugin:'%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%authors%%N.'
|
||||||
log-disabledPlugin: '%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.'
|
log-disabledPlugin:'%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.'
|
||||||
info: '%NDisplays the plugin''s info.'
|
info:'%NDisplays the plugin''s info.'
|
||||||
help: '%NShows a list of commands.'
|
help:'%NShows a list of commands.'
|
||||||
reload: '%NReloads all configs.'
|
reload:'%NReloads all configs.'
|
||||||
join: '%NJoins a BlockHunt game.'
|
join:'%NJoins a BlockHunt game.'
|
||||||
leave: '%NLeave a BlockHunt game.'
|
leave:'%NLeave a BlockHunt game.'
|
||||||
list: '%NShows a list of available arenas.'
|
list:'%NShows a list of available arenas.'
|
||||||
shop: '%NOpens the BlockHunt shop.'
|
shop:'%NOpens the BlockHunt shop.'
|
||||||
start: '%NForces an arena to start.'
|
start:'%NForces an arena to start.'
|
||||||
wand: '%NGives you the wand selection tool.'
|
wand:'%NGives you the wand selection tool.'
|
||||||
create: '%NCreates an arena from your selection.'
|
create:'%NCreates an arena from your selection.'
|
||||||
set: '%NOpens a panel to set settings.'
|
set:'%NOpens a panel to set settings.'
|
||||||
setwarp: '%NSets warps for your arena.'
|
setwarp:'%NSets warps for your arena.'
|
||||||
remove: '%NDeletes an Arena.'
|
remove:'%NDeletes an Arena.'
|
||||||
tokens: '%NChange someones tokens.'
|
tokens:'%NChange someones tokens.'
|
||||||
#buttons
|
#buttons
|
||||||
button-add: '%NAdd %A%1%%N to %A%2%%N'
|
button-add:'%NAdd %A%1%%N to %A%2%%N'
|
||||||
button-add2: Add
|
button-add2:Add
|
||||||
button-setting: '%NSetting %A%1%%N is now: %A%2%%N.'
|
button-setting:'%NSetting %A%1%%N is now: %A%2%%N.'
|
||||||
button-remove: '%NRemove %A%1%%N from %A%2%%N'
|
button-remove:'%NRemove %A%1%%N from %A%2%%N'
|
||||||
button-remove2: Remove
|
button-remove2:Remove
|
||||||
#Normal
|
#Normal
|
||||||
reloadedConfigs: '%TAG&aReloaded all configs!'
|
reloadedConfigs:'%TAG&aReloaded all configs!'
|
||||||
joinJoinedArena: '%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
joinJoinedArena:'%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
||||||
leaveYouLeft: '%TAG%NYou left the arena! Thanks for playing!'
|
leaveYouLeft:'%TAG%NYou left the arena! Thanks for playing!'
|
||||||
leaveLeftArena: '%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
leaveLeftArena:'%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
||||||
startForced: '%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
startForced:'%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
||||||
wandGaveWand: '%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)'
|
wandGaveWand:'%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)'
|
||||||
wandSetPosition: '%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N,%A%z%%N).'
|
wandSetPosition:'%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N,%A%z%%N).'
|
||||||
createCreatedArena: '%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
createCreatedArena:'%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
||||||
lobbyArenaIsStarting: '%TAG%NThe arena will start in %A%1%%N second(s)!'
|
lobbyArenaIsStarting:'%TAG%NThe arena will start in %A%1%%N second(s)!'
|
||||||
lobbyArenaStarted: '%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!'
|
lobbyArenaStarted:'%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!'
|
||||||
ingameSeekerChoosen: '%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
ingameSeekerChoosen:'%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
||||||
ingameBlock: '%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
ingameBlock:'%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
||||||
ingameArenaEnd: '%TAG%NThe arena will end in %A%1%%N second(s)!'
|
ingameArenaEnd:'%TAG%NThe arena will end in %A%1%%N second(s)!'
|
||||||
ingameSeekerSpawned: '%TAG%A%playername%%N has spawned as a seeker!'
|
ingameSeekerSpawned:'%TAG%A%playername%%N has spawned as a seeker!'
|
||||||
ingameGivenSword: '%TAG%NYou were given a sword!'
|
ingameGivenSword:'%TAG%NYou were given a sword!'
|
||||||
ingameHiderDied: '%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
ingameHiderDied:'%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
||||||
ingameHidersLeft: '%NHider(s) left: %A%left%%N'
|
ingameHidersLeft:'%NHider(s) left: %A%left%%N'
|
||||||
ingameSeekerDied: '%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
ingameSeekerDied:'%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
||||||
winSeekers: '%TAG%NThe %ASEEKERS%N have won!'
|
winSeekers:'%TAG%NThe %ASEEKERS%N have won!'
|
||||||
winHiders: '%TAG%NThe %AHIDERS%N have won!'
|
winHiders:'%TAG%NThe %AHIDERS%N have won!'
|
||||||
setwarpWarpSet: '%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
setwarpWarpSet:'%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
||||||
addedToken: '%TAG%A%amount%%N tokens were added to your account!'
|
addedToken:'%TAG%A%amount%%N tokens were added to your account!'
|
||||||
removeRemovedArena: '%TAG%NRemoved arena ''%A%name%%N''!'
|
removeRemovedArena:'%TAG%NRemoved arena ''%A%name%%N''!'
|
||||||
tokensChanged: '%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.'
|
tokensChanged:'%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.'
|
||||||
tokensChangedPerson: '%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.'
|
tokensChangedPerson:'%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.'
|
||||||
ingameNowSolid: '%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
ingameNowSolid:'%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
||||||
ingameNoMoreSolid: '%TAG%NYou''re no longer a solid block!'
|
ingameNoMoreSolid:'%TAG%NYou''re no longer a solid block!'
|
||||||
shopBoughtItem: '%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
shopBoughtItem:'%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
||||||
shopChoosenBlock: '%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
shopChoosenBlock:'%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
||||||
shopChoosenSeeker: '%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
shopChoosenSeeker:'%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
||||||
shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!'
|
shopChoosenHiders:'%TAG%NYou''ve choosen to be a %Ahider%N!'
|
||||||
ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N'
|
ingameBlocksLeft:'%TAG%NRemaining blocks: %A%1%%N'
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
lobbyNeedAtleast: '%TAG%WYou need atleast %A%1%%W player(s) to start the game!'
|
lobbyNeedAtleast:'%TAG%WYou need atleast %A%1%%W player(s) to start the game!'
|
||||||
ingameNEWSeekerChoosen: '%TAG%WThe last seeker left and a new seeker has been choosen!'
|
ingameNEWSeekerChoosen:'%TAG%WThe last seeker left and a new seeker has been choosen!'
|
||||||
unableToCommand: '%TAG%WSorry but that command is disabled in the arena.'
|
unableToCommand:'%TAG%WSorry but that command is disabled in the arena.'
|
||||||
ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!'
|
ingameNoSolidPlace:'%TAG%WThat''s not a valid place to become solid!'
|
||||||
arenaStopped: '%TAG%WThe arena has been forced to stop!'
|
arenaStopped:'%TAG%WThe arena has been forced to stop!'
|
||||||
|
error-noPermission:'%TAG%EYou don''t have the permissions to do that!'
|
||||||
error-noPermission: '%TAG%EYou don''t have the permissions to do that!'
|
error-notANumber:'%TAG%E''%A%1%%E'' is not a number!'
|
||||||
error-notANumber: '%TAG%E''%A%1%%E'' is not a number!'
|
error-commandNotEnabled:'%TAG%EThis command has been disabled!'
|
||||||
error-commandNotEnabled: '%TAG%EThis command has been disabled!'
|
error-commandNotFound:'%TAG%ECouldn''t find the command. Try %A/BlockHunt help %Efor more info.'
|
||||||
error-commandNotFound: '%TAG%ECouldn''t find the command. Try %A/BlockHunt help %Efor more info.'
|
error-notEnoughArguments:'%TAG%EYou''re missing arguments, correct syntax: %A%syntax%'
|
||||||
error-notEnoughArguments: '%TAG%EYou''re missing arguments, correct syntax: %A%syntax%'
|
error-libsDisguisesNotInstalled:'%TAG%EThe plugin ''%ALib''s Disguises%E'' is required to run this plugin! Intall it or it won''t work!'
|
||||||
error-libsDisguisesNotInstalled: '%TAG%EThe plugin ''%ALib''s Disguises%E'' is required to run this plugin! Intall it or it won''t work!'
|
error-protocolLibNotInstalled:'%TAG%EThe plugin ''%AProtocolLib%E'' is required to run this plugin! Intall it or it won''t work!'
|
||||||
error-protocolLibNotInstalled: '%TAG%EThe plugin ''%AProtocolLib%E'' is required to run this plugin! Intall it or it won''t work!'
|
error-noArena:'%TAG%ENo arena found with the name ''%A%name%%E''.'
|
||||||
error-noArena: '%TAG%ENo arena found with the name ''%A%name%%E''.'
|
error-onlyIngame:'%TAG%EThis is an only in-game command!'
|
||||||
error-onlyIngame: '%TAG%EThis is an only in-game command!'
|
error-joinAlreadyJoined:'%TAG%EYou''ve already joined an arena!'
|
||||||
error-joinAlreadyJoined: '%TAG%EYou''ve already joined an arena!'
|
error-joinNoBlocksSet:'%TAG%EThere are none blocks set for this arena. Notify the administrator.'
|
||||||
error-joinNoBlocksSet: '%TAG%EThere are none blocks set for this arena. Notify the administrator.'
|
error-joinWarpsNotSet:'%TAG%EThere are no warps set for this arena. Notify the administrator.'
|
||||||
error-joinWarpsNotSet: '%TAG%EThere are no warps set for this arena. Notify the administrator.'
|
error-joinArenaIngame:'%TAG%EThis game has already started.'
|
||||||
error-joinArenaIngame: '%TAG%EThis game has already started.'
|
error-joinFull:'%TAG%EUnable to join this arena. It''s full!'
|
||||||
error-joinFull: '%TAG%EUnable to join this arena. It''s full!'
|
error-joinInventoryNotEmpty:'%TAG%EYour inventory should be empty before joining!'
|
||||||
error-joinInventoryNotEmpty: '%TAG%EYour inventory should be empty before joining!'
|
error-leaveNotInArena:'%TAG%EYou''re not in an arena!'
|
||||||
error-leaveNotInArena: '%TAG%EYou''re not in an arena!'
|
error-createSelectionFirst:'%TAG%EMake a selection first. Use the wand command: %A/BlockHunt <wand|w>%E.'
|
||||||
error-createSelectionFirst: '%TAG%EMake a selection first. Use the wand command: %A/BlockHunt <wand|w>%E.'
|
error-createNotSameWorld:'%TAG%EMake your selection points in the same world!'
|
||||||
error-createNotSameWorld: '%TAG%EMake your selection points in the same world!'
|
error-setTooHighNumber:'%TAG%EThat amount is too high! Max amount is: %A%max%%E.'
|
||||||
error-setTooHighNumber: '%TAG%EThat amount is too high! Max amount is: %A%max%%E.'
|
error-setTooLowNumber:'%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
||||||
error-setTooLowNumber: '%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
error-setNotABlock:'%TAG%EThat is not a block!'
|
||||||
error-setNotABlock: '%TAG%EThat is not a block!'
|
error-setwarpWarpNotFound:'%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
||||||
error-setwarpWarpNotFound: '%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
error-tokensPlayerNotOnline:'%TAG%ENo player found with the name ''%A%playername%%E''!'
|
||||||
error-tokensPlayerNotOnline: '%TAG%ENo player found with the name ''%A%playername%%E''!'
|
error-tokensUnknownsetting:'%TAG%E''%A%option%%E'' is not a known option!'
|
||||||
error-tokensUnknownsetting: '%TAG%E''%A%option%%E'' is not a known option!'
|
error-shopNeedMoreTokens:'%TAG%EYou need more tokens before you can buy this item.'
|
||||||
error-shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.'
|
error-shopMaxSeekersReached:'%TAG%ESorry, the maximum amount of seekers has been reached!'
|
||||||
error-shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!'
|
error-shopMaxHidersReached:'%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||||
error-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'
|
error-teleportFailed:'%TAG%EUnable to teleport you into the arena.'
|
||||||
error-teleportFailed: '%TAG%EUnable to teleport you into the arena.'
|
error-teleportBlocked:'%TAG%EYou cannot teleport while playing!'
|
||||||
error-teleportBlocked: '%TAG%EYou cannot teleport while playing!'
|
|
||||||
|
@ -5,19 +5,19 @@ api-version: ${spigot.api.version}
|
|||||||
authors:
|
authors:
|
||||||
- Steffion
|
- Steffion
|
||||||
description: An easy to set up, Hide and seek plugin. Hide as blocks from the killer seekers.
|
description: An easy to set up, Hide and seek plugin. Hide as blocks from the killer seekers.
|
||||||
softdepend: [LibsDisguises, ProtocolLib, Multiverse-Core, My Worlds]
|
softdepend: [ LibsDisguises, ProtocolLib, Multiverse-Core, My Worlds ]
|
||||||
load: POSTWORLD
|
load: POSTWORLD
|
||||||
commands:
|
commands:
|
||||||
BlockHunt:
|
BlockHunt:
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
description: N/A
|
description: N/A
|
||||||
aliases:
|
aliases:
|
||||||
- bh
|
- bh
|
||||||
- prophunt
|
- prophunt
|
||||||
- ph
|
- ph
|
||||||
- hideandseek
|
- hideandseek
|
||||||
- has
|
- has
|
||||||
- hs
|
- hs
|
||||||
- seekandfind
|
- seekandfind
|
||||||
- saf
|
- saf
|
||||||
- sf
|
- sf
|
@ -13,7 +13,7 @@ TestArena:
|
|||||||
pitch: 4.19999
|
pitch: 4.19999
|
||||||
yaw: -182.09694
|
yaw: -182.09694
|
||||||
hidersTakeFallDamage: false
|
hidersTakeFallDamage: false
|
||||||
seekersWinCommands: []
|
seekersWinCommands: [ ]
|
||||||
killTokens: 0
|
killTokens: 0
|
||||||
gameTime: 660
|
gameTime: 660
|
||||||
hidersWarp:
|
hidersWarp:
|
||||||
@ -28,7 +28,7 @@ TestArena:
|
|||||||
seekersTakeFallDamage: false
|
seekersTakeFallDamage: false
|
||||||
hidersCanHurtHiders: false
|
hidersCanHurtHiders: false
|
||||||
maxPlayers: 40
|
maxPlayers: 40
|
||||||
hidersWinCommands: []
|
hidersWinCommands: [ ]
|
||||||
timeInLobbyUntilStart: 50
|
timeInLobbyUntilStart: 50
|
||||||
minPlayers: 5
|
minPlayers: 5
|
||||||
timeUntilHidersSword: 0
|
timeUntilHidersSword: 0
|
||||||
@ -40,7 +40,7 @@ TestArena:
|
|||||||
z: -130.5
|
z: -130.5
|
||||||
pitch: 4.200027
|
pitch: 4.200027
|
||||||
yaw: 41.700073
|
yaw: 41.700073
|
||||||
allowedCommands: []
|
allowedCommands: [ ]
|
||||||
amountSeekersOnStart: 1
|
amountSeekersOnStart: 1
|
||||||
pos1:
|
pos1:
|
||||||
==: org.bukkit.Location
|
==: org.bukkit.Location
|
||||||
|
Loading…
x
Reference in New Issue
Block a user