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.
|
||||
|
||||
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.
|
||||
|
||||
Thanks for helping!
|
||||
|
||||
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
|
||||
|
||||
@ -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
|
||||
|
||||
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,
|
||||
|
||||
|
76
README.md
76
README.md
@ -1,9 +1,12 @@
|
||||
BlockHunt
|
||||
====
|
||||
# ![Thanks to ColeRule for making this awesome banner!](http://g2f.nl/0qheg35 "Thanks to ColeRule for making this awesome banner!")
|
||||
|
||||
# ![Thanks to ColeRule for making this awesome banner!](http://g2f.nl/0qheg35 "Thanks to ColeRule for making this awesome banner!")
|
||||
|
||||
## 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".
|
||||
|
||||
@ -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 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Release| **v0.2.1** | **v1.12.2** | [![Build Status](https://jenkins.addstar.com.au/job/Blockhunt/badge/icon)] | [DOWNLOAD](https://jenkins.addstar.com.au/job/Blockhunt/lastSuccessfulBuild/artifact/target/) |
|
||||
| Release| **v0.2.1** | **
|
||||
v1.12.2** | [![Build Status](https://jenkins.addstar.com.au/job/Blockhunt/badge/icon)] | [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/))
|
||||
|
||||
### 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
|
||||
|
||||
* Custom wand for selection arena.
|
||||
* Multiple arenas.
|
||||
* **Join/Leave signs!**
|
||||
@ -36,50 +41,47 @@ This plugin has been heavily inspired from the gamemode "PropHunt", from the gam
|
||||
* Instant respawn.
|
||||
* **_And more!_**
|
||||
|
||||
##Commands & Permissions
|
||||
## Commands & Permissions
|
||||
|
||||
_**Note:** Instead of using /BlockHunt you could use:_
|
||||
|
||||
* /bh
|
||||
* /hideandseek
|
||||
* /seekandfind (from my old plugin)
|
||||
|
||||
<> = Required [] = Optional
|
||||
|
||||
|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 players have this permission from default._|
|
||||
|`/BlockHunt <reload/r>`|Reloads all configs.|blockhunt.reload|blockhunt.admin|
|
||||
|`/BlockHunt <join/j> <arenaname>`|Joins a BlockHunt game.|blockhunt.join|blockhunt.player|
|
||||
|`/BlockHunt <leave/l>`|Leave a BlockHunt game.|blockhunt.leave|blockhunt.player|
|
||||
|`/BlockHunt <list/li>`|Shows a list of available arenas.|blockhunt.list|blockhunt.player|
|
||||
|`/BlockHunt <shop/sh>`|Opens the BlockHunt shop.|blockhunt.shop|blockhunt.player|
|
||||
|`/BlockHunt <start/go> <arenaname>`|Forces an arena to start.|blockhunt.start|blockhunt.moderator|
|
||||
|`/BlockHunt <wand/w>`|Gives you the wand selection tool.|blockhunt.create|blockhunt.admin|
|
||||
|`/BlockHunt <create/c> <arenaname>`|Creates an arena from your selection.|blockhunt.create|blockhunt.admin|
|
||||
|`/BlockHunt <set/s> <arenaname>`|Opens a panel to set settings.|blockhunt.set|blockhunt.moderator|
|
||||
|`/BlockHunt <setwarp/sw> <lobby/hiders/seekers/spawn> <arenaname>`|Sets warps for your arena.|blockhunt.setwarp|blockhunt.moderator|
|
||||
|`/BlockHunt <remove/delete> <arenaname>`|Deletes an Arena.|blockhunt.remove|blockhunt.admin|
|
||||
|`/BlockHunt <tokens/t> <set/add/take> <playername> <amount>`|Change someones tokens.|blockhunt.tokens|blockhunt.admin|
|
||||
||Able to join full games.|blockhunt.joinfull|blockhunt.moderator|
|
||||
||Able to join/leave using join/leave signs.|blockhunt.joinsign|blockhunt.player|
|
||||
||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|
|
||||
|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
|
||||
players have this permission from default._| |`/BlockHunt <reload/r>`|Reloads all
|
||||
configs.|blockhunt.reload|blockhunt.admin| |`/BlockHunt <join/j> <arenaname>`|Joins a BlockHunt
|
||||
game.|blockhunt.join|blockhunt.player| |`/BlockHunt <leave/l>`|Leave a BlockHunt game.|blockhunt.leave|blockhunt.player|
|
||||
|`/BlockHunt <list/li>`|Shows a list of available arenas.|blockhunt.list|blockhunt.player| |`/BlockHunt <shop/sh>`|Opens
|
||||
the BlockHunt shop.|blockhunt.shop|blockhunt.player| |`/BlockHunt <start/go> <arenaname>`|Forces an arena to
|
||||
start.|blockhunt.start|blockhunt.moderator| |`/BlockHunt <wand/w>`|Gives you the wand selection
|
||||
tool.|blockhunt.create|blockhunt.admin| |`/BlockHunt <create/c> <arenaname>`|Creates an arena from your
|
||||
selection.|blockhunt.create|blockhunt.admin| |`/BlockHunt <set/s> <arenaname>`|Opens a panel to set
|
||||
settings.|blockhunt.set|blockhunt.moderator| |`/BlockHunt <setwarp/sw> <lobby/hiders/seekers/spawn> <arenaname>`|Sets
|
||||
warps for your arena.|blockhunt.setwarp|blockhunt.moderator| |`/BlockHunt <remove/delete> <arenaname>`|Deletes an
|
||||
Arena.|blockhunt.remove|blockhunt.admin| |`/BlockHunt <tokens/t> <set/add/take> <playername> <amount>`|Change someones
|
||||
tokens.|blockhunt.tokens|blockhunt.admin| ||Able to join full games.|blockhunt.joinfull|blockhunt.moderator| ||Able to
|
||||
join/leave using join/leave signs.|blockhunt.joinsign|blockhunt.player| ||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
|
||||
|Permission|Description|
|
||||
|:--|:--|
|
||||
|`blockhunt.*`|All BlockHunt permissions.|
|
||||
|`blockhunt.player`|All player related permissions.|
|
||||
|`blockhunt.moderator`|All moderator related permissions.|
|
||||
|`blockhunt.admin`|All admin related permissions.|
|
||||
|`*`|All permissions on your server, including BlockHunt's permissions.|
|
||||
### Other special permissions
|
||||
|
||||
|Permission|Description| |:--|:--| |`blockhunt.*`|All BlockHunt permissions.| |`blockhunt.player`|All player related
|
||||
permissions.| |`blockhunt.moderator`|All moderator related permissions.| |`blockhunt.admin`|All admin related
|
||||
permissions.| |`*`|All permissions on your server, including BlockHunt's permissions.|
|
||||
|
||||
## How to set-up?
|
||||
|
||||
##How to set-up?
|
||||
Use this video to manage your way through the set-up phase!
|
||||
|
||||
<a href="http://www.youtube.com/watch?feature=player_embedded&v=msPQ1UMiHWg
|
||||
" target="_blank"><img src="http://img.youtube.com/vi/msPQ1UMiHWg/0.jpg"
|
||||
" target="_blank"><img src="http://img.youtube.com/vi/msPQ1UMiHWg/0.jpg"
|
||||
alt="" width="240" height="180" border="10" /></a>
|
||||
|
||||
**Thanks to [Koz4Christ](https://www.youtube.com/user/koz4christ/) for this video!**
|
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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>nl.Steffion</groupId>
|
||||
<artifactId>BlockHunt</artifactId>
|
||||
<version>0.5.0-SNAPSHOT</version>
|
||||
<name>BlockHunt</name>
|
||||
<properties>
|
||||
<plugin.version>${project.version}-${buildnumber}</plugin.version>
|
||||
<buildnumber />
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spigot.api.version>1.18</spigot.api.version>
|
||||
<spigot.version>${spigot.api.version}.1-R0.1-SNAPSHOT</spigot.version>
|
||||
</properties>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:AddstarMC/Blockhunt.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:AddstarMC/Blockhunt.git</developerConnection>
|
||||
<url>https://github.com/AddstarMC/Blockhunt</url>
|
||||
<tag>master</tag>
|
||||
</scm>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven.addstar.com.au</id>
|
||||
<name>maven.addstar.com.au-releases</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/ext-release-local</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>maven.addstar.com.au</id>
|
||||
<name>maven.addstar.com.au-snapshots</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/ext-snapshot-local</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<repositories>
|
||||
<!-- Addstar repo -->
|
||||
<repository>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>addstar-repo</id>
|
||||
<name>all-release</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/all-release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<snapshots />
|
||||
<id>addstar-snapshot-repo</id>
|
||||
<name>all-snapshot</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/all-snapshot</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md_5-releases</id>
|
||||
<url>https://repo.md-5.net/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md_5-snapshots</id>
|
||||
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>${spigot.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- LibsDiguises is required for hiding -->
|
||||
<dependency>
|
||||
<groupId>LibsDisguises</groupId>
|
||||
<artifactId>LibsDisguises</artifactId>
|
||||
<version>10.0.26</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>nl.Steffion</groupId>
|
||||
<artifactId>BlockHunt</artifactId>
|
||||
<version>0.5.0-SNAPSHOT</version>
|
||||
<name>BlockHunt</name>
|
||||
<properties>
|
||||
<plugin.version>${project.version}-${buildnumber}</plugin.version>
|
||||
<buildnumber/>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spigot.api.version>1.18</spigot.api.version>
|
||||
<spigot.version>${spigot.api.version}.1-R0.1-SNAPSHOT</spigot.version>
|
||||
</properties>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:AddstarMC/Blockhunt.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:AddstarMC/Blockhunt.git</developerConnection>
|
||||
<url>https://github.com/AddstarMC/Blockhunt</url>
|
||||
<tag>master</tag>
|
||||
</scm>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven.addstar.com.au</id>
|
||||
<name>maven.addstar.com.au-releases</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/ext-release-local</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>maven.addstar.com.au</id>
|
||||
<name>maven.addstar.com.au-snapshots</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/ext-snapshot-local</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<repositories>
|
||||
<!-- Addstar repo -->
|
||||
<repository>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>addstar-repo</id>
|
||||
<name>all-release</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/all-release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<snapshots/>
|
||||
<id>addstar-snapshot-repo</id>
|
||||
<name>all-snapshot</name>
|
||||
<url>https://maven.addstar.com.au/artifactory/all-snapshot</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md_5-releases</id>
|
||||
<url>https://repo.md-5.net/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md_5-snapshots</id>
|
||||
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>${spigot.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- LibsDiguises is required for hiding -->
|
||||
<dependency>
|
||||
<groupId>LibsDisguises</groupId>
|
||||
<artifactId>LibsDisguises</artifactId>
|
||||
<version>10.0.26</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>src/main/resources/lang</directory>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>src/main/resources/lang</directory>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -1,10 +1,5 @@
|
||||
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.Location;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
@ -13,169 +8,174 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SerializableAs("BlockHuntArena")
|
||||
public class Arena implements ConfigurationSerializable {
|
||||
public String arenaName;
|
||||
public Location pos1;
|
||||
public Location pos2;
|
||||
public int maxPlayers;
|
||||
public int minPlayers;
|
||||
public int amountSeekersOnStart;
|
||||
public int timeInLobbyUntilStart;
|
||||
public int waitingTimeSeeker;
|
||||
public int gameTime;
|
||||
public int timeUntilHidersSword;
|
||||
public int blockAnnouncerTime;
|
||||
public boolean seekersCanHurtSeekers;
|
||||
public boolean hidersCanHurtSeekers;
|
||||
public boolean hidersCanHurtHiders;
|
||||
public boolean seekersTakeFallDamage;
|
||||
public boolean hidersTakeFallDamage;
|
||||
public ArrayList<ItemStack> disguiseBlocks;
|
||||
public Location lobbyWarp;
|
||||
public Location hidersWarp;
|
||||
public Location seekersWarp;
|
||||
public Location spawnWarp;
|
||||
public List<String> seekersWinCommands;
|
||||
public List<String> hidersWinCommands;
|
||||
public List<String> allowedCommands;
|
||||
public int seekersTokenWin;
|
||||
public int hidersTokenWin;
|
||||
public int killTokens;
|
||||
public final String arenaName;
|
||||
public final Location pos1;
|
||||
public final Location pos2;
|
||||
public int maxPlayers;
|
||||
public int minPlayers;
|
||||
public int amountSeekersOnStart;
|
||||
public int timeInLobbyUntilStart;
|
||||
public int waitingTimeSeeker;
|
||||
public int gameTime;
|
||||
public int timeUntilHidersSword;
|
||||
public int blockAnnouncerTime;
|
||||
public final boolean seekersCanHurtSeekers;
|
||||
public final boolean hidersCanHurtSeekers;
|
||||
public final boolean hidersCanHurtHiders;
|
||||
public final boolean seekersTakeFallDamage;
|
||||
public final boolean hidersTakeFallDamage;
|
||||
public ArrayList<ItemStack> disguiseBlocks;
|
||||
public Location lobbyWarp;
|
||||
public Location hidersWarp;
|
||||
public Location seekersWarp;
|
||||
public Location spawnWarp;
|
||||
public final List<String> seekersWinCommands;
|
||||
public final List<String> hidersWinCommands;
|
||||
public final List<String> allowedCommands;
|
||||
public int seekersTokenWin;
|
||||
public int hidersTokenWin;
|
||||
public int killTokens;
|
||||
|
||||
public List<Player> playersInArena;
|
||||
public ArenaState gameState;
|
||||
public int timer;
|
||||
public List<Player> seekers;
|
||||
public Scoreboard scoreboard;
|
||||
public final List<Player> playersInArena;
|
||||
public ArenaState gameState;
|
||||
public int timer;
|
||||
public final List<Player> seekers;
|
||||
public final Scoreboard scoreboard;
|
||||
|
||||
public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime,
|
||||
boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
||||
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<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
||||
this.arenaName = arenaName;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
this.maxPlayers = maxPlayers;
|
||||
this.minPlayers = minPlayers;
|
||||
this.amountSeekersOnStart = amountSeekersOnStart;
|
||||
this.timeInLobbyUntilStart = timeInLobbyUntilStart;
|
||||
this.waitingTimeSeeker = waitingTimeSeeker;
|
||||
this.gameTime = gameTime;
|
||||
this.timeUntilHidersSword = timeUntilHidersSword;
|
||||
this.blockAnnouncerTime = blockAnnouncerTime;
|
||||
this.seekersCanHurtSeekers = seekersCanHurtSeekers;
|
||||
this.hidersCanHurtHiders = hidersCanHurtHiders;
|
||||
this.hidersCanHurtSeekers = hidersCanHurtSeekers;
|
||||
this.seekersTakeFallDamage = seekersTakeFallDamage;
|
||||
this.hidersTakeFallDamage = hidersTakeFallDamage;
|
||||
this.disguiseBlocks = disguiseBlocks;
|
||||
this.lobbyWarp = lobbyWarp;
|
||||
this.hidersWarp = hidersWarp;
|
||||
this.seekersWarp = seekersWarp;
|
||||
this.spawnWarp = spawnWarp;
|
||||
this.seekersWinCommands = seekersWinCommands;
|
||||
this.hidersWinCommands = hidersWinCommands;
|
||||
this.allowedCommands = allowedCommands;
|
||||
this.seekersTokenWin = seekersTokenWin;
|
||||
this.hidersTokenWin = hidersTokenWin;
|
||||
this.killTokens = killTokens;
|
||||
this.playersInArena = playersInArena;
|
||||
this.gameState = gameState;
|
||||
this.timer = timer;
|
||||
this.seekers = seekers;
|
||||
this.scoreboard = scoreboard;
|
||||
}
|
||||
public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime,
|
||||
boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
||||
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<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
||||
this.arenaName = arenaName;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
this.maxPlayers = maxPlayers;
|
||||
this.minPlayers = minPlayers;
|
||||
this.amountSeekersOnStart = amountSeekersOnStart;
|
||||
this.timeInLobbyUntilStart = timeInLobbyUntilStart;
|
||||
this.waitingTimeSeeker = waitingTimeSeeker;
|
||||
this.gameTime = gameTime;
|
||||
this.timeUntilHidersSword = timeUntilHidersSword;
|
||||
this.blockAnnouncerTime = blockAnnouncerTime;
|
||||
this.seekersCanHurtSeekers = seekersCanHurtSeekers;
|
||||
this.hidersCanHurtHiders = hidersCanHurtHiders;
|
||||
this.hidersCanHurtSeekers = hidersCanHurtSeekers;
|
||||
this.seekersTakeFallDamage = seekersTakeFallDamage;
|
||||
this.hidersTakeFallDamage = hidersTakeFallDamage;
|
||||
this.disguiseBlocks = disguiseBlocks;
|
||||
this.lobbyWarp = lobbyWarp;
|
||||
this.hidersWarp = hidersWarp;
|
||||
this.seekersWarp = seekersWarp;
|
||||
this.spawnWarp = spawnWarp;
|
||||
this.seekersWinCommands = seekersWinCommands;
|
||||
this.hidersWinCommands = hidersWinCommands;
|
||||
this.allowedCommands = allowedCommands;
|
||||
this.seekersTokenWin = seekersTokenWin;
|
||||
this.hidersTokenWin = hidersTokenWin;
|
||||
this.killTokens = killTokens;
|
||||
this.playersInArena = playersInArena;
|
||||
this.gameState = gameState;
|
||||
this.timer = timer;
|
||||
this.seekers = seekers;
|
||||
this.scoreboard = scoreboard;
|
||||
}
|
||||
|
||||
public enum ArenaType {
|
||||
maxPlayers,
|
||||
minPlayers,
|
||||
amountSeekersOnStart,
|
||||
timeInLobbyUntilStart,
|
||||
waitingTimeSeeker,
|
||||
gameTime,
|
||||
timeUntilHidersSword,
|
||||
hidersTokenWin,
|
||||
seekersTokenWin,
|
||||
killTokens,
|
||||
blockAnnouncerTime
|
||||
}
|
||||
public enum ArenaType {
|
||||
maxPlayers,
|
||||
minPlayers,
|
||||
amountSeekersOnStart,
|
||||
timeInLobbyUntilStart,
|
||||
waitingTimeSeeker,
|
||||
gameTime,
|
||||
timeUntilHidersSword,
|
||||
hidersTokenWin,
|
||||
seekersTokenWin,
|
||||
killTokens,
|
||||
blockAnnouncerTime
|
||||
}
|
||||
|
||||
public enum ArenaState {
|
||||
WAITING,
|
||||
STARTING,
|
||||
INGAME,
|
||||
RESTARTING,
|
||||
DISABLED
|
||||
}
|
||||
public enum ArenaState {
|
||||
WAITING,
|
||||
STARTING,
|
||||
INGAME,
|
||||
RESTARTING,
|
||||
DISABLED
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("arenaName", arenaName);
|
||||
map.put("pos1", pos1);
|
||||
map.put("pos2", pos2);
|
||||
map.put("maxPlayers", maxPlayers);
|
||||
map.put("minPlayers", minPlayers);
|
||||
map.put("amountSeekersOnStart", amountSeekersOnStart);
|
||||
map.put("timeInLobbyUntilStart", timeInLobbyUntilStart);
|
||||
map.put("waitingTimeSeeker", waitingTimeSeeker);
|
||||
map.put("gameTime", gameTime);
|
||||
map.put("timeUntilHidersSword", timeUntilHidersSword);
|
||||
map.put("blockAnnouncerTime", blockAnnouncerTime);
|
||||
map.put("seekersCanHurtSeekers", seekersCanHurtSeekers);
|
||||
map.put("hidersCanHurtSeekers", hidersCanHurtSeekers);
|
||||
map.put("hidersCanHurtHiders", hidersCanHurtHiders);
|
||||
map.put("seekersTakeFallDamage", seekersTakeFallDamage);
|
||||
map.put("hidersTakeFallDamage", hidersTakeFallDamage);
|
||||
map.put("disguiseBlocks", disguiseBlocks);
|
||||
map.put("lobbyWarp", lobbyWarp);
|
||||
map.put("hidersWarp", hidersWarp);
|
||||
map.put("seekersWarp", seekersWarp);
|
||||
map.put("spawnWarp", spawnWarp);
|
||||
map.put("seekersWinCommands", seekersWinCommands);
|
||||
map.put("hidersWinCommands", hidersWinCommands);
|
||||
map.put("allowedCommands", allowedCommands);
|
||||
map.put("seekersTokenWin", seekersTokenWin);
|
||||
map.put("hidersTokenWin", hidersTokenWin);
|
||||
map.put("killTokens", killTokens);
|
||||
return map;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("arenaName", arenaName);
|
||||
map.put("pos1", pos1);
|
||||
map.put("pos2", pos2);
|
||||
map.put("maxPlayers", maxPlayers);
|
||||
map.put("minPlayers", minPlayers);
|
||||
map.put("amountSeekersOnStart", amountSeekersOnStart);
|
||||
map.put("timeInLobbyUntilStart", timeInLobbyUntilStart);
|
||||
map.put("waitingTimeSeeker", waitingTimeSeeker);
|
||||
map.put("gameTime", gameTime);
|
||||
map.put("timeUntilHidersSword", timeUntilHidersSword);
|
||||
map.put("blockAnnouncerTime", blockAnnouncerTime);
|
||||
map.put("seekersCanHurtSeekers", seekersCanHurtSeekers);
|
||||
map.put("hidersCanHurtSeekers", hidersCanHurtSeekers);
|
||||
map.put("hidersCanHurtHiders", hidersCanHurtHiders);
|
||||
map.put("seekersTakeFallDamage", seekersTakeFallDamage);
|
||||
map.put("hidersTakeFallDamage", hidersTakeFallDamage);
|
||||
map.put("disguiseBlocks", disguiseBlocks);
|
||||
map.put("lobbyWarp", lobbyWarp);
|
||||
map.put("hidersWarp", hidersWarp);
|
||||
map.put("seekersWarp", seekersWarp);
|
||||
map.put("spawnWarp", spawnWarp);
|
||||
map.put("seekersWinCommands", seekersWinCommands);
|
||||
map.put("hidersWinCommands", hidersWinCommands);
|
||||
map.put("allowedCommands", allowedCommands);
|
||||
map.put("seekersTokenWin", seekersTokenWin);
|
||||
map.put("hidersTokenWin", hidersTokenWin);
|
||||
map.put("killTokens", killTokens);
|
||||
return map;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Arena deserialize(Map<String, Object> map) {
|
||||
Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0);
|
||||
return new Arena(
|
||||
(String) map.getOrDefault("arenaName", "UNKNOWN_NAME"),
|
||||
(Location) map.getOrDefault("pos1", loc),
|
||||
(Location) map.getOrDefault("pos2", loc),
|
||||
(Integer) map.getOrDefault("maxPlayers", 12),
|
||||
(Integer) map.getOrDefault("minPlayers", 3),
|
||||
(Integer) map.getOrDefault("amountSeekersOnStart", 1),
|
||||
(Integer) map.getOrDefault("timeInLobbyUntilStart", 90),
|
||||
(Integer) map.getOrDefault("waitingTimeSeeker", 20),
|
||||
(Integer) map.getOrDefault("gameTime", 200),
|
||||
(Integer) map.getOrDefault("timeUntilHidersSword", 30),
|
||||
(Integer) map.getOrDefault("blockAnnouncerTime", 45),
|
||||
(Boolean) map.getOrDefault("seekersCanHurtSeekers", false),
|
||||
(Boolean) map.getOrDefault("hidersCanHurtSeekers", true),
|
||||
(Boolean) map.getOrDefault("hidersCanHurtHiders", false),
|
||||
(Boolean) map.getOrDefault("seekersTakeFallDamage", false),
|
||||
(Boolean) map.getOrDefault("hidersTakeFallDamage", false),
|
||||
(ArrayList<ItemStack>) map.getOrDefault("disguiseBlocks", new ArrayList<ItemStack>()),
|
||||
(Location) map.getOrDefault("lobbyWarp", loc),
|
||||
(Location) map.getOrDefault("hidersWarp", loc),
|
||||
(Location) map.getOrDefault("seekersWarp", loc),
|
||||
(Location) map.getOrDefault("spawnWarp", loc),
|
||||
(ArrayList<String>) map.getOrDefault("seekersWinCommands", new ArrayList<String>()),
|
||||
(ArrayList<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()),
|
||||
(ArrayList<String>) map.getOrDefault("allowedCommands", new ArrayList<String>()),
|
||||
(Integer) map.getOrDefault("seekersTokenWin", 10),
|
||||
(Integer) map.getOrDefault("hidersTokenWin", 50),
|
||||
(Integer) map.getOrDefault("killTokens", 8),
|
||||
new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard()
|
||||
);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Arena deserialize(Map<String, Object> map) {
|
||||
Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0);
|
||||
return new Arena(
|
||||
(String) map.getOrDefault("arenaName", "UNKNOWN_NAME"),
|
||||
(Location) map.getOrDefault("pos1", loc),
|
||||
(Location) map.getOrDefault("pos2", loc),
|
||||
(Integer) map.getOrDefault("maxPlayers", 12),
|
||||
(Integer) map.getOrDefault("minPlayers", 3),
|
||||
(Integer) map.getOrDefault("amountSeekersOnStart", 1),
|
||||
(Integer) map.getOrDefault("timeInLobbyUntilStart", 90),
|
||||
(Integer) map.getOrDefault("waitingTimeSeeker", 20),
|
||||
(Integer) map.getOrDefault("gameTime", 200),
|
||||
(Integer) map.getOrDefault("timeUntilHidersSword", 30),
|
||||
(Integer) map.getOrDefault("blockAnnouncerTime", 45),
|
||||
(Boolean) map.getOrDefault("seekersCanHurtSeekers", false),
|
||||
(Boolean) map.getOrDefault("hidersCanHurtSeekers", true),
|
||||
(Boolean) map.getOrDefault("hidersCanHurtHiders", false),
|
||||
(Boolean) map.getOrDefault("seekersTakeFallDamage", false),
|
||||
(Boolean) map.getOrDefault("hidersTakeFallDamage", false),
|
||||
(ArrayList<ItemStack>) map.getOrDefault("disguiseBlocks", new ArrayList<ItemStack>()),
|
||||
(Location) map.getOrDefault("lobbyWarp", loc),
|
||||
(Location) map.getOrDefault("hidersWarp", loc),
|
||||
(Location) map.getOrDefault("seekersWarp", loc),
|
||||
(Location) map.getOrDefault("spawnWarp", loc),
|
||||
(ArrayList<String>) map.getOrDefault("seekersWinCommands", new ArrayList<String>()),
|
||||
(ArrayList<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()),
|
||||
(ArrayList<String>) map.getOrDefault("allowedCommands", new ArrayList<String>()),
|
||||
(Integer) map.getOrDefault("seekersTokenWin", 10),
|
||||
(Integer) map.getOrDefault("hidersTokenWin", 50),
|
||||
(Integer) map.getOrDefault("killTokens", 8),
|
||||
new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard()
|
||||
);
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Events.EndArenaEvent;
|
||||
import nl.Steffion.BlockHunt.Events.JoinArenaEvent;
|
||||
import nl.Steffion.BlockHunt.Events.LeaveArenaEvent;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
|
||||
import org.bukkit.*;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
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.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -20,435 +20,442 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ArenaHandler {
|
||||
public static void loadArenas() {
|
||||
MemoryStorage.arenaList.clear();
|
||||
for (String arenaName : MemoryStorage.arenas.getFile().getKeys(false)) {
|
||||
MemoryStorage.arenaList.add((Arena) MemoryStorage.arenas.getFile().get(arenaName));
|
||||
}
|
||||
public static void loadArenas() {
|
||||
MemoryStorage.arenaList.clear();
|
||||
for (String arenaName : MemoryStorage.arenas.getFile().getKeys(false)) {
|
||||
MemoryStorage.arenaList.add((Arena) MemoryStorage.arenas.getFile().get(arenaName));
|
||||
}
|
||||
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
ScoreboardHandler.createScoreboard(arena);
|
||||
}
|
||||
}
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
ScoreboardHandler.createScoreboard(arena);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendMessage(Arena arena, String message, String... vars) {
|
||||
for (Player player : arena.playersInArena) {
|
||||
String pMessage = message.replaceAll("%player%", player.getDisplayName());
|
||||
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
||||
}
|
||||
}
|
||||
public static void sendMessage(Arena arena, String message, String... vars) {
|
||||
for (Player player : arena.playersInArena) {
|
||||
String pMessage = message.replaceAll("%player%", player.getDisplayName());
|
||||
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendFMessage(Arena arena, ConfigC location, String... vars) {
|
||||
for (Player player : arena.playersInArena) {
|
||||
String pMessage = location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName());
|
||||
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
||||
}
|
||||
}
|
||||
public static void sendFMessage(Arena arena, ConfigC location, String... vars) {
|
||||
for (Player player : arena.playersInArena) {
|
||||
String pMessage = location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName());
|
||||
player.sendMessage(MessageManager.replaceAll(pMessage, vars));
|
||||
}
|
||||
}
|
||||
|
||||
public static void playerJoinArena(Player player, String arenaname) {
|
||||
boolean found = false;
|
||||
boolean alreadyJoined = false;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena != null) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
alreadyJoined = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void playerJoinArena(Player player, String arenaname) {
|
||||
boolean found = false;
|
||||
boolean alreadyJoined = false;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena != null) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
alreadyJoined = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!alreadyJoined) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
found = true;
|
||||
if (arena.disguiseBlocks.isEmpty()) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinNoBlocksSet);
|
||||
} else {
|
||||
boolean inventoryempty = true;
|
||||
for (ItemStack invitem : player.getInventory()) {
|
||||
if (invitem != null) {
|
||||
if (invitem.getType() != Material.AIR) {
|
||||
inventoryempty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!alreadyJoined) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
found = true;
|
||||
if (arena.disguiseBlocks.isEmpty()) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinNoBlocksSet);
|
||||
} else {
|
||||
boolean inventoryempty = true;
|
||||
for (ItemStack invitem : player.getInventory()) {
|
||||
if (invitem != null) {
|
||||
if (invitem.getType() != Material.AIR) {
|
||||
inventoryempty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack invitem : player.getInventory().getArmorContents()) {
|
||||
if (invitem != null) {
|
||||
if (invitem.getType() != Material.AIR) {
|
||||
inventoryempty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack invitem : player.getInventory().getArmorContents()) {
|
||||
if (invitem != null) {
|
||||
if (invitem.getType() != Material.AIR) {
|
||||
inventoryempty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.requireInventoryClearOnJoin) && !inventoryempty) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty);
|
||||
return;
|
||||
}
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.requireInventoryClearOnJoin) && !inventoryempty) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty);
|
||||
return;
|
||||
}
|
||||
|
||||
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.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.playersInArena.size() >= arena.maxPlayers) {
|
||||
if (!PermissionsManager.hasPerm(player, Permissions.joinfull, false)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinFull);
|
||||
return;
|
||||
}
|
||||
}
|
||||
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.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.playersInArena.size() >= arena.maxPlayers) {
|
||||
if (!PermissionsManager.hasPerm(player, Permissions.joinfull, false)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinFull);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean canWarp = PlayerHandler.teleport(player, arena.lobbyWarp);
|
||||
if (!canWarp) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_teleportFailed);
|
||||
return;
|
||||
}
|
||||
boolean canWarp = PlayerHandler.teleport(player, arena.lobbyWarp);
|
||||
if (!canWarp) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_teleportFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("[BlockHunt] " + player.getName() + " has joined " + arenaname);
|
||||
arena.playersInArena.add(player);
|
||||
JoinArenaEvent event = new JoinArenaEvent(player, arena);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
System.out.println("[BlockHunt] " + player.getName() + " has joined " + arenaname);
|
||||
arena.playersInArena.add(player);
|
||||
JoinArenaEvent event = new JoinArenaEvent(player, arena);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
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(),
|
||||
player.getActivePotionEffects(), player.getAllowFlight());
|
||||
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(),
|
||||
player.getActivePotionEffects(), player.getAllowFlight());
|
||||
|
||||
MemoryStorage.pData.put(player, pad);
|
||||
MemoryStorage.pData.put(player, pad);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
for (PotionEffect pe : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(pe.getType());
|
||||
}
|
||||
player.setFoodLevel(20);
|
||||
player.setHealth(20);
|
||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||
player.setLevel(arena.timer);
|
||||
player.setExp(0);
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.AIR));
|
||||
player.getInventory().setBoots(new ItemStack(Material.AIR));
|
||||
player.setFlying(false);
|
||||
player.setAllowFlight(false);
|
||||
player.setWalkSpeed(0.2F);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
for (PotionEffect pe : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(pe.getType());
|
||||
}
|
||||
player.setFoodLevel(20);
|
||||
player.setHealth(20);
|
||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||
player.setLevel(arena.timer);
|
||||
player.setExp(0);
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.AIR));
|
||||
player.getInventory().setBoots(new ItemStack(Material.AIR));
|
||||
player.setFlying(false);
|
||||
player.setAllowFlight(false);
|
||||
player.setWalkSpeed(0.2F);
|
||||
|
||||
// Fix for client not showing players after
|
||||
// they join
|
||||
for (Player otherplayer : arena.playersInArena) {
|
||||
if (otherplayer.canSee(player))
|
||||
// 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
|
||||
// visible
|
||||
// to
|
||||
// others
|
||||
if (player.canSee(otherplayer))
|
||||
}
|
||||
// new
|
||||
// player
|
||||
// visible
|
||||
// to
|
||||
// others
|
||||
if (player.canSee(otherplayer)) {
|
||||
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 (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") != 0) {
|
||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)),
|
||||
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));
|
||||
}
|
||||
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);
|
||||
|
||||
shopBlockHuntPass_IM.setLore(lores2);
|
||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||
shopBlockHuntPass.setAmount(MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass"));
|
||||
player.getInventory().addItem(shopBlockChooser);
|
||||
}
|
||||
}
|
||||
|
||||
player.getInventory().addItem(shopBlockHuntPass);
|
||||
}
|
||||
}
|
||||
player.updateInventory();
|
||||
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)),
|
||||
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(),
|
||||
"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;
|
||||
}
|
||||
player.getInventory().addItem(shopBlockHuntPass);
|
||||
}
|
||||
}
|
||||
player.updateInventory();
|
||||
|
||||
if (!found) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
||||
}
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
|
||||
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;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.playersInArena != null) {
|
||||
if (arena2.playersInArena.contains(player)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
}
|
||||
SignsHandler.updateSigns();
|
||||
}
|
||||
|
||||
if (arena != null) {
|
||||
System.out.println("[BlockHunt] " + player.getName() + " has left " + arena.arenaName);
|
||||
LeaveArenaEvent event = new LeaveArenaEvent(player, arena);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
public static void playerLeaveArena(Player player, boolean message, boolean cleanup) {
|
||||
|
||||
if (cleanup) {
|
||||
arena.playersInArena.remove(player);
|
||||
if (arena.seekers.contains(player)) {
|
||||
arena.seekers.remove(player);
|
||||
}
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.playersInArena != null) {
|
||||
if (arena2.playersInArena.contains(player)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (arena.playersInArena.size() < arena.minPlayers && arena.gameState.equals(ArenaState.STARTING)) {
|
||||
arena.gameState = ArenaState.WAITING;
|
||||
arena.timer = 0;
|
||||
if (arena != null) {
|
||||
System.out.println("[BlockHunt] " + player.getName() + " has left " + arena.arenaName);
|
||||
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.seekers.size() >= arena.playersInArena.size()) {
|
||||
ArenaHandler.seekersWin(arena);
|
||||
} else {
|
||||
ArenaHandler.hidersWin(arena);
|
||||
}
|
||||
}
|
||||
if (arena.playersInArena.size() < arena.minPlayers && arena.gameState.equals(ArenaState.STARTING)) {
|
||||
arena.gameState = ArenaState.WAITING;
|
||||
arena.timer = 0;
|
||||
|
||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||
ArenaHandler.seekersWin(arena);
|
||||
}
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
||||
}
|
||||
|
||||
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);
|
||||
if (arena.playersInArena.size() <= 1 && arena.gameState == ArenaState.INGAME) {
|
||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||
ArenaHandler.seekersWin(arena);
|
||||
} else {
|
||||
ArenaHandler.hidersWin(arena);
|
||||
}
|
||||
}
|
||||
|
||||
// Fix for client not showing players after they join
|
||||
for (Player otherplayer : arena.playersInArena) {
|
||||
if (otherplayer.canSee(player))
|
||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||
ArenaHandler.seekersWin(arena);
|
||||
}
|
||||
|
||||
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
|
||||
// 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);
|
||||
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;
|
||||
}
|
||||
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);
|
||||
|
||||
SignsHandler.updateSigns();
|
||||
}
|
||||
MemoryStorage.pData.remove(player);
|
||||
MemoryStorage.choosenBlock.remove(player);
|
||||
|
||||
public static void seekersWin(Arena arena) {
|
||||
String cause = "[BlockHunt] Seekers have won " + arena.arenaName;
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Player> winners = new ArrayList<>();
|
||||
List<Player> losers = new ArrayList<>();
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
}
|
||||
|
||||
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) {
|
||||
for (String command : arena.seekersWinCommands) {
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
||||
}
|
||||
public static void seekersWin(Arena arena) {
|
||||
String cause = "[BlockHunt] Seekers have won " + arena.arenaName;
|
||||
|
||||
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();
|
||||
List<Player> winners = new ArrayList<>();
|
||||
List<Player> losers = new ArrayList<>();
|
||||
|
||||
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 {
|
||||
losers.add(player);
|
||||
}
|
||||
}
|
||||
losers.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
stopArena(arena, cause, ConfigC.normal_winSeekers);
|
||||
}
|
||||
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
stopArena(arena, cause, ConfigC.normal_winSeekers);
|
||||
}
|
||||
|
||||
public static void hidersWin(Arena arena) {
|
||||
String cause = "[BlockHunt] Hiders have won " + arena.arenaName;
|
||||
public static void hidersWin(Arena arena) {
|
||||
String cause = "[BlockHunt] Hiders have won " + arena.arenaName;
|
||||
|
||||
List<Player> winners = new ArrayList<>();
|
||||
List<Player> losers = new ArrayList<>();
|
||||
List<Player> winners = new ArrayList<>();
|
||||
List<Player> losers = new ArrayList<>();
|
||||
|
||||
for (Player player : arena.playersInArena) {
|
||||
for (Player player : arena.playersInArena) {
|
||||
|
||||
if (arena.seekers.contains(player)) {
|
||||
losers.add(player);
|
||||
} else {
|
||||
if (arena.seekers.contains(player)) {
|
||||
losers.add(player);
|
||||
} else {
|
||||
|
||||
winners.add(player);
|
||||
winners.add(player);
|
||||
|
||||
if (arena.hidersWinCommands != null) {
|
||||
for (String command : arena.hidersWinCommands) {
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
||||
}
|
||||
if (arena.hidersWinCommands != null) {
|
||||
for (String command : arena.hidersWinCommands) {
|
||||
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.hidersTokenWin);
|
||||
MemoryStorage.shop.save();
|
||||
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.hidersTokenWin);
|
||||
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);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
stopArena(arena, cause, ConfigC.normal_winHiders);
|
||||
}
|
||||
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
stopArena(arena, cause, ConfigC.normal_winHiders);
|
||||
}
|
||||
|
||||
public static void stopArena(Arena arena,String cause, ConfigC message) {
|
||||
System.out.println(cause);
|
||||
ArenaHandler.sendFMessage(arena, message);
|
||||
arena.seekers.clear();
|
||||
public static void stopArena(Arena arena, String cause, ConfigC message) {
|
||||
System.out.println(cause);
|
||||
ArenaHandler.sendFMessage(arena, message);
|
||||
arena.seekers.clear();
|
||||
|
||||
for (Player player : arena.playersInArena) {
|
||||
playerLeaveArena(player, false, false);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
||||
}
|
||||
for (Player player : arena.playersInArena) {
|
||||
playerLeaveArena(player, false, false);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
||||
}
|
||||
|
||||
arena.gameState = ArenaState.WAITING;
|
||||
arena.timer = 0;
|
||||
arena.playersInArena.clear();
|
||||
}
|
||||
arena.gameState = ArenaState.WAITING;
|
||||
arena.timer = 0;
|
||||
arena.playersInArena.clear();
|
||||
}
|
||||
|
||||
public static boolean noPlayersInArenas() {
|
||||
// Check if there are any players in any arena (quick way to early exit for event handlers)
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static boolean noPlayersInArenas() {
|
||||
// Check if there are any players in any arena (quick way to early exit for event handlers)
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,10 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Listeners.*;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDTokens;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDcreate;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDhelp;
|
||||
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.CMDshop;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDstart;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDtokens;
|
||||
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.ConfigManager;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -48,139 +57,138 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockHunt extends JavaPlugin implements Listener {
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
public static PluginDescriptionFile pdfFile;
|
||||
public static BlockHunt plugin;
|
||||
public static PluginDescriptionFile pdfFile;
|
||||
public static BlockHunt plugin;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static List<String> BlockHuntCMD = new ArrayList<String>() {
|
||||
{
|
||||
add("info");
|
||||
add("help");
|
||||
add("reload");
|
||||
add("join");
|
||||
add("leave");
|
||||
add("list");
|
||||
add("shop");
|
||||
add("start");
|
||||
add("wand");
|
||||
add("create");
|
||||
add("set");
|
||||
add("setwarp");
|
||||
add("remove");
|
||||
add("tokens");
|
||||
}
|
||||
};
|
||||
@SuppressWarnings("serial")
|
||||
public static final List<String> BlockHuntCMD = new ArrayList<String>() {
|
||||
{
|
||||
add("info");
|
||||
add("help");
|
||||
add("reload");
|
||||
add("join");
|
||||
add("leave");
|
||||
add("list");
|
||||
add("shop");
|
||||
add("start");
|
||||
add("wand");
|
||||
add("create");
|
||||
add("set");
|
||||
add("setwarp");
|
||||
add("remove");
|
||||
add("tokens");
|
||||
}
|
||||
};
|
||||
|
||||
public static CommandManager CMD;
|
||||
public static CommandManager CMDinfo;
|
||||
public static CommandManager CMDhelp;
|
||||
public static CommandManager CMDreload;
|
||||
public static CommandManager CMDjoin;
|
||||
public static CommandManager CMDleave;
|
||||
public static CommandManager CMDlist;
|
||||
public static CommandManager CMDshop;
|
||||
public static CommandManager CMDstart;
|
||||
public static CommandManager CMDwand;
|
||||
public static CommandManager CMDcreate;
|
||||
public static CommandManager CMDset;
|
||||
public static CommandManager CMDsetwarp;
|
||||
public static CommandManager CMDremove;
|
||||
public static CommandManager CMDtokens;
|
||||
public static CommandManager CMD;
|
||||
public static CommandManager CMDinfo;
|
||||
public static CommandManager CMDhelp;
|
||||
public static CommandManager CMDreload;
|
||||
public static CommandManager CMDjoin;
|
||||
public static CommandManager CMDleave;
|
||||
public static CommandManager CMDlist;
|
||||
public static CommandManager CMDshop;
|
||||
public static CommandManager CMDstart;
|
||||
public static CommandManager CMDwand;
|
||||
public static CommandManager CMDcreate;
|
||||
public static CommandManager CMDset;
|
||||
public static CommandManager CMDsetwarp;
|
||||
public static CommandManager CMDremove;
|
||||
public static CommandManager CMDtokens;
|
||||
|
||||
public void onEnable() {
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
public void onEnable() {
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
|
||||
getServer().getPluginManager().registerEvents(new OnBlockBreakEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnBlockPlaceEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnEntityDamageByEntityEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnEntityDamageEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnFoodLevelChangeEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnInventoryClickEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnInventoryCloseEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnPlayerSwapHandItemsEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnBlockBreakEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnBlockPlaceEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnEntityDamageByEntityEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnEntityDamageEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnFoodLevelChangeEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnInventoryClickEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnInventoryCloseEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnPlayerSwapHandItemsEvent(), this);
|
||||
|
||||
// Removed - This is handled by WorldGuard now.
|
||||
// getServer().getPluginManager().registerEvents(
|
||||
// new OnPlayerCommandPreprocessEvent(), this);
|
||||
getServer().getPluginManager().registerEvents(new OnPlayerDropItemEvent(), this);
|
||||
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);
|
||||
|
||||
getServer().getPluginManager().registerEvents(new OnPlayerDropItemEvent(), this);
|
||||
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");
|
||||
|
||||
ConfigurationSerialization.registerClass(Arena.class, "BlockHuntArena");
|
||||
pdfFile = getDescription();
|
||||
plugin = this;
|
||||
|
||||
pdfFile = getDescription();
|
||||
plugin = this;
|
||||
ConfigManager.newFiles();
|
||||
|
||||
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,
|
||||
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>");
|
||||
|
||||
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
|
||||
MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
|
||||
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
|
||||
MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
|
||||
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||
MessageManager.broadcastFMessage(ConfigC.error_protocolLibNotInstalled);
|
||||
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||
MessageManager.broadcastFMessage(ConfigC.error_protocolLibNotInstalled);
|
||||
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ArenaHandler.loadArenas();
|
||||
ArenaHandler.loadArenas();
|
||||
|
||||
MessageManager.sendFMessage(null, ConfigC.log_enabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
||||
+ BlockHunt.pdfFile.getAuthors().get(0));
|
||||
MessageManager.sendFMessage(null, ConfigC.log_enabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
||||
+ BlockHunt.pdfFile.getAuthors().get(0));
|
||||
|
||||
// Welcome to the massive game loop!!
|
||||
getServer().getScheduler().runTaskTimer(this, () -> {
|
||||
// Welcome to the massive game loop!!
|
||||
getServer().getScheduler().runTaskTimer(this, () -> {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.gameState == ArenaState.WAITING) {
|
||||
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)
|
||||
}, 0, 20);
|
||||
}
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||
}
|
||||
public void onDisable() {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||
}
|
||||
|
||||
MessageManager.sendFMessage(null, ConfigC.log_disabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
||||
+ BlockHunt.pdfFile.getAuthors().get(0));
|
||||
}
|
||||
MessageManager.sendFMessage(null, ConfigC.log_disabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-"
|
||||
+ BlockHunt.pdfFile.getAuthors().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Args to String. Makes 1 string.
|
||||
*
|
||||
* @param input
|
||||
* String list which should be converted to a string.
|
||||
* @param startArg
|
||||
* Start on this length.
|
||||
*
|
||||
* @return The converted string.
|
||||
*/
|
||||
public static String stringBuilder(String[] input, int startArg) {
|
||||
if (input.length - startArg <= 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(input[startArg]);
|
||||
for (int i = ++startArg; i < input.length; i++) {
|
||||
sb.append(' ').append(input[i]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
/**
|
||||
* Args to String. Makes 1 string.
|
||||
*
|
||||
* @param input String list which should be converted to a string.
|
||||
* @param startArg Start on this length.
|
||||
* @return The converted string.
|
||||
*/
|
||||
public static String stringBuilder(String[] input, int startArg) {
|
||||
if (input.length - startArg <= 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(input[startArg]);
|
||||
for (int i = ++startArg; i < input.length; i++) {
|
||||
sb.append(' ').append(input[i]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
String[] argsSplit = null;
|
||||
String[] argsSplitAlias = null;
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
String[] argsSplit = null;
|
||||
String[] argsSplitAlias = null;
|
||||
|
||||
if (command.args != null && command.argsalias != null) {
|
||||
argsSplit = command.args.split("/");
|
||||
argsSplitAlias = command.argsalias.split("/");
|
||||
}
|
||||
if (command.args != null && command.argsalias != null) {
|
||||
argsSplit = command.args.split("/");
|
||||
argsSplitAlias = command.argsalias.split("/");
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
||||
boolean equals = true;
|
||||
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
||||
boolean equals = true;
|
||||
|
||||
if (argsSplit == null) {
|
||||
equals = args.length == 0;
|
||||
} else {
|
||||
if (args.length >= argsSplit.length) {
|
||||
for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) {
|
||||
int loc = argsSplit.length - i2 - 1;
|
||||
if (!argsSplit[loc].equalsIgnoreCase(args[loc]) && !argsSplitAlias[loc].equalsIgnoreCase(args[loc])) {
|
||||
equals = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
equals = false;
|
||||
}
|
||||
}
|
||||
if (argsSplit == null) {
|
||||
equals = args.length == 0;
|
||||
} else {
|
||||
if (args.length >= argsSplit.length) {
|
||||
for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) {
|
||||
int loc = argsSplit.length - i2 - 1;
|
||||
if (!argsSplit[loc].equalsIgnoreCase(args[loc]) && !argsSplitAlias[loc].equalsIgnoreCase(args[loc])) {
|
||||
equals = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
equals = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (equals) {
|
||||
if (PermissionsManager.hasPerm(player, command.permission, true)) {
|
||||
if (command.enabled) {
|
||||
command.CMD.execute(player, cmd, label, args);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotEnabled);
|
||||
}
|
||||
}
|
||||
if (equals) {
|
||||
if (PermissionsManager.hasPerm(player, command.permission, true)) {
|
||||
if (command.enabled) {
|
||||
return command.CMD.execute(player, cmd, label, args);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
new CMDnotfound().execute(player,cmd,label, args);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
new CMDnotfound().execute(player, cmd, label, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
||||
if (args.length == 1) {
|
||||
return command.mainTABlist;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
||||
if (args.length == 1) {
|
||||
return command.mainTABlist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Short a String for like the Scoreboard title.
|
||||
*
|
||||
* @param string
|
||||
* String to be shorten.
|
||||
* @param maxLenght
|
||||
* Max lenght of the characters.
|
||||
* @return Shorten string, else normal string.
|
||||
*/
|
||||
public static String cutString(String string, int maxLenght) {
|
||||
if (string.length() > maxLenght) {
|
||||
string = string.substring(0, maxLenght);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
/**
|
||||
* Short a String for like the Scoreboard title.
|
||||
*
|
||||
* @param string String to be shorten.
|
||||
* @param maxLenght Max lenght of the characters.
|
||||
* @return Shorten string, else normal string.
|
||||
*/
|
||||
public static String cutString(String string, int maxLenght) {
|
||||
if (string.length() > maxLenght) {
|
||||
string = string.substring(0, maxLenght);
|
||||
}
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import nl.Steffion.BlockHunt.*;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
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.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.ScoreboardHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CMDcreate extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage);
|
||||
} else {
|
||||
if (MemoryStorage.pos1.get(player) != null && MemoryStorage.pos2.get(player) != null) {
|
||||
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,
|
||||
null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
|
||||
0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
MemoryStorage.arenas.getFile().set(args[1], arena);
|
||||
MemoryStorage.arenas.save();
|
||||
MemoryStorage.signs.load();
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage);
|
||||
} else {
|
||||
if (MemoryStorage.pos1.get(player) != null && MemoryStorage.pos2.get(player) != null) {
|
||||
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,
|
||||
null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
|
||||
0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
MemoryStorage.arenas.getFile().set(args[1], arena);
|
||||
MemoryStorage.arenas.save();
|
||||
MemoryStorage.signs.load();
|
||||
|
||||
MemoryStorage.arenaList.add(arena);
|
||||
ScoreboardHandler.createScoreboard(arena);
|
||||
MemoryStorage.arenaList.add(arena);
|
||||
ScoreboardHandler.createScoreboard(arena);
|
||||
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_createNotSameWorld);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_createSelectionFirst);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_createNotSameWorld);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_createSelectionFirst);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,91 +1,88 @@
|
||||
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.ConfigC;
|
||||
|
||||
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.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDhelp extends DefaultCMD {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
int amountCommands = 0;
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (command.usage != null) {
|
||||
amountCommands = amountCommands + 1;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
int amountCommands = 0;
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (command.usage != null) {
|
||||
amountCommands = amountCommands + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int maxPages = Math.round(amountCommands / 3);
|
||||
if (maxPages <= 0) {
|
||||
maxPages = 1;
|
||||
}
|
||||
int maxPages = (int) Math.round(amountCommands / 3.0);
|
||||
if (maxPages <= 0) {
|
||||
maxPages = 1;
|
||||
}
|
||||
|
||||
if (args.length == 1) {
|
||||
int page = 1;
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
||||
int i = 1;
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (i <= 4) {
|
||||
if (command.usage != null) {
|
||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
} else {
|
||||
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
}
|
||||
i = i + 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);
|
||||
int i = 1;
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (i <= 4) {
|
||||
if (command.usage != null) {
|
||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
} else {
|
||||
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page");
|
||||
} else {
|
||||
int page = 1;
|
||||
try {
|
||||
page = Integer.valueOf(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
page = 1;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
page = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
|
||||
if (maxPages < page) {
|
||||
maxPages = page;
|
||||
}
|
||||
if (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;
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (i <= (page * 4) + 4) {
|
||||
if (command.usage != null) {
|
||||
if (i >= ((page - 1) * 4) + 1 && i <= ((page - 1) * 4) + 4) {
|
||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
} else {
|
||||
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
}
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
int i = 1;
|
||||
for (CommandManager command : MemoryStorage.commands) {
|
||||
if (i <= (page * 4) + 4) {
|
||||
if (command.usage != null) {
|
||||
if (i >= ((page - 1) * 4) + 1 && i <= ((page - 1) * 4) + 4) {
|
||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
} else {
|
||||
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||
}
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,35 @@
|
||||
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 org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDinfo extends DefaultCMD {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
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, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion());
|
||||
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, "%NDonations are welcome!");
|
||||
MessageManager.sendMessage(player, "%NMade by help from some friends &c<3%N!");
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oInfo Page");
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
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, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion());
|
||||
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, "%NDonations are welcome!");
|
||||
MessageManager.sendMessage(player, "%NMade by help from some friends &c<3%N!");
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oInfo Page");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4,23 +4,22 @@ import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDjoin extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage);
|
||||
} else {
|
||||
ArenaHandler.playerJoinArena(player, args[1]);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage);
|
||||
} else {
|
||||
ArenaHandler.playerJoinArena(player, args[1]);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,19 +3,18 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDleave extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
ArenaHandler.playerLeaveArena(player, true, true);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
ArenaHandler.playerLeaveArena(player, true, true);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,27 +3,26 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDlist extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
||||
if (MemoryStorage.arenaList.size() >= 1) {
|
||||
MessageManager.sendMessage(player, "&7Available arena(s):");
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
MessageManager.sendMessage(player, "%A" + arena.arenaName);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendMessage(player, "&7&oNo arenas available...");
|
||||
MessageManager.sendMessage(player, "&7&oCreate an arena first please.");
|
||||
}
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oArenas list");
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
||||
if (MemoryStorage.arenaList.size() >= 1) {
|
||||
MessageManager.sendMessage(player, "&7Available arena(s):");
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
MessageManager.sendMessage(player, "%A" + arena.arenaName);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendMessage(player, "&7&oNo arenas available...");
|
||||
MessageManager.sendMessage(player, "&7&oCreate an arena first please.");
|
||||
}
|
||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oArenas list");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
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.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDnotfound extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotFound);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotFound);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,44 @@
|
||||
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.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDreload extends DefaultCMD {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
ConfigManager.newFiles();
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
ConfigManager.newFiles();
|
||||
|
||||
MemoryStorage.config.load();
|
||||
MemoryStorage.messages.load();
|
||||
MemoryStorage.arenas.load();
|
||||
MemoryStorage.signs.load();
|
||||
MemoryStorage.shop.load();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||
}
|
||||
MemoryStorage.config.load();
|
||||
MemoryStorage.messages.load();
|
||||
MemoryStorage.arenas.load();
|
||||
MemoryStorage.signs.load();
|
||||
MemoryStorage.shop.load();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||
}
|
||||
|
||||
ArenaHandler.loadArenas();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_reloadedConfigs);
|
||||
return true;
|
||||
}
|
||||
ArenaHandler.loadArenas();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_reloadedConfigs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,8 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -15,39 +14,39 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDremove extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage);
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (args[1].equalsIgnoreCase(arena.arenaName)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]);
|
||||
MemoryStorage.arenas.getFile().set(args[1], null);
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
if (MemoryStorage.signs.getFile().get(sign + ".arenaName").toString().equalsIgnoreCase(args[1])) {
|
||||
Location signLoc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
signLoc.getBlock().setType(Material.AIR);
|
||||
signLoc.getWorld().playEffect(signLoc, Effect.MOBSPAWNER_FLAMES, 0);
|
||||
signLoc.getWorld().playSound(signLoc, Sound.ENTITY_ENDER_DRAGON_FLAP, 1, 1);
|
||||
MemoryStorage.signs.getFile().set(sign, null);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage);
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (args[1].equalsIgnoreCase(arena.arenaName)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]);
|
||||
MemoryStorage.arenas.getFile().set(args[1], null);
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
if (MemoryStorage.signs.getFile().get(sign + ".arenaName").toString().equalsIgnoreCase(args[1])) {
|
||||
Location signLoc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
signLoc.getBlock().setType(Material.AIR);
|
||||
signLoc.getWorld().playEffect(signLoc, Effect.MOBSPAWNER_FLAMES, 0);
|
||||
signLoc.getWorld().playSound(signLoc, Sound.ENTITY_ENDER_DRAGON_FLAP, 1, 1);
|
||||
MemoryStorage.signs.getFile().set(sign, null);
|
||||
}
|
||||
}
|
||||
|
||||
MemoryStorage.arenas.save();
|
||||
MemoryStorage.signs.load();
|
||||
MemoryStorage.arenas.save();
|
||||
MemoryStorage.signs.load();
|
||||
|
||||
MemoryStorage.arenaList.remove(arena);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
MemoryStorage.arenaList.remove(arena);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,23 @@ import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDset extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage);
|
||||
} else {
|
||||
String arenaname = args[1];
|
||||
InventoryHandler.openPanel(player, arenaname);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage);
|
||||
} else {
|
||||
String arenaname = args[1];
|
||||
InventoryHandler.openPanel(player, arenaname);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,64 +1,66 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
|
||||
import nl.Steffion.BlockHunt.*;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
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.MemoryStorage;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDsetwarp extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 2) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage);
|
||||
} else {
|
||||
String arenaname = args[2];
|
||||
String warpname = args[1];
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 2) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage);
|
||||
} else {
|
||||
String arenaname = args[2];
|
||||
String warpname = args[1];
|
||||
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
if (arena != null) {
|
||||
Location loc = player.getLocation();
|
||||
if (warpname.equalsIgnoreCase("lobby")) {
|
||||
arena.lobbyWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else if (warpname.equalsIgnoreCase("hiders")) {
|
||||
arena.hidersWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else if (warpname.equalsIgnoreCase("seekers")) {
|
||||
arena.seekersWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else if (warpname.equalsIgnoreCase("spawn")) {
|
||||
arena.spawnWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setwarpWarpNotFound, "warp-" + warpname);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
if (arena != null) {
|
||||
Location loc = player.getLocation();
|
||||
if (warpname.equalsIgnoreCase("lobby")) {
|
||||
arena.lobbyWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else if (warpname.equalsIgnoreCase("hiders")) {
|
||||
arena.hidersWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else if (warpname.equalsIgnoreCase("seekers")) {
|
||||
arena.seekersWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else if (warpname.equalsIgnoreCase("spawn")) {
|
||||
arena.spawnWarp = loc;
|
||||
save(arena);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setwarpWarpNotFound, "warp-" + warpname);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void save(Arena arena) {
|
||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||
MemoryStorage.arenas.save();
|
||||
ArenaHandler.loadArenas();
|
||||
}
|
||||
public void save(Arena arena) {
|
||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||
MemoryStorage.arenas.save();
|
||||
ArenaHandler.loadArenas();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,14 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
|
||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDshop extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
InventoryHandler.openShop(player);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
InventoryHandler.openShop(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4,54 +4,53 @@ import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDstart extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage);
|
||||
} else {
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
if (args.length <= 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage);
|
||||
} else {
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
|
||||
if (arena != null) {
|
||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||
if (arena.playersInArena.size() >= 2) {
|
||||
arena.timer = 11;
|
||||
arena.gameState = ArenaState.STARTING;
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.warning_lobbyNeedAtleast, "1-2");
|
||||
}
|
||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||
if (arena.playersInArena.size() < arena.maxPlayers) {
|
||||
if (arena.timer >= 10) {
|
||||
arena.timer = 11;
|
||||
}
|
||||
} else {
|
||||
arena.timer = 1;
|
||||
}
|
||||
if (arena != null) {
|
||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||
if (arena.playersInArena.size() >= 2) {
|
||||
arena.timer = 11;
|
||||
arena.gameState = ArenaState.STARTING;
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.warning_lobbyNeedAtleast, "1-2");
|
||||
}
|
||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||
if (arena.playersInArena.size() < arena.maxPlayers) {
|
||||
if (arena.timer >= 10) {
|
||||
arena.timer = 11;
|
||||
}
|
||||
} else {
|
||||
arena.timer = 1;
|
||||
}
|
||||
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.Command;
|
||||
@ -14,29 +10,32 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CMDwand extends DefaultCMD {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
ItemStack wand = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.wandIDname)));
|
||||
ItemMeta im = wand.getItemMeta();
|
||||
im.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)));
|
||||
MemoryStorage.config.load();
|
||||
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.wandDescription.location);
|
||||
List<String> lores2 = new ArrayList<>();
|
||||
for (String lore : lores) {
|
||||
lores2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
if (player != null) {
|
||||
ItemStack wand = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.wandIDname)));
|
||||
ItemMeta im = wand.getItemMeta();
|
||||
im.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)));
|
||||
MemoryStorage.config.load();
|
||||
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.wandDescription.location);
|
||||
List<String> lores2 = new ArrayList<>();
|
||||
for (String lore : lores) {
|
||||
lores2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
|
||||
im.setLore(lores2);
|
||||
wand.setItemMeta(im);
|
||||
player.getInventory().addItem(wand);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 5, 0);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_wandGaveWand, "type-" + wand.getType().toString().replaceAll("_", " ").toLowerCase());
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
im.setLore(lores2);
|
||||
wand.setItemMeta(im);
|
||||
player.getInventory().addItem(wand);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 5, 0);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_wandGaveWand, "type-" + wand.getType().toString().replaceAll("_", " ").toLowerCase());
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
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
|
||||
@ -16,6 +16,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
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;
|
||||
/**
|
||||
* 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.Managers.ConfigManager;
|
||||
|
||||
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",
|
||||
MemoryStorage.config), chat_header("&9", MemoryStorage.config), chat_headerhigh("%H_______.[ %A%header%%H ]._______", MemoryStorage.config),
|
||||
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),
|
||||
|
||||
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,
|
||||
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),
|
||||
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,
|
||||
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),
|
||||
|
||||
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[] {
|
||||
"%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),
|
||||
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 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(
|
||||
"%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),
|
||||
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.",
|
||||
"%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(
|
||||
"%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),
|
||||
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.",
|
||||
"%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[] {
|
||||
"%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%", "&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),
|
||||
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]", "%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%", "%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(
|
||||
"%NSeekers:", MemoryStorage.config), scoreboard_hiders("%NHiders:", MemoryStorage.config),
|
||||
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),
|
||||
|
||||
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(
|
||||
"%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.", MemoryStorage.messages),
|
||||
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),
|
||||
|
||||
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(
|
||||
"%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(
|
||||
"%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),
|
||||
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(
|
||||
"%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(
|
||||
"%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),
|
||||
|
||||
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),
|
||||
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),
|
||||
|
||||
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 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%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%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%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(
|
||||
"%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%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%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 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),
|
||||
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 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%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%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%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(
|
||||
"%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%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%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 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(
|
||||
"%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!",
|
||||
MemoryStorage.messages), warning_arenaStopped("%TAG%WThe arena has been forced to stop!", MemoryStorage.messages),
|
||||
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%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),
|
||||
|
||||
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()
|
||||
+ " 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 '%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%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(
|
||||
"%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%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.",
|
||||
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%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%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),
|
||||
error_teleportFailed("%TAG%EUnable to teleport you into the arena.", MemoryStorage.messages),
|
||||
error_teleportBlocked("%TAG%EYou cannot teleport while playing!", 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(
|
||||
"%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(
|
||||
"%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%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.",
|
||||
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%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 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(
|
||||
"%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%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 hiders has been reached!", MemoryStorage.messages),
|
||||
error_teleportFailed("%TAG%EUnable to teleport you into the arena.", MemoryStorage.messages),
|
||||
error_teleportBlocked("%TAG%EYou cannot teleport while playing!", MemoryStorage.messages);
|
||||
|
||||
public Object value;
|
||||
public ConfigManager config;
|
||||
public String location;
|
||||
public final Object value;
|
||||
public final ConfigManager config;
|
||||
public final String location;
|
||||
|
||||
/**
|
||||
* Makes an object from the list above.
|
||||
*
|
||||
* @param value
|
||||
* Setting in the config file.
|
||||
* @param config
|
||||
* The config file.
|
||||
*/
|
||||
ConfigC(Object value, ConfigManager config) {
|
||||
this.value = value;
|
||||
this.config = config;
|
||||
this.location = this.name().replaceAll("_", ".");
|
||||
}
|
||||
/**
|
||||
* Makes an object from the list above.
|
||||
*
|
||||
* @param value
|
||||
* Setting in the config file.
|
||||
* @param config
|
||||
* The config file.
|
||||
*/
|
||||
ConfigC(Object value, ConfigManager config) {
|
||||
this.value = value;
|
||||
this.config = config;
|
||||
this.location = this.name().replaceAll("_", ".");
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,9 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,244 +11,248 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class InventoryHandler {
|
||||
|
||||
public static void openPanel(Player player, String arenaname) {
|
||||
public static void openPanel(Player player, String arenaname) {
|
||||
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
|
||||
if (arena != null) {
|
||||
String shorten = arena.arenaName;
|
||||
arenaname = arena.arenaName;
|
||||
if (shorten.length() > 6)
|
||||
shorten = shorten.substring(0, 6);
|
||||
Inventory panel = Bukkit.createInventory(null, 54, MessageManager.replaceAll("\u00A7r%N&lBlockHunt Arena: %A" + shorten));
|
||||
if (arena != null) {
|
||||
String shorten = arena.arenaName;
|
||||
arenaname = arena.arenaName;
|
||||
if (shorten.length() > 6) {
|
||||
shorten = shorten.substring(0, 6);
|
||||
}
|
||||
Inventory panel = Bukkit.createInventory(null, 54, MessageManager.replaceAll("\u00A7r%N&lBlockHunt Arena: %A" + shorten));
|
||||
|
||||
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
||||
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
||||
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NBlockHunt arena: %A" + arena.arenaName));
|
||||
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
||||
panel.setItem(0, arenaNameNote);
|
||||
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
||||
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
||||
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NBlockHunt arena: %A" + arena.arenaName));
|
||||
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
||||
panel.setItem(0, arenaNameNote);
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
ItemStack maxPlayers_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||
ItemStack maxPlayers = new ItemStack(Material.BEDROCK, arena.maxPlayers);
|
||||
ItemStack maxPlayers_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||
|
||||
ItemStack disguiseBlocks_NOTE = new ItemStack(Material.BOOK, 1);
|
||||
ItemMeta disguiseBlocks_NOTE_IM = disguiseBlocks_NOTE.getItemMeta();
|
||||
disguiseBlocks_NOTE_IM.setDisplayName(MessageManager.replaceAll("%NSet the %AdisguiseBlocks%N."));
|
||||
disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM);
|
||||
panel.setItem(36, disguiseBlocks_NOTE);
|
||||
ItemStack disguiseBlocks_NOTE = new ItemStack(Material.BOOK, 1);
|
||||
ItemMeta disguiseBlocks_NOTE_IM = disguiseBlocks_NOTE.getItemMeta();
|
||||
disguiseBlocks_NOTE_IM.setDisplayName(MessageManager.replaceAll("%NSet the %AdisguiseBlocks%N."));
|
||||
disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM);
|
||||
panel.setItem(36, disguiseBlocks_NOTE);
|
||||
|
||||
ItemStack blockAnnouncerTime_UP = new ItemStack(Material.GOLD_NUGGET, 1);
|
||||
ItemStack blockAnnouncerTime = new ItemStack(Material.BEDROCK, arena.blockAnnouncerTime);
|
||||
ItemStack blockAnnouncerTime_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_DOWN = 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_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,
|
||||
amountSeekersOnStart_DOWN, 4, 13, 22);
|
||||
updownButton(panel, arena, ArenaType.amountSeekersOnStart, "amountSeekersOnStart", "1", amountSeekersOnStart_UP, amountSeekersOnStart,
|
||||
amountSeekersOnStart_DOWN, 4, 13, 22);
|
||||
|
||||
updownButton(panel, arena, ArenaType.timeInLobbyUntilStart, "timeInLobbyUntilStart", "1 %Nsecond", timeInLobbyUntilStart_UP, timeInLobbyUntilStart,
|
||||
timeInLobbyUntilStart_DOWN, 6, 15, 24);
|
||||
updownButton(panel, arena, ArenaType.timeInLobbyUntilStart, "timeInLobbyUntilStart", "1 %Nsecond", timeInLobbyUntilStart_UP, timeInLobbyUntilStart,
|
||||
timeInLobbyUntilStart_DOWN, 6, 15, 24);
|
||||
|
||||
updownButton(panel, arena, ArenaType.waitingTimeSeeker, "waitingTimeSeeker", "1 %Nsecond", waitingTimeSeeker_UP, waitingTimeSeeker, waitingTimeSeeker_DOWN,
|
||||
7, 16, 25);
|
||||
updownButton(panel, arena, ArenaType.waitingTimeSeeker, "waitingTimeSeeker", "1 %Nsecond", waitingTimeSeeker_UP, waitingTimeSeeker, waitingTimeSeeker_DOWN,
|
||||
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,
|
||||
blockAnnouncerTime_DOWN, 29, 38, 47);
|
||||
updownButton(panel, arena, ArenaType.blockAnnouncerTime, "blockAnnouncerTime", "5 %Nseconds", blockAnnouncerTime_UP, blockAnnouncerTime,
|
||||
blockAnnouncerTime_DOWN, 29, 38, 47);
|
||||
|
||||
updownButton(panel, arena, ArenaType.timeUntilHidersSword, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword,
|
||||
timeUntilHidersSword_DOWN, 30, 39, 48);
|
||||
updownButton(panel, arena, ArenaType.timeUntilHidersSword, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword,
|
||||
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);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname);
|
||||
}
|
||||
}
|
||||
player.openInventory(panel);
|
||||
} else {
|
||||
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,
|
||||
int button, int down) {
|
||||
ItemMeta UP_IM = UP.getItemMeta();
|
||||
UP_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option));
|
||||
UP.setItemMeta(UP_IM);
|
||||
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) {
|
||||
ItemMeta UP_IM = UP.getItemMeta();
|
||||
UP_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option));
|
||||
UP.setItemMeta(UP_IM);
|
||||
|
||||
int setting = 0;
|
||||
switch (at) {
|
||||
case maxPlayers:
|
||||
setting = arena.maxPlayers;
|
||||
break;
|
||||
case minPlayers:
|
||||
setting = arena.minPlayers;
|
||||
break;
|
||||
case amountSeekersOnStart:
|
||||
setting = arena.amountSeekersOnStart;
|
||||
break;
|
||||
case timeInLobbyUntilStart:
|
||||
setting = arena.timeInLobbyUntilStart;
|
||||
break;
|
||||
case waitingTimeSeeker:
|
||||
setting = arena.waitingTimeSeeker;
|
||||
break;
|
||||
case gameTime:
|
||||
setting = arena.gameTime;
|
||||
break;
|
||||
case timeUntilHidersSword:
|
||||
setting = arena.timeUntilHidersSword;
|
||||
break;
|
||||
case blockAnnouncerTime:
|
||||
setting = arena.blockAnnouncerTime;
|
||||
break;
|
||||
case hidersTokenWin:
|
||||
setting = arena.hidersTokenWin;
|
||||
break;
|
||||
case seekersTokenWin:
|
||||
setting = arena.seekersTokenWin;
|
||||
break;
|
||||
case killTokens:
|
||||
setting = arena.killTokens;
|
||||
break;
|
||||
}
|
||||
int setting = 0;
|
||||
switch (at) {
|
||||
case maxPlayers:
|
||||
setting = arena.maxPlayers;
|
||||
break;
|
||||
case minPlayers:
|
||||
setting = arena.minPlayers;
|
||||
break;
|
||||
case amountSeekersOnStart:
|
||||
setting = arena.amountSeekersOnStart;
|
||||
break;
|
||||
case timeInLobbyUntilStart:
|
||||
setting = arena.timeInLobbyUntilStart;
|
||||
break;
|
||||
case waitingTimeSeeker:
|
||||
setting = arena.waitingTimeSeeker;
|
||||
break;
|
||||
case gameTime:
|
||||
setting = arena.gameTime;
|
||||
break;
|
||||
case timeUntilHidersSword:
|
||||
setting = arena.timeUntilHidersSword;
|
||||
break;
|
||||
case blockAnnouncerTime:
|
||||
setting = arena.blockAnnouncerTime;
|
||||
break;
|
||||
case hidersTokenWin:
|
||||
setting = arena.hidersTokenWin;
|
||||
break;
|
||||
case seekersTokenWin:
|
||||
setting = arena.seekersTokenWin;
|
||||
break;
|
||||
case killTokens:
|
||||
setting = arena.killTokens;
|
||||
break;
|
||||
}
|
||||
|
||||
ItemMeta BUTTON_IM = BUTTON.getItemMeta();
|
||||
BUTTON_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting));
|
||||
BUTTON.setItemMeta(BUTTON_IM);
|
||||
ItemMeta BUTTON_IM = BUTTON.getItemMeta();
|
||||
BUTTON_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting));
|
||||
BUTTON.setItemMeta(BUTTON_IM);
|
||||
|
||||
ItemMeta DOWN_IM = DOWN.getItemMeta();
|
||||
DOWN_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option));
|
||||
DOWN.setItemMeta(DOWN_IM);
|
||||
ItemMeta DOWN_IM = DOWN.getItemMeta();
|
||||
DOWN_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option));
|
||||
DOWN.setItemMeta(DOWN_IM);
|
||||
|
||||
panel.setItem(up, UP);
|
||||
panel.setItem(button, BUTTON);
|
||||
panel.setItem(down, DOWN);
|
||||
}
|
||||
panel.setItem(up, UP);
|
||||
panel.setItem(button, BUTTON);
|
||||
panel.setItem(down, DOWN);
|
||||
}
|
||||
|
||||
public static void openDisguiseBlocks(Arena arena, Player player) {
|
||||
String arenaname = arena.arenaName;
|
||||
Inventory panel = Bukkit.createInventory(null, 36, MessageManager.replaceAll("%N&lDisguiseBlocks"));
|
||||
public static void openDisguiseBlocks(Arena arena, Player player) {
|
||||
String arenaname = arena.arenaName;
|
||||
Inventory panel = Bukkit.createInventory(null, 36, MessageManager.replaceAll("%N&lDisguiseBlocks"));
|
||||
|
||||
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
||||
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
||||
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname));
|
||||
ArrayList<String> lores = new ArrayList<>();
|
||||
lores.add(MessageManager.replaceAll("%NPlace the DisguiseBlocks inside this inventory."));
|
||||
arenaNameNote_IM.setLore(lores);
|
||||
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
||||
panel.setItem(0, arenaNameNote);
|
||||
if (arena.disguiseBlocks != null) {
|
||||
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
||||
panel.setItem(i, arena.disguiseBlocks.get(i - 1));
|
||||
}
|
||||
}
|
||||
player.openInventory(panel);
|
||||
}
|
||||
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
|
||||
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
|
||||
arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname));
|
||||
ArrayList<String> lores = new ArrayList<>();
|
||||
lores.add(MessageManager.replaceAll("%NPlace the DisguiseBlocks inside this inventory."));
|
||||
arenaNameNote_IM.setLore(lores);
|
||||
arenaNameNote.setItemMeta(arenaNameNote_IM);
|
||||
panel.setItem(0, arenaNameNote);
|
||||
if (arena.disguiseBlocks != null) {
|
||||
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
||||
panel.setItem(i, arena.disguiseBlocks.get(i - 1));
|
||||
}
|
||||
}
|
||||
player.openInventory(panel);
|
||||
}
|
||||
|
||||
public static void openShop(Player player) {
|
||||
Inventory shop = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)));
|
||||
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");
|
||||
List<String> lores = new ArrayList<>();
|
||||
List<String> lores2 = new ArrayList<>();
|
||||
public static void openShop(Player player) {
|
||||
Inventory shop = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)));
|
||||
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");
|
||||
List<String> lores = new ArrayList<>();
|
||||
List<String> lores2 = new ArrayList<>();
|
||||
|
||||
ItemStack shopTokens = new ItemStack(Material.EMERALD, 1);
|
||||
ItemMeta shopTokens_IM = shopTokens.getItemMeta();
|
||||
shopTokens_IM.setDisplayName(MessageManager.replaceAll("%N&lTokens: %A" + playerTokens));
|
||||
shopTokens.setItemMeta(shopTokens_IM);
|
||||
ItemStack shopTokens = new ItemStack(Material.EMERALD, 1);
|
||||
ItemMeta shopTokens_IM = shopTokens.getItemMeta();
|
||||
shopTokens_IM.setDisplayName(MessageManager.replaceAll("%N&lTokens: %A" + playerTokens));
|
||||
shopTokens.setItemMeta(shopTokens_IM);
|
||||
|
||||
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)));
|
||||
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
||||
lores2 = new ArrayList<>();
|
||||
for (String lore : lores) {
|
||||
lores2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
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)));
|
||||
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
||||
lores2 = new ArrayList<>();
|
||||
for (String lore : lores) {
|
||||
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.setItemMeta(shopBlockChooser_IM);
|
||||
shopBlockChooser_IM.setLore(lores2);
|
||||
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
||||
|
||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1);
|
||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
||||
lores2 = new ArrayList<>();
|
||||
for (String lore : lores) {
|
||||
lores2.add(MessageManager.replaceAll(lore));
|
||||
}
|
||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1);
|
||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
||||
lores2 = new ArrayList<>();
|
||||
for (String lore : lores) {
|
||||
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.setItemMeta(shopBlockHuntPass_IM);
|
||||
shopBlockHuntPass_IM.setLore(lores2);
|
||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||
|
||||
shop.setItem(0, shopTokens);
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)
|
||||
&& (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) {
|
||||
shop.setItem(1, shopBlockChooser);
|
||||
}
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
||||
shop.setItem(2, shopBlockHuntPass);
|
||||
}
|
||||
player.openInventory(shop);
|
||||
}
|
||||
shop.setItem(0, shopTokens);
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)
|
||||
&& (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) {
|
||||
shop.setItem(1, shopBlockChooser);
|
||||
}
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
||||
shop.setItem(2, shopBlockHuntPass);
|
||||
}
|
||||
player.openInventory(shop);
|
||||
}
|
||||
}
|
||||
|
@ -11,16 +11,18 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
public class OnBlockBreakEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockBreakEvent(BlockBreakEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) return;
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockBreakEvent(BlockBreakEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package nl.Steffion.BlockHunt.Listeners;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -12,16 +11,18 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public class OnBlockPlaceEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPlaceEvent(BlockPlaceEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) return;
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPlaceEvent(BlockPlaceEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import nl.Steffion.BlockHunt.*;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
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.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.PlayerHandler;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
@ -21,148 +21,156 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class OnEntityDamageByEntityEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getEntity() instanceof Player) || event.getEntity() == null) {
|
||||
// We only care about player damage
|
||||
return;
|
||||
}
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getEntity() instanceof Player) || event.getEntity() == null) {
|
||||
// We only care about player damage
|
||||
return;
|
||||
}
|
||||
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) return;
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
Player damager = null;
|
||||
if (event.getDamager() instanceof Player) {
|
||||
damager = (Player) event.getDamager();
|
||||
} else {
|
||||
if ((event.getCause() == DamageCause.PROJECTILE) && (event.getDamager() instanceof Arrow)) {
|
||||
// If damage was caused by an arrow, find out who shot the arrow
|
||||
Arrow arrow = (Arrow) event.getDamager();
|
||||
ProjectileSource shooter = arrow.getShooter();
|
||||
if (shooter instanceof Player) {
|
||||
damager = (Player) shooter;
|
||||
}
|
||||
}
|
||||
}
|
||||
Player player = (Player) event.getEntity();
|
||||
Player damager = null;
|
||||
if (event.getDamager() instanceof Player) {
|
||||
damager = (Player) event.getDamager();
|
||||
} else {
|
||||
if ((event.getCause() == DamageCause.PROJECTILE) && (event.getDamager() instanceof Arrow)) {
|
||||
// If damage was caused by an arrow, find out who shot the arrow
|
||||
Arrow arrow = (Arrow) event.getDamager();
|
||||
ProjectileSource shooter = arrow.getShooter();
|
||||
if (shooter instanceof Player) {
|
||||
damager = (Player) shooter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Always block all damage not dealt by a player
|
||||
if (damager == null || !(damager instanceof Player)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
// Always block all damage not dealt by a player
|
||||
if (damager == null || !(damager instanceof Player)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||
// Always cancel damage when players are waiting
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else {
|
||||
// Seeker receiving damage
|
||||
if (arena.seekers.contains(player)) {
|
||||
if (arena.seekers.contains(damager)) {
|
||||
// Seeker damaged by seeker
|
||||
if (!arena.seekersCanHurtSeekers) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Seeker damaged by hider
|
||||
if (!arena.hidersCanHurtSeekers) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Hider damaged by hider
|
||||
if (!arena.hidersCanHurtHiders && !arena.seekers.contains(damager)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||
// Always cancel damage when players are waiting
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else {
|
||||
// Seeker receiving damage
|
||||
if (arena.seekers.contains(player)) {
|
||||
if (arena.seekers.contains(damager)) {
|
||||
// Seeker damaged by seeker
|
||||
if (!arena.seekersCanHurtSeekers) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Seeker damaged by hider
|
||||
if (!arena.hidersCanHurtSeekers) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Hider damaged by hider
|
||||
if (!arena.hidersCanHurtHiders && !arena.seekers.contains(damager)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The damage is allowed, so lets handle it!
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
||||
// The damage is allowed, so lets handle it!
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
||||
|
||||
if (event.getDamage() >= player.getHealth()) {
|
||||
player.setHealth(20);
|
||||
event.setCancelled(true);
|
||||
if (event.getDamage() >= player.getHealth()) {
|
||||
player.setHealth(20);
|
||||
event.setCancelled(true);
|
||||
|
||||
// try moving everything to the next tick to prevent "Removing entity while ticking" errors
|
||||
Player finalDamager = damager;
|
||||
player.getServer().getScheduler().runTask(BlockHunt.plugin, () -> {
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
MemoryStorage.pBlock.remove(player);
|
||||
// try moving everything to the next tick to prevent "Removing entity while ticking" errors
|
||||
Player finalDamager = damager;
|
||||
player.getServer().getScheduler().runTask(BlockHunt.plugin, () -> {
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
MemoryStorage.pBlock.remove(player);
|
||||
|
||||
if (!arena.seekers.contains(player)) {
|
||||
if (MemoryStorage.shop.getFile().get(finalDamager.getName() + ".tokens") == null) {
|
||||
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", 0);
|
||||
MemoryStorage.shop.save();
|
||||
}
|
||||
int damagerTokens = MemoryStorage.shop.getFile().getInt(finalDamager.getName() + ".tokens");
|
||||
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", damagerTokens + arena.killTokens);
|
||||
MemoryStorage.shop.save();
|
||||
if (!arena.seekers.contains(player)) {
|
||||
if (MemoryStorage.shop.getFile().get(finalDamager.getName() + ".tokens") == null) {
|
||||
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", 0);
|
||||
MemoryStorage.shop.save();
|
||||
}
|
||||
int damagerTokens = MemoryStorage.shop.getFile().getInt(finalDamager.getName() + ".tokens");
|
||||
MemoryStorage.shop.getFile().set(finalDamager.getName() + ".tokens", damagerTokens + arena.killTokens);
|
||||
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) {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||
MemoryStorage.shop.save();
|
||||
}
|
||||
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||
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.save();
|
||||
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");
|
||||
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.save();
|
||||
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens);
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens);
|
||||
|
||||
arena.seekers.add(player);
|
||||
player.setWalkSpeed(0.3F);
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHiderDied, "playername-" + player.getDisplayName(), "killer-" + finalDamager.getDisplayName());
|
||||
arena.seekers.add(player);
|
||||
player.setWalkSpeed(0.3F);
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHiderDied, "playername-" + player.getDisplayName(), "killer-" + finalDamager.getDisplayName());
|
||||
|
||||
int hidercount = (arena.playersInArena.size() - arena.seekers.size());
|
||||
if ((hidercount <= 3) && (hidercount > 0)) {
|
||||
List<String> hiders = new ArrayList<>();
|
||||
for (Player p : arena.playersInArena) {
|
||||
if (!arena.seekers.contains(p)) {
|
||||
hiders.add(p.getName());
|
||||
}
|
||||
}
|
||||
Collections.sort(hiders);
|
||||
int hidercount = (arena.playersInArena.size() - arena.seekers.size());
|
||||
if ((hidercount <= 3) && (hidercount > 0)) {
|
||||
List<String> hiders = new ArrayList<>();
|
||||
for (Player p : arena.playersInArena) {
|
||||
if (!arena.seekers.contains(p)) {
|
||||
hiders.add(p.getName());
|
||||
}
|
||||
}
|
||||
Collections.sort(hiders);
|
||||
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + StringUtils.join(hiders.toArray(), ", "));
|
||||
} else {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + hidercount);
|
||||
}
|
||||
}
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + StringUtils.join(hiders.toArray(), ", "));
|
||||
} else {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameHidersLeft, "left-" + hidercount);
|
||||
}
|
||||
}
|
||||
|
||||
player.getInventory().clear();
|
||||
player.updateInventory();
|
||||
player.getInventory().clear();
|
||||
player.updateInventory();
|
||||
|
||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||
ArenaHandler.seekersWin(arena);
|
||||
} else {
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
MemoryStorage.seekertime.put(player, arena.waitingTimeSeeker);
|
||||
PlayerHandler.teleport(player, arena.seekersWarp);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setWalkSpeed(0.3F);
|
||||
if (arena.seekers.size() >= arena.playersInArena.size()) {
|
||||
ArenaHandler.seekersWin(arena);
|
||||
} else {
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
MemoryStorage.seekertime.put(player, arena.waitingTimeSeeker);
|
||||
PlayerHandler.teleport(player, arena.seekersWarp);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.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 visible to others
|
||||
if (player.canSee(otherplayer))
|
||||
player.showPlayer(BlockHunt.plugin, otherplayer); // Make other players visible to new player
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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 visible to others
|
||||
}
|
||||
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.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -14,47 +13,49 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class OnEntityDamageEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityDamageEvent(EntityDamageEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) return;
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityDamageEvent(EntityDamageEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity ent = event.getEntity();
|
||||
if (ent instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
DamageCause cause = event.getCause();
|
||||
switch (cause) {
|
||||
case ENTITY_ATTACK:
|
||||
case PROJECTILE:
|
||||
// Do nothing about damage from an entity
|
||||
// Any entity damage that makes it to here was already allowed by the EntityDamageByEntity event
|
||||
break;
|
||||
case FALL:
|
||||
// Should we prevent the fall damage?
|
||||
if (arena.seekers.contains(player)) {
|
||||
if (!arena.seekersTakeFallDamage) {
|
||||
// Prevent seeker fall damage (if configured)
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!arena.hidersTakeFallDamage) {
|
||||
// Prevent hider fall damage (if configured)
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Cancel all non-entity damage for all players (lava, drowning, fire, etc)
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Entity ent = event.getEntity();
|
||||
if (ent instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
DamageCause cause = event.getCause();
|
||||
switch (cause) {
|
||||
case ENTITY_ATTACK:
|
||||
case PROJECTILE:
|
||||
// Do nothing about damage from an entity
|
||||
// Any entity damage that makes it to here was already allowed by the EntityDamageByEntity event
|
||||
break;
|
||||
case FALL:
|
||||
// Should we prevent the fall damage?
|
||||
if (arena.seekers.contains(player)) {
|
||||
if (!arena.seekersTakeFallDamage) {
|
||||
// Prevent seeker fall damage (if configured)
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!arena.hidersTakeFallDamage) {
|
||||
// Prevent hider fall damage (if configured)
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Cancel all non-entity damage for all players (lava, drowning, fire, etc)
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -11,14 +10,14 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
|
||||
public class OnFoodLevelChangeEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onFoodLevelChangeEvent(FoodLevelChangeEvent event) {
|
||||
Player player = (Player) event.getEntity();
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onFoodLevelChangeEvent(FoodLevelChangeEvent event) {
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.*;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
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.MemoryStorage;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -20,299 +22,306 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class OnInventoryClickEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
Inventory inv = event.getInventory();
|
||||
InventoryView invView = event.getView();
|
||||
if (inv.getType().equals(InventoryType.CHEST)) {
|
||||
if (invView.getTitle().contains("DisguiseBlocks")) {
|
||||
if (event.getCurrentItem() != null) {
|
||||
if (!event.getCurrentItem().getType().isBlock()) {
|
||||
if (!event.getCurrentItem().getType().equals(Material.FLOWER_POT)) {
|
||||
event.setCancelled(true);
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
Inventory inv = event.getInventory();
|
||||
InventoryView invView = event.getView();
|
||||
if (inv.getType().equals(InventoryType.CHEST)) {
|
||||
if (invView.getTitle().contains("DisguiseBlocks")) {
|
||||
if (event.getCurrentItem() != null) {
|
||||
if (!event.getCurrentItem().getType().isBlock()) {
|
||||
if (!event.getCurrentItem().getType().equals(Material.FLOWER_POT)) {
|
||||
event.setCancelled(true);
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Early exit if this isnt a blockhunt inventory
|
||||
if (!invView.getTitle().contains("BlockHunt"))
|
||||
return;
|
||||
// Early exit if this isnt a blockhunt inventory
|
||||
if (!invView.getTitle().contains("BlockHunt")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (invView.getTitle().startsWith("\u00A7r")) {
|
||||
if (invView.getTitle().equals(MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)))) {
|
||||
event.setCancelled(true);
|
||||
ItemStack item = event.getCurrentItem();
|
||||
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");
|
||||
if (item == null)
|
||||
return;
|
||||
if (item.getType().equals(Material.AIR))
|
||||
return;
|
||||
if (item.getItemMeta().getDisplayName() == null)
|
||||
return;
|
||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name).toString()))) {
|
||||
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)) {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockchooser", true);
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price));
|
||||
MemoryStorage.shop.save();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name));
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||
}
|
||||
} else if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) {
|
||||
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();
|
||||
}
|
||||
if (invView.getTitle().startsWith("\u00A7r")) {
|
||||
if (invView.getTitle().equals(MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)))) {
|
||||
event.setCancelled(true);
|
||||
ItemStack item = event.getCurrentItem();
|
||||
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");
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
if (item.getType().equals(Material.AIR)) {
|
||||
return;
|
||||
}
|
||||
if (item.getItemMeta().getDisplayName() == null) {
|
||||
return;
|
||||
}
|
||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name).toString()))) {
|
||||
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)) {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockchooser", true);
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price));
|
||||
MemoryStorage.shop.save();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name));
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||
}
|
||||
} else if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) {
|
||||
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() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price));
|
||||
MemoryStorage.shop.save();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name));
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||
}
|
||||
}
|
||||
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.save();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name));
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||
}
|
||||
}
|
||||
|
||||
InventoryHandler.openShop(player);
|
||||
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
||||
event.setCancelled(true);
|
||||
if (event.getCurrentItem() != null) {
|
||||
if (event.getCurrentItem().getType().isBlock()) {
|
||||
MemoryStorage.choosenBlock.put(player, event.getCurrentItem());
|
||||
String blockName = event.getCurrentItem().getType().name();
|
||||
blockName = WordUtils.capitalizeFully(blockName.replace("_", " "));
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-"
|
||||
+ blockName);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
||||
}
|
||||
}
|
||||
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
||||
event.setCancelled(true);
|
||||
if (event.getCurrentItem() != null) {
|
||||
if (event.getCurrentItem().getType().equals(Material.BLUE_WOOL)) {
|
||||
int i = 0;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
for (Player playerCheck : arena.playersInArena) {
|
||||
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||
if (MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
InventoryHandler.openShop(player);
|
||||
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
||||
event.setCancelled(true);
|
||||
if (event.getCurrentItem() != null) {
|
||||
if (event.getCurrentItem().getType().isBlock()) {
|
||||
MemoryStorage.choosenBlock.put(player, event.getCurrentItem());
|
||||
String blockName = event.getCurrentItem().getType().name();
|
||||
blockName = WordUtils.capitalizeFully(blockName.replace("_", " "));
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-"
|
||||
+ blockName);
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
||||
}
|
||||
}
|
||||
} else if (invView.getTitle().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
||||
event.setCancelled(true);
|
||||
if (event.getCurrentItem() != null) {
|
||||
if (event.getCurrentItem().getType().equals(Material.BLUE_WOOL)) {
|
||||
int i = 0;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
for (Player playerCheck : arena.playersInArena) {
|
||||
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||
if (MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= arena.amountSeekersOnStart) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached);
|
||||
} else {
|
||||
MemoryStorage.choosenSeeker.put(player, true);
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
player.updateInventory();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker);
|
||||
inv.clear();
|
||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||
MemoryStorage.shop.save();
|
||||
} else {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||
MemoryStorage.shop.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i >= arena.amountSeekersOnStart) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached);
|
||||
} else {
|
||||
MemoryStorage.choosenSeeker.put(player, true);
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
player.updateInventory();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker);
|
||||
inv.clear();
|
||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||
MemoryStorage.shop.save();
|
||||
} else {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||
MemoryStorage.shop.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (event.getCurrentItem().getType().equals(Material.RED_WOOL)) {
|
||||
int i = 0;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
for (Player playerCheck : arena.playersInArena) {
|
||||
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||
if (!MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (event.getCurrentItem().getType().equals(Material.RED_WOOL)) {
|
||||
int i = 0;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
for (Player playerCheck : arena.playersInArena) {
|
||||
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||
if (!MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= (arena.playersInArena.size() - 1)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached);
|
||||
} else {
|
||||
MemoryStorage.choosenSeeker.put(player, false);
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
player.updateInventory();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders);
|
||||
inv.clear();
|
||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||
MemoryStorage.shop.save();
|
||||
} else {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||
MemoryStorage.shop.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
event.setCancelled(true);
|
||||
ItemStack item = event.getCurrentItem();
|
||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NBlockHunt arena: %A"), "");
|
||||
if (i >= (arena.playersInArena.size() - 1)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached);
|
||||
} else {
|
||||
MemoryStorage.choosenSeeker.put(player, false);
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
player.updateInventory();
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders);
|
||||
inv.clear();
|
||||
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||
MemoryStorage.shop.save();
|
||||
} else {
|
||||
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||
MemoryStorage.shop.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
event.setCancelled(true);
|
||||
ItemStack item = event.getCurrentItem();
|
||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NBlockHunt arena: %A"), "");
|
||||
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
return;
|
||||
if (item.getType().equals(Material.AIR))
|
||||
return;
|
||||
if (!item.getItemMeta().hasDisplayName())
|
||||
return;
|
||||
if (item.getType().equals(Material.GOLD_NUGGET)) {
|
||||
if (item.getItemMeta().getDisplayName().contains("maxPlayers")) {
|
||||
updownButton(player, item, arena, ArenaType.maxPlayers, arena.maxPlayers, Bukkit.getMaxPlayers(), 2, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("minPlayers")) {
|
||||
updownButton(player, item, arena, ArenaType.minPlayers, arena.minPlayers, Bukkit.getMaxPlayers() - 1, 2, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("amountSeekersOnStart")) {
|
||||
updownButton(player, item, arena, ArenaType.amountSeekersOnStart, arena.amountSeekersOnStart, arena.maxPlayers - 1, 1, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("timeInLobbyUntilStart")) {
|
||||
updownButton(player, item, arena, ArenaType.timeInLobbyUntilStart, arena.timeInLobbyUntilStart, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("waitingTimeSeeker")) {
|
||||
updownButton(player, item, arena, ArenaType.waitingTimeSeeker, arena.waitingTimeSeeker, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("gameTime")) {
|
||||
updownButton(player, item, arena, ArenaType.gameTime, arena.gameTime, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("blockAnnouncerTime")) {
|
||||
updownButton(player, item, arena, ArenaType.blockAnnouncerTime, arena.blockAnnouncerTime, 1000, 0, 5, 5);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("timeUntilHidersSword")) {
|
||||
updownButton(player, item, arena, ArenaType.timeUntilHidersSword, arena.timeUntilHidersSword, 1000, 0, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("hidersTokenWin")) {
|
||||
updownButton(player, item, arena, ArenaType.hidersTokenWin, arena.hidersTokenWin, 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);
|
||||
}
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
if (item.getType().equals(Material.AIR)) {
|
||||
return;
|
||||
}
|
||||
if (!item.getItemMeta().hasDisplayName()) {
|
||||
return;
|
||||
}
|
||||
if (item.getType().equals(Material.GOLD_NUGGET)) {
|
||||
if (item.getItemMeta().getDisplayName().contains("maxPlayers")) {
|
||||
updownButton(player, item, arena, ArenaType.maxPlayers, arena.maxPlayers, Bukkit.getMaxPlayers(), 2, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("minPlayers")) {
|
||||
updownButton(player, item, arena, ArenaType.minPlayers, arena.minPlayers, Bukkit.getMaxPlayers() - 1, 2, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("amountSeekersOnStart")) {
|
||||
updownButton(player, item, arena, ArenaType.amountSeekersOnStart, arena.amountSeekersOnStart, arena.maxPlayers - 1, 1, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("timeInLobbyUntilStart")) {
|
||||
updownButton(player, item, arena, ArenaType.timeInLobbyUntilStart, arena.timeInLobbyUntilStart, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("waitingTimeSeeker")) {
|
||||
updownButton(player, item, arena, ArenaType.waitingTimeSeeker, arena.waitingTimeSeeker, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("gameTime")) {
|
||||
updownButton(player, item, arena, ArenaType.gameTime, arena.gameTime, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("blockAnnouncerTime")) {
|
||||
updownButton(player, item, arena, ArenaType.blockAnnouncerTime, arena.blockAnnouncerTime, 1000, 0, 5, 5);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("timeUntilHidersSword")) {
|
||||
updownButton(player, item, arena, ArenaType.timeUntilHidersSword, arena.timeUntilHidersSword, 1000, 0, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("hidersTokenWin")) {
|
||||
updownButton(player, item, arena, ArenaType.hidersTokenWin, arena.hidersTokenWin, 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);
|
||||
InventoryHandler.openPanel(player, arena.arenaName);
|
||||
save(arena);
|
||||
InventoryHandler.openPanel(player, arena.arenaName);
|
||||
|
||||
} else if (item.getType().equals(Material.BOOK)) {
|
||||
if (item.getItemMeta().getDisplayName().contains("disguiseBlocks")) {
|
||||
InventoryHandler.openDisguiseBlocks(arena, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (item.getType().equals(Material.BOOK)) {
|
||||
if (item.getItemMeta().getDisplayName().contains("disguiseBlocks")) {
|
||||
InventoryHandler.openDisguiseBlocks(arena, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void save(Arena arena) {
|
||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||
MemoryStorage.arenas.save();
|
||||
ArenaHandler.loadArenas();
|
||||
}
|
||||
public void save(Arena arena) {
|
||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||
MemoryStorage.arenas.save();
|
||||
ArenaHandler.loadArenas();
|
||||
}
|
||||
|
||||
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 (option < max) {
|
||||
switch (at) {
|
||||
case maxPlayers:
|
||||
arena.maxPlayers = option + add;
|
||||
break;
|
||||
case minPlayers:
|
||||
arena.minPlayers = option + add;
|
||||
break;
|
||||
case amountSeekersOnStart:
|
||||
arena.amountSeekersOnStart = option + add;
|
||||
break;
|
||||
case timeInLobbyUntilStart:
|
||||
arena.timeInLobbyUntilStart = option + add;
|
||||
break;
|
||||
case waitingTimeSeeker:
|
||||
arena.waitingTimeSeeker = option + add;
|
||||
break;
|
||||
case gameTime:
|
||||
arena.gameTime = option + add;
|
||||
break;
|
||||
case blockAnnouncerTime:
|
||||
arena.blockAnnouncerTime = option + add;
|
||||
break;
|
||||
case timeUntilHidersSword:
|
||||
arena.timeUntilHidersSword = option + add;
|
||||
break;
|
||||
case hidersTokenWin:
|
||||
arena.hidersTokenWin = option + add;
|
||||
break;
|
||||
case seekersTokenWin:
|
||||
arena.seekersTokenWin = option + add;
|
||||
break;
|
||||
case killTokens:
|
||||
arena.killTokens = option + add;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setTooHighNumber, "max-" + max);
|
||||
}
|
||||
} else if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_remove2))) {
|
||||
if (option > min) {
|
||||
switch (at) {
|
||||
case maxPlayers:
|
||||
arena.maxPlayers = option - remove;
|
||||
break;
|
||||
case minPlayers:
|
||||
arena.minPlayers = option - remove;
|
||||
break;
|
||||
case amountSeekersOnStart:
|
||||
arena.amountSeekersOnStart = option - remove;
|
||||
break;
|
||||
case timeInLobbyUntilStart:
|
||||
arena.timeInLobbyUntilStart = option - remove;
|
||||
break;
|
||||
case waitingTimeSeeker:
|
||||
arena.waitingTimeSeeker = option - remove;
|
||||
break;
|
||||
case gameTime:
|
||||
arena.gameTime = option - remove;
|
||||
break;
|
||||
case blockAnnouncerTime:
|
||||
arena.blockAnnouncerTime = option - remove;
|
||||
break;
|
||||
case timeUntilHidersSword:
|
||||
arena.timeUntilHidersSword = option - remove;
|
||||
break;
|
||||
case hidersTokenWin:
|
||||
arena.hidersTokenWin = option - remove;
|
||||
break;
|
||||
case seekersTokenWin:
|
||||
arena.seekersTokenWin = option - remove;
|
||||
break;
|
||||
case killTokens:
|
||||
arena.killTokens = option - remove;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setTooLowNumber, "min-" + min);
|
||||
}
|
||||
}
|
||||
}
|
||||
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 (option < max) {
|
||||
switch (at) {
|
||||
case maxPlayers:
|
||||
arena.maxPlayers = option + add;
|
||||
break;
|
||||
case minPlayers:
|
||||
arena.minPlayers = option + add;
|
||||
break;
|
||||
case amountSeekersOnStart:
|
||||
arena.amountSeekersOnStart = option + add;
|
||||
break;
|
||||
case timeInLobbyUntilStart:
|
||||
arena.timeInLobbyUntilStart = option + add;
|
||||
break;
|
||||
case waitingTimeSeeker:
|
||||
arena.waitingTimeSeeker = option + add;
|
||||
break;
|
||||
case gameTime:
|
||||
arena.gameTime = option + add;
|
||||
break;
|
||||
case blockAnnouncerTime:
|
||||
arena.blockAnnouncerTime = option + add;
|
||||
break;
|
||||
case timeUntilHidersSword:
|
||||
arena.timeUntilHidersSword = option + add;
|
||||
break;
|
||||
case hidersTokenWin:
|
||||
arena.hidersTokenWin = option + add;
|
||||
break;
|
||||
case seekersTokenWin:
|
||||
arena.seekersTokenWin = option + add;
|
||||
break;
|
||||
case killTokens:
|
||||
arena.killTokens = option + add;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setTooHighNumber, "max-" + max);
|
||||
}
|
||||
} else if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_remove2))) {
|
||||
if (option > min) {
|
||||
switch (at) {
|
||||
case maxPlayers:
|
||||
arena.maxPlayers = option - remove;
|
||||
break;
|
||||
case minPlayers:
|
||||
arena.minPlayers = option - remove;
|
||||
break;
|
||||
case amountSeekersOnStart:
|
||||
arena.amountSeekersOnStart = option - remove;
|
||||
break;
|
||||
case timeInLobbyUntilStart:
|
||||
arena.timeInLobbyUntilStart = option - remove;
|
||||
break;
|
||||
case waitingTimeSeeker:
|
||||
arena.waitingTimeSeeker = option - remove;
|
||||
break;
|
||||
case gameTime:
|
||||
arena.gameTime = option - remove;
|
||||
break;
|
||||
case blockAnnouncerTime:
|
||||
arena.blockAnnouncerTime = option - remove;
|
||||
break;
|
||||
case timeUntilHidersSword:
|
||||
arena.timeUntilHidersSword = option - remove;
|
||||
break;
|
||||
case hidersTokenWin:
|
||||
arena.hidersTokenWin = option - remove;
|
||||
break;
|
||||
case seekersTokenWin:
|
||||
arena.seekersTokenWin = option - remove;
|
||||
break;
|
||||
case killTokens:
|
||||
arena.killTokens = option - remove;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setTooLowNumber, "min-" + min);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,9 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -17,45 +14,47 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class OnInventoryCloseEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryCloseEvent(InventoryCloseEvent event) {
|
||||
Inventory inv = event.getInventory();
|
||||
InventoryView invView = event.getView();
|
||||
if (inv.getType().equals(InventoryType.CHEST)) {
|
||||
if (invView.getTitle().contains("DisguiseBlocks")) {
|
||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A"), "");
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryCloseEvent(InventoryCloseEvent event) {
|
||||
Inventory inv = event.getInventory();
|
||||
InventoryView invView = event.getView();
|
||||
if (inv.getType().equals(InventoryType.CHEST)) {
|
||||
if (invView.getTitle().contains("DisguiseBlocks")) {
|
||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A"), "");
|
||||
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
Arena arena = null;
|
||||
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||
arena = arena2;
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> blocks = new ArrayList<>();
|
||||
for (ItemStack item : inv.getContents()) {
|
||||
if (item != null) {
|
||||
if (!item.getType().equals(Material.PAPER)) {
|
||||
if (item.getType().equals(Material.FLOWER_POT)) {
|
||||
blocks.add(new ItemStack(Material.FLOWER_POT));
|
||||
} else {
|
||||
blocks.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<ItemStack> blocks = new ArrayList<>();
|
||||
for (ItemStack item : inv.getContents()) {
|
||||
if (item != null) {
|
||||
if (!item.getType().equals(Material.PAPER)) {
|
||||
if (item.getType().equals(Material.FLOWER_POT)) {
|
||||
blocks.add(new ItemStack(Material.FLOWER_POT));
|
||||
} else {
|
||||
blocks.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arena.disguiseBlocks = blocks;
|
||||
save(arena);
|
||||
}
|
||||
}
|
||||
}
|
||||
arena.disguiseBlocks = blocks;
|
||||
save(arena);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void save(Arena arena) {
|
||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||
MemoryStorage.arenas.save();
|
||||
ArenaHandler.loadArenas();
|
||||
}
|
||||
public void save(Arena arena) {
|
||||
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||
MemoryStorage.arenas.save();
|
||||
ArenaHandler.loadArenas();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -11,14 +10,14 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
|
||||
public class OnPlayerDropItemEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,16 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.*;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
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.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.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -25,140 +29,140 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class OnPlayerInteractEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerInteractEvent(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getClickedBlock();
|
||||
if (PermissionsManager.hasPerm(player, Permissions.create, false)) {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item.getType() != Material.AIR) {
|
||||
if (item.getItemMeta().hasDisplayName()) {
|
||||
ItemMeta im = item.getItemMeta();
|
||||
if (im.getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)))) {
|
||||
Action action = event.getAction();
|
||||
if (event.hasBlock()) {
|
||||
Location location = event.getClickedBlock().getLocation();
|
||||
if (action.equals(Action.LEFT_CLICK_BLOCK)) {
|
||||
event.setCancelled(true);
|
||||
if (MemoryStorage.pos1.get(player) == null || !MemoryStorage.pos1.get(player).equals(location)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-1",
|
||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||
MemoryStorage.pos1.put(player, location);
|
||||
}
|
||||
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
event.setCancelled(true);
|
||||
if (MemoryStorage.pos2.get(player) == null || !MemoryStorage.pos2.get(player).equals(location)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-2",
|
||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||
MemoryStorage.pos2.put(player, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerInteractEvent(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getClickedBlock();
|
||||
if (PermissionsManager.hasPerm(player, Permissions.create, false)) {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item.getType() != Material.AIR) {
|
||||
if (item.getItemMeta().hasDisplayName()) {
|
||||
ItemMeta im = item.getItemMeta();
|
||||
if (im.getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)))) {
|
||||
Action action = event.getAction();
|
||||
if (event.hasBlock()) {
|
||||
Location location = event.getClickedBlock().getLocation();
|
||||
if (action.equals(Action.LEFT_CLICK_BLOCK)) {
|
||||
event.setCancelled(true);
|
||||
if (MemoryStorage.pos1.get(player) == null || !MemoryStorage.pos1.get(player).equals(location)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-1",
|
||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||
MemoryStorage.pos1.put(player, location);
|
||||
}
|
||||
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
event.setCancelled(true);
|
||||
if (MemoryStorage.pos2.get(player) == null || !MemoryStorage.pos2.get(player).equals(location)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-2",
|
||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||
MemoryStorage.pos2.put(player, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (event.getClickedBlock() != null) {
|
||||
if (event.getClickedBlock().getState() instanceof Sign) {
|
||||
if (SignsHandler.isSign(event.getClickedBlock().getLocation())) {
|
||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||
if (sign.getLine(1) != null) {
|
||||
if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||
ArenaHandler.playerLeaveArena(player, true, true);
|
||||
}
|
||||
} 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)) {
|
||||
InventoryHandler.openShop(player);
|
||||
}
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (sign.getLines()[1].contains(arena.arenaName)) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||
ArenaHandler.playerJoinArena(player, arena.arenaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (event.getClickedBlock() != null) {
|
||||
if (event.getClickedBlock().getState() instanceof Sign) {
|
||||
if (SignsHandler.isSign(event.getClickedBlock().getLocation())) {
|
||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||
if (sign.getLine(1) != null) {
|
||||
if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||
ArenaHandler.playerLeaveArena(player, true, true);
|
||||
}
|
||||
} 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)) {
|
||||
InventoryHandler.openShop(player);
|
||||
}
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (sign.getLines()[1].contains(arena.arenaName)) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||
ArenaHandler.playerJoinArena(player, arena.arenaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
if (event.getClickedBlock().getType() != Material.AIR) {
|
||||
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.ANVIL) || event.getClickedBlock().getType().equals(Material.ENDER_CHEST)
|
||||
|| event.getClickedBlock().getType().equals(Material.JUKEBOX) || block.getRelative(event.getBlockFace()).getType().equals(Material.FIRE)) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
if (event.getClickedBlock().getType() != Material.AIR) {
|
||||
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.ANVIL) || event.getClickedBlock().getType().equals(Material.ENDER_CHEST)
|
||||
|| event.getClickedBlock().getType().equals(Material.JUKEBOX) || block.getRelative(event.getBlockFace()).getType().equals(Material.FIRE)) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.seekers.contains(player)) {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
if (MemoryStorage.hiddenLoc.get(pl) != null) {
|
||||
Block pLoc = event.getClickedBlock();
|
||||
Block moveLocBlock = MemoryStorage.hiddenLoc.get(pl).getBlock();
|
||||
if (moveLocBlock.getX() == pLoc.getX() && moveLocBlock.getY() == pLoc.getY() && moveLocBlock.getZ() == pLoc.getZ()) {
|
||||
MemoryStorage.moveLoc.put(pl, new Location(pl.getWorld(), 0, 0, 0));
|
||||
pl.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
||||
SolidBlockHandler.makePlayerUnsolid(pl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.seekers.contains(player)) {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
if (MemoryStorage.hiddenLoc.get(pl) != null) {
|
||||
Block pLoc = event.getClickedBlock();
|
||||
Block moveLocBlock = MemoryStorage.hiddenLoc.get(pl).getBlock();
|
||||
if (moveLocBlock.getX() == pLoc.getX() && moveLocBlock.getY() == pLoc.getY() && moveLocBlock.getZ() == pLoc.getZ()) {
|
||||
MemoryStorage.moveLoc.put(pl, new Location(pl.getWorld(), 0, 0, 0));
|
||||
pl.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
||||
SolidBlockHandler.makePlayerUnsolid(pl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) {
|
||||
event.setCancelled(true);
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item.getType() != Material.AIR) {
|
||||
if (item.getItemMeta().getDisplayName() != null) {
|
||||
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)));
|
||||
if (arena.disguiseBlocks != null) {
|
||||
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
||||
blockChooser.setItem(i - 1, arena.disguiseBlocks.get(i - 1));
|
||||
}
|
||||
}
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) {
|
||||
event.setCancelled(true);
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item.getType() != Material.AIR) {
|
||||
if (item.getItemMeta().getDisplayName() != null) {
|
||||
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)));
|
||||
if (arena.disguiseBlocks != null) {
|
||||
for (int i = arena.disguiseBlocks.size(); i > 0; i = 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)))) {
|
||||
Inventory BlockHuntPass = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||
ItemStack BlockHuntPassSEEKER = new ItemStack(Material.BLUE_WOOL, 1);
|
||||
ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER.getItemMeta();
|
||||
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eSEEKER"));
|
||||
BlockHuntPassSEEKER.setItemMeta(BlockHuntPassIM);
|
||||
BlockHuntPass.setItem(1, BlockHuntPassSEEKER);
|
||||
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)));
|
||||
ItemStack BlockHuntPassSEEKER = new ItemStack(Material.BLUE_WOOL, 1);
|
||||
ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER.getItemMeta();
|
||||
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eSEEKER"));
|
||||
BlockHuntPassSEEKER.setItemMeta(BlockHuntPassIM);
|
||||
BlockHuntPass.setItem(1, BlockHuntPassSEEKER);
|
||||
|
||||
ItemStack BlockHuntPassHIDER = new ItemStack(Material.RED_WOOL, 1);
|
||||
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eHIDER"));
|
||||
BlockHuntPassHIDER.setItemMeta(BlockHuntPassIM);
|
||||
BlockHuntPass.setItem(7, BlockHuntPassHIDER);
|
||||
ItemStack BlockHuntPassHIDER = new ItemStack(Material.RED_WOOL, 1);
|
||||
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eHIDER"));
|
||||
BlockHuntPassHIDER.setItemMeta(BlockHuntPassIM);
|
||||
BlockHuntPass.setItem(7, BlockHuntPassHIDER);
|
||||
|
||||
player.openInventory(BlockHuntPass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
player.openInventory(BlockHuntPass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.*;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
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.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -14,69 +17,71 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class OnPlayerMoveEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerMoveEvent(PlayerMoveEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) return;
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
if (arena.gameState == ArenaState.INGAME) {
|
||||
MemoryStorage.moveLoc.put(player, player.getLocation());
|
||||
if(arena.pos1 == null || arena.pos2 == null){
|
||||
BlockHunt.plugin.getLogger().info("Arena:"+
|
||||
arena.arenaName+" appears to have bad coords : pos1:"+
|
||||
((arena.pos1 != null)?arena.pos1.toString():" NULL")+ " Pos2:" +
|
||||
((arena.pos2 != null)?arena.pos2.toString():" NULL"));
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerMoveEvent(PlayerMoveEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
if (arena.gameState == ArenaState.INGAME) {
|
||||
MemoryStorage.moveLoc.put(player, player.getLocation());
|
||||
if (arena.pos1 == null || arena.pos2 == null) {
|
||||
BlockHunt.plugin.getLogger().info("Arena:" +
|
||||
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");
|
||||
//event.setCancelled(true);
|
||||
Location loc = player.getLocation();
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
return;
|
||||
}
|
||||
double maxX = Math.max(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 minY = Math.min(arena.pos1.getY(), arena.pos2.getY());
|
||||
double maxZ = Math.max(arena.pos1.getZ(), arena.pos2.getZ());
|
||||
double minZ = Math.min(arena.pos1.getZ(), arena.pos2.getZ());
|
||||
//event.setCancelled(true);
|
||||
Location loc = player.getLocation();
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
return;
|
||||
}
|
||||
double maxX = Math.max(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 minY = Math.min(arena.pos1.getY(), arena.pos2.getY());
|
||||
double maxZ = Math.max(arena.pos1.getZ(), arena.pos2.getZ());
|
||||
double minZ = Math.min(arena.pos1.getZ(), arena.pos2.getZ());
|
||||
|
||||
Location loc = player.getLocation();
|
||||
if (loc.getBlockX() > maxX) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockX() < minX) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockZ() > maxZ) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockZ() < minZ) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockY() > maxY) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockY() < minY) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
if (loc.getBlockX() > maxX) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockX() < minX) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockZ() > maxZ) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockZ() < minZ) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockY() > maxY) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
} else if (loc.getBlockY() < minY) {
|
||||
//event.setCancelled(true);
|
||||
player.playEffect(loc, Effect.ENDER_SIGNAL, null);
|
||||
player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
|
||||
PlayerHandler.teleport(player, arena.hidersWarp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,30 +3,23 @@ package nl.Steffion.BlockHunt.Listeners;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class OnPlayerQuitEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerQuitEvent(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerQuitEvent(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
ArenaHandler.playerLeaveArena(player, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
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)
|
||||
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent event) {
|
||||
// Early exit if no one is in any arena
|
||||
if (ArenaHandler.noPlayersInArenas()) return;
|
||||
if (ArenaHandler.noPlayersInArenas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
|
@ -12,25 +12,26 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
|
||||
public class OnPlayerTeleportEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerTeleportEvent(PlayerTeleportEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (MemoryStorage.pData.get(player) != null) {
|
||||
handlePlayer(event, player);
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerTeleportEvent(PlayerTeleportEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (MemoryStorage.pData.get(player) != null) {
|
||||
handlePlayer(event, player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a player that is in an arena
|
||||
* @param event PlayerTeleportEvent
|
||||
* @param player Player
|
||||
*/
|
||||
private void handlePlayer(PlayerTeleportEvent event, Player player) {
|
||||
Location storedLoc = MemoryStorage.teleportLoc.remove(player);
|
||||
Location to = event.getTo();
|
||||
if (storedLoc == null || storedLoc.getWorld() != to.getWorld() || to.distanceSquared(storedLoc) > 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_teleportBlocked);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handle a player that is in an arena
|
||||
*
|
||||
* @param event PlayerTeleportEvent
|
||||
* @param player Player
|
||||
*/
|
||||
private void handlePlayer(PlayerTeleportEvent event, Player player) {
|
||||
Location storedLoc = MemoryStorage.teleportLoc.remove(player);
|
||||
Location to = event.getTo();
|
||||
if (storedLoc == null || storedLoc.getWorld() != to.getWorld() || to.distanceSquared(storedLoc) > 1) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_teleportBlocked);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import nl.Steffion.BlockHunt.SignsHandler;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -13,16 +12,16 @@ import org.bukkit.event.block.SignChangeEvent;
|
||||
|
||||
public class OnSignChangeEvent implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onSignChangeEvent(SignChangeEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String[] lines = event.getLines();
|
||||
if (lines[0] != null) {
|
||||
if (lines[0].equalsIgnoreCase("[" + BlockHunt.pdfFile.getName() + "]")) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.signcreate, true)) {
|
||||
SignsHandler.createSign(event, lines, event.getBlock().getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onSignChangeEvent(SignChangeEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String[] lines = event.getLines();
|
||||
if (lines[0] != null) {
|
||||
if (lines[0].equalsIgnoreCase("[" + BlockHunt.pdfFile.getName() + "]")) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.signcreate, true)) {
|
||||
SignsHandler.createSign(event, lines, event.getBlock().getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +1,50 @@
|
||||
package nl.Steffion.BlockHunt.Managers;
|
||||
/**
|
||||
* 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 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.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandManager {
|
||||
|
||||
|
||||
public String name;
|
||||
public String label;
|
||||
public String args;
|
||||
public String argsalias;
|
||||
public Permissions permission;
|
||||
public ConfigC help;
|
||||
public boolean enabled;
|
||||
public List<String> mainTABlist;
|
||||
public DefaultCMD CMD;
|
||||
public String usage;
|
||||
public final String name;
|
||||
public final String label;
|
||||
public final String args;
|
||||
public final String argsalias;
|
||||
public final Permissions permission;
|
||||
public final ConfigC help;
|
||||
public final boolean enabled;
|
||||
public final List<String> mainTABlist;
|
||||
public final DefaultCMD CMD;
|
||||
public final String usage;
|
||||
|
||||
public CommandManager(String name, String label, String args, String argsalias, Permissions permission, ConfigC help, Boolean enabled, List<String> mainTABlist,
|
||||
DefaultCMD CMD, String usage) {
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
this.args = args;
|
||||
this.argsalias = argsalias;
|
||||
this.permission = permission;
|
||||
this.help = help;
|
||||
this.enabled = enabled;
|
||||
this.mainTABlist = mainTABlist;
|
||||
this.CMD = CMD;
|
||||
this.usage = usage;
|
||||
public CommandManager(String name, String label, String args, String argsalias, Permissions permission, ConfigC help, Boolean enabled, List<String> mainTABlist,
|
||||
DefaultCMD CMD, String usage) {
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
this.args = args;
|
||||
this.argsalias = argsalias;
|
||||
this.permission = permission;
|
||||
this.help = help;
|
||||
this.enabled = enabled;
|
||||
this.mainTABlist = mainTABlist;
|
||||
this.CMD = CMD;
|
||||
this.usage = usage;
|
||||
|
||||
MemoryStorage.commands.add(this);
|
||||
}
|
||||
MemoryStorage.commands.add(this);
|
||||
}
|
||||
}
|
||||
|
@ -1,153 +1,153 @@
|
||||
package nl.Steffion.BlockHunt.Managers;
|
||||
/**
|
||||
* 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 java.io.File;
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigManager {
|
||||
|
||||
|
||||
private String fileName;
|
||||
private File file;
|
||||
private FileConfiguration fileC;
|
||||
private ConfigurationSection fileCS;
|
||||
private File fileLocation;
|
||||
private final String fileName;
|
||||
private final File file;
|
||||
private final FileConfiguration fileC;
|
||||
private final ConfigurationSection fileCS;
|
||||
private final File fileLocation;
|
||||
|
||||
/**
|
||||
* Use this class to create an automated config file.
|
||||
*
|
||||
* @param fileName
|
||||
* Name of the file.
|
||||
*/
|
||||
public ConfigManager(String fileName) {
|
||||
this.fileName = fileName;
|
||||
this.file = new File(BlockHunt.plugin.getDataFolder(), fileName + ".yml");
|
||||
this.fileLocation = BlockHunt.plugin.getDataFolder();
|
||||
this.fileC = new YamlConfiguration();
|
||||
this.checkFile();
|
||||
this.fileCS = fileC.getConfigurationSection("");
|
||||
this.load();
|
||||
}
|
||||
/**
|
||||
* Use this class to create an automated config file.
|
||||
*
|
||||
* @param fileName
|
||||
* Name of the file.
|
||||
*/
|
||||
public ConfigManager(String fileName) {
|
||||
this.fileName = fileName;
|
||||
this.file = new File(BlockHunt.plugin.getDataFolder(), fileName + ".yml");
|
||||
this.fileLocation = BlockHunt.plugin.getDataFolder();
|
||||
this.fileC = new YamlConfiguration();
|
||||
this.checkFile();
|
||||
this.fileCS = fileC.getConfigurationSection("");
|
||||
this.load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this class to create an automated config file.
|
||||
*
|
||||
* @param fileName
|
||||
* Name of the file.
|
||||
* @param subdirectory
|
||||
* Sub-Location of the file.
|
||||
*/
|
||||
public ConfigManager(String fileName, String subdirectory) {
|
||||
this.fileName = fileName;
|
||||
File directory = new File( BlockHunt.plugin.getDataFolder() , subdirectory );
|
||||
this.file = new File( directory,fileName + ".yml");
|
||||
this.fileLocation = directory;
|
||||
this.fileC = new YamlConfiguration();
|
||||
this.checkFile();
|
||||
this.fileCS = fileC.getConfigurationSection("");
|
||||
this.load();
|
||||
}
|
||||
/**
|
||||
* Use this class to create an automated config file.
|
||||
*
|
||||
* @param fileName
|
||||
* Name of the file.
|
||||
* @param subdirectory
|
||||
* Sub-Location of the file.
|
||||
*/
|
||||
public ConfigManager(String fileName, String subdirectory) {
|
||||
this.fileName = fileName;
|
||||
File directory = new File(BlockHunt.plugin.getDataFolder(), subdirectory);
|
||||
this.file = new File(directory, fileName + ".yml");
|
||||
this.fileLocation = directory;
|
||||
this.fileC = new YamlConfiguration();
|
||||
this.checkFile();
|
||||
this.fileCS = fileC.getConfigurationSection("");
|
||||
this.load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there are new files created if so, display a message to the
|
||||
* console.
|
||||
*/
|
||||
public static void newFiles() {
|
||||
ConfigManager.setDefaults();
|
||||
for (String fileName : MemoryStorage.newFiles) {
|
||||
MessageManager.sendMessage(null, "%TAG%WCouldn't find '%A%fileName%.yml%W'%A creating new one.", "fileName-" + fileName);
|
||||
}
|
||||
/**
|
||||
* Check if there are new files created if so, display a message to the
|
||||
* console.
|
||||
*/
|
||||
public static void newFiles() {
|
||||
ConfigManager.setDefaults();
|
||||
for (String fileName : MemoryStorage.newFiles) {
|
||||
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.
|
||||
*/
|
||||
public static void setDefaults() {
|
||||
for (ConfigC value : ConfigC.values()) {
|
||||
value.config.load();
|
||||
if (value.config.getFile().get(value.location) == null) {
|
||||
value.config.getFile().set(value.location, value.value);
|
||||
value.config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add config settings to the files if they don't exist.
|
||||
*/
|
||||
public static void setDefaults() {
|
||||
for (ConfigC value : ConfigC.values()) {
|
||||
value.config.load();
|
||||
if (value.config.getFile().get(value.location) == null) {
|
||||
value.config.getFile().set(value.location, value.value);
|
||||
value.config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if file exists, if not create one.
|
||||
*/
|
||||
public void checkFile() {
|
||||
if (!this.file.exists()) {
|
||||
try {
|
||||
this.file.getParentFile().mkdirs();
|
||||
this.file.createNewFile();
|
||||
if(file.exists()) {
|
||||
MemoryStorage.newFiles.add(this.fileName);
|
||||
}
|
||||
/**
|
||||
* Check if file exists, if not create one.
|
||||
*/
|
||||
public void checkFile() {
|
||||
if (!this.file.exists()) {
|
||||
try {
|
||||
this.file.getParentFile().mkdirs();
|
||||
this.file.createNewFile();
|
||||
if (file.exists()) {
|
||||
MemoryStorage.newFiles.add(this.fileName);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the file.
|
||||
*/
|
||||
public void save() {
|
||||
try {
|
||||
this.fileC.save(this.file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Save the file.
|
||||
*/
|
||||
public void save() {
|
||||
try {
|
||||
this.fileC.save(this.file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the file.
|
||||
*/
|
||||
public void load() {
|
||||
this.checkFile();
|
||||
if (this.file.exists()) {
|
||||
try {
|
||||
this.fileC.load(this.file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Load the file.
|
||||
*/
|
||||
public void load() {
|
||||
this.checkFile();
|
||||
if (this.file.exists()) {
|
||||
try {
|
||||
this.fileC.load(this.file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the File. Very useful for just loading/saving.
|
||||
*/
|
||||
public FileConfiguration getFile() {
|
||||
return this.fileC;
|
||||
}
|
||||
/**
|
||||
* Get the File. Very useful for just loading/saving.
|
||||
*/
|
||||
public FileConfiguration getFile() {
|
||||
return this.fileC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object from a Config.
|
||||
*
|
||||
* @param location
|
||||
* Config location.
|
||||
* @return Object
|
||||
*/
|
||||
public Object get(ConfigC location) {
|
||||
return this.getFile().get(location.location);
|
||||
}
|
||||
/**
|
||||
* Get object from a Config.
|
||||
*
|
||||
* @param location
|
||||
* Config location.
|
||||
* @return Object
|
||||
*/
|
||||
public Object get(ConfigC 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.MemoryStorage;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MessageManager {
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Send a message to a player. Also replaces the "%player%" variable to the
|
||||
* player's name.
|
||||
*
|
||||
* @param player
|
||||
* The player receiving the message.
|
||||
* @param message
|
||||
* Message which needs to be send to the player.
|
||||
* @param vars
|
||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
public static void sendMessage(Player player, String message, String... vars) {
|
||||
if (player == null) {
|
||||
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. Also replaces the "%player%" variable to the
|
||||
* player's name.
|
||||
*
|
||||
* @param player The player receiving the message.
|
||||
* @param message Message which needs to be send to the player.
|
||||
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
public static void sendMessage(Player player, String message, String... vars) {
|
||||
if (player == null) {
|
||||
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%"
|
||||
* variable to the player's name.
|
||||
*
|
||||
* @param player
|
||||
* The player receiving the message.
|
||||
* @param location
|
||||
* Location in the config of the message being send.
|
||||
* @param vars
|
||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
public static void sendFMessage(Player player, ConfigC location, String... vars) {
|
||||
if (player == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
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 a player from a Config. Also replaces the "%player%"
|
||||
* variable to the player's name.
|
||||
*
|
||||
* @param player The player receiving the message.
|
||||
* @param location Location in the config of the message being send.
|
||||
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
public static void sendFMessage(Player player, ConfigC location, String... vars) {
|
||||
if (player == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
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%"
|
||||
* variable to the player's name.
|
||||
*
|
||||
* @param message
|
||||
* Message which needs to be send to the player.
|
||||
* @param vars
|
||||
* Variables. Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
public static void broadcastMessage(String message, String... vars) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
// String pMessage = message.replaceAll("%player%",
|
||||
// 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. Also replaces the "%player%"
|
||||
* variable to the player's name.
|
||||
*
|
||||
* @param message Message which needs to be send to the player.
|
||||
* @param vars Variables. Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
public static void broadcastMessage(String message, String... vars) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars));
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", "Console"), vars));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to all players online from a Config. Also replaces the
|
||||
* "%player%" variable to the player's name.
|
||||
*
|
||||
* @param location
|
||||
* Location in the config of the message being send.
|
||||
* @param vars
|
||||
* Variables . Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
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));
|
||||
}
|
||||
/**
|
||||
* Send a message to all players online from a Config. Also replaces the
|
||||
* "%player%" variable to the player's name.
|
||||
*
|
||||
* @param location Location in the config of the message being send.
|
||||
* @param vars Variables . Seperated with a - . Ex: "playerName-" +
|
||||
* player.getName();
|
||||
*/
|
||||
public static void broadcastFMessage(ConfigC location, String... vars) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
/**
|
||||
* Replace all variables.
|
||||
*
|
||||
* @param message
|
||||
* Message which needs to be replaced.
|
||||
* @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)));
|
||||
}
|
||||
player.sendMessage(MessageManager.replaceAll(location.config.getFile().get(
|
||||
location.location).toString().replaceAll("%player%", player.getDisplayName()), vars));
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(location.config.getFile().get(
|
||||
location.location).toString().replaceAll("%player%", "Console"), vars));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace default Minecraft colour codes.
|
||||
*
|
||||
* @param message
|
||||
* Message which needs to be replaced.
|
||||
* @return Colour replaced message.
|
||||
*/
|
||||
public static String replaceColours(String message) {
|
||||
return message.replaceAll("(&([a-fk-or0-9]))", "\u00A7$2");
|
||||
}
|
||||
/**
|
||||
* Replace all variables.
|
||||
*
|
||||
* @param message Message which needs to be replaced.
|
||||
* @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 colour codes of this plugin.
|
||||
*
|
||||
* @param message
|
||||
* Message which needs to be replaced.
|
||||
* @return Colour replaced message.
|
||||
*/
|
||||
public static String replaceColourVars(String message) {
|
||||
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 default Minecraft colour codes.
|
||||
*
|
||||
* @param message Message which needs to be replaced.
|
||||
* @return Colour replaced message.
|
||||
*/
|
||||
public static String replaceColours(String message) {
|
||||
return message.replaceAll("(&([a-fk-or0-9]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
/**
|
||||
* Replace colour codes of this plugin.
|
||||
*
|
||||
* @param message Message which needs to be replaced.
|
||||
* @return Colour replaced message.
|
||||
*/
|
||||
public static String replaceColourVars(String message) {
|
||||
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;
|
||||
}
|
||||
|
||||
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() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_normal);
|
||||
}
|
||||
public static class CType {
|
||||
|
||||
public static String WARNING() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_warning);
|
||||
}
|
||||
public static String NORMAL() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_normal);
|
||||
}
|
||||
|
||||
public static String ERROR() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_error);
|
||||
}
|
||||
public static String WARNING() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_warning);
|
||||
}
|
||||
|
||||
public static String ARG() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_arg);
|
||||
}
|
||||
public static String ERROR() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_error);
|
||||
}
|
||||
|
||||
public static String HEADER() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_header);
|
||||
}
|
||||
public static String ARG() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_arg);
|
||||
}
|
||||
|
||||
public static String TAG() {
|
||||
return (String) MemoryStorage.config.get(ConfigC.chat_header) + MemoryStorage.config.get(ConfigC.chat_tag) + MemoryStorage.config.get(ConfigC.chat_normal);
|
||||
}
|
||||
}
|
||||
public static String HEADER() {
|
||||
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.PType;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PermissionsManager {
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check if an player has the permission. Also checks * related permissions.
|
||||
* This permission DOES HAVE TO be registered.
|
||||
*
|
||||
* @param player
|
||||
* The player who needs the permission.
|
||||
* @param perm
|
||||
* The permission.
|
||||
* @param message
|
||||
* Send a message to the player saying you don't have the
|
||||
* permission.
|
||||
* @return True/False when either the player has the permission.
|
||||
*/
|
||||
public static boolean hasPerm(Player player, Permissions perm, Boolean message) {
|
||||
PType type = perm.type;
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Check if an player has the permission. Also checks * related permissions.
|
||||
* This permission DOES HAVE TO be registered.
|
||||
*
|
||||
* @param player The player who needs the permission.
|
||||
* @param perm The permission.
|
||||
* @param message Send a message to the player saying you don't have the
|
||||
* permission.
|
||||
* @return True/False when either the player has the permission.
|
||||
*/
|
||||
public static boolean hasPerm(Player player, Permissions perm, Boolean message) {
|
||||
PType type = perm.type;
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == PType.ALL) {
|
||||
return true;
|
||||
} else if (type == PType.OP) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.ADMIN) {
|
||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.MODERATOR) {
|
||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.PLAYER) {
|
||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (type == PType.ALL) {
|
||||
return true;
|
||||
} else if (type == PType.OP) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.ADMIN) {
|
||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.MODERATOR) {
|
||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.PLAYER) {
|
||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.hasPermission("*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + perm.perm)) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + perm.perm + ".*")) {
|
||||
return true;
|
||||
} else {
|
||||
if (message) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (player.hasPermission("*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + perm.perm)) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + perm.perm + ".*")) {
|
||||
return true;
|
||||
} else {
|
||||
if (message) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an player has the permission. Also checks * related permissions.
|
||||
* This permission does NOT have to be registered.
|
||||
*
|
||||
* @param player
|
||||
* The player who needs the permission.
|
||||
* @param type
|
||||
* Type permission.
|
||||
* @param perm
|
||||
* The permission.
|
||||
* @param message
|
||||
* Send a message to the player saying you don't have the
|
||||
* permission.
|
||||
* @return True/False when either the player has the permission.
|
||||
*/
|
||||
public static boolean hasRawPerm(Player player, PType type, String perm, Boolean message) {
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Check if an player has the permission. Also checks * related permissions.
|
||||
* This permission does NOT have to be registered.
|
||||
*
|
||||
* @param player The player who needs the permission.
|
||||
* @param type Type permission.
|
||||
* @param perm The permission.
|
||||
* @param message Send a message to the player saying you don't have the
|
||||
* permission.
|
||||
* @return True/False when either the player has the permission.
|
||||
*/
|
||||
public static boolean hasRawPerm(Player player, PType type, String perm, Boolean message) {
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == PType.ALL) {
|
||||
return true;
|
||||
} else if (type == PType.OP) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.ADMIN) {
|
||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.MODERATOR) {
|
||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.PLAYER) {
|
||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (type == PType.ALL) {
|
||||
return true;
|
||||
} else if (type == PType.OP) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.ADMIN) {
|
||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.MODERATOR) {
|
||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.PLAYER) {
|
||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.hasPermission("*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
} else if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
} else {
|
||||
if (message) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (player.hasPermission("*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(PermissionsC.main + "*")) {
|
||||
return true;
|
||||
} else if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
} else if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
} else {
|
||||
if (message) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_noPermission);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2,64 +2,63 @@ package nl.Steffion.BlockHunt;
|
||||
|
||||
/**
|
||||
* 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.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.HashMap;
|
||||
import java.util.Map;
|
||||
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 {
|
||||
|
||||
/*
|
||||
* Standard stuff.
|
||||
*/
|
||||
public static ArrayList<String> newFiles = new ArrayList<>();
|
||||
public static ArrayList<CommandManager> commands = new ArrayList<>();
|
||||
/*
|
||||
* Standard stuff.
|
||||
*/
|
||||
public static final ArrayList<String> newFiles = new ArrayList<>();
|
||||
public static final ArrayList<CommandManager> commands = new ArrayList<>();
|
||||
|
||||
/*
|
||||
* If you want another file to be created. Copy and paste this line.
|
||||
*/
|
||||
public static ConfigManager config = new ConfigManager("config");
|
||||
public static ConfigManager messages = new ConfigManager("messages");
|
||||
public static ConfigManager arenas = new ConfigManager("arenas");
|
||||
public static ConfigManager signs = new ConfigManager("signs");
|
||||
public static ConfigManager shop = new ConfigManager("shop");
|
||||
/*
|
||||
* If you want another file to be created. Copy and paste this line.
|
||||
*/
|
||||
public static final ConfigManager config = new ConfigManager("config");
|
||||
public static final ConfigManager messages = new ConfigManager("messages");
|
||||
public static final ConfigManager arenas = new ConfigManager("arenas");
|
||||
public static final ConfigManager signs = new ConfigManager("signs");
|
||||
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 HashMap<Player, Location> pos2 = new HashMap<>();
|
||||
public static final HashMap<Player, Location> pos1 = new HashMap<>();
|
||||
public static final HashMap<Player, Location> pos2 = new HashMap<>();
|
||||
|
||||
public static ArrayList<Arena> arenaList = new ArrayList<>();
|
||||
public static Random random = new Random();
|
||||
public static HashMap<Player, Integer> seekertime = new HashMap<>();
|
||||
public static final ArrayList<Arena> arenaList = new ArrayList<>();
|
||||
public static final Random random = new Random();
|
||||
public static final HashMap<Player, Integer> seekertime = new HashMap<>();
|
||||
|
||||
public static HashMap<Player, PlayerArenaData> pData = new HashMap<>();
|
||||
public static HashMap<Player, ItemStack> choosenBlock = new HashMap<>();
|
||||
public static HashMap<Player, Boolean> choosenSeeker = new HashMap<>();
|
||||
public static final HashMap<Player, PlayerArenaData> pData = new HashMap<>();
|
||||
public static final HashMap<Player, ItemStack> choosenBlock = new HashMap<>();
|
||||
public static final HashMap<Player, Boolean> choosenSeeker = new HashMap<>();
|
||||
|
||||
public static HashMap<Player, ItemStack> pBlock = new HashMap<>();
|
||||
public static HashMap<Player, Location> moveLoc = new HashMap<>();
|
||||
public static HashMap<Player, Location> hiddenLoc = new HashMap<>();
|
||||
public static HashMap<Player, Boolean> hiddenLocWater = new HashMap<>();
|
||||
public static final HashMap<Player, ItemStack> pBlock = new HashMap<>();
|
||||
public static final HashMap<Player, Location> moveLoc = new HashMap<>();
|
||||
public static final HashMap<Player, Location> hiddenLoc = 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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -13,24 +14,24 @@ package nl.Steffion.BlockHunt;
|
||||
public class PermissionsC {
|
||||
|
||||
|
||||
public static String main = BlockHunt.pdfFile.getName().toLowerCase() + ".";
|
||||
public static final String main = BlockHunt.pdfFile.getName().toLowerCase() + ".";
|
||||
|
||||
public enum PType {
|
||||
ALL, PLAYER, MODERATOR, ADMIN, OP
|
||||
}
|
||||
public enum PType {
|
||||
ALL, PLAYER, MODERATOR, ADMIN, OP
|
||||
}
|
||||
|
||||
public enum Permissions {
|
||||
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",
|
||||
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);
|
||||
public enum Permissions {
|
||||
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",
|
||||
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);
|
||||
|
||||
public String perm;
|
||||
public PType type;
|
||||
public final String perm;
|
||||
public final PType type;
|
||||
|
||||
Permissions(String perm, PType type) {
|
||||
this.perm = perm;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
Permissions(String perm, PType type) {
|
||||
this.perm = perm;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,35 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
public class PlayerArenaData {
|
||||
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;
|
||||
import java.util.Collection;
|
||||
|
||||
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;
|
||||
}
|
||||
public class PlayerArenaData {
|
||||
public final GameMode pGameMode;
|
||||
public final ItemStack[] pInventory;
|
||||
public final ItemStack[] pArmor;
|
||||
public final Float pEXP;
|
||||
public final Integer pEXPL;
|
||||
public final Double pMaxHealth;
|
||||
public final Double pHealth;
|
||||
public final Integer pFood;
|
||||
public final Collection<PotionEffect> pPotionEffects;
|
||||
public final boolean 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;
|
||||
|
||||
public class PlayerHandler {
|
||||
public static boolean teleport(Player player, Location location) {
|
||||
MemoryStorage.teleportLoc.put(player, location);
|
||||
return player.teleport(location);
|
||||
}
|
||||
public static boolean teleport(Player player, Location location) {
|
||||
MemoryStorage.teleportLoc.put(player, location);
|
||||
return player.teleport(location);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
@ -11,74 +10,74 @@ import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
public class ScoreboardHandler {
|
||||
public static void createScoreboard(Arena arena) {
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||
Scoreboard board = arena.scoreboard;
|
||||
if (board.getObjective(arena.arenaName) != null) {
|
||||
updateScoreboard(arena);
|
||||
return;
|
||||
}
|
||||
public static void createScoreboard(Arena arena) {
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||
Scoreboard board = arena.scoreboard;
|
||||
if (board.getObjective(arena.arenaName) != null) {
|
||||
updateScoreboard(arena);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
object.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
object.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
|
||||
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
||||
Score timeleft = object.getScore(temp);
|
||||
timeleft.setScore(arena.timer);
|
||||
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||
Score seekers = object.getScore(temp);
|
||||
seekers.setScore(arena.seekers.size());
|
||||
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||
Score hiders = object.getScore(temp);
|
||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||
|
||||
if (arena.gameState == ArenaState.INGAME) {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(board);
|
||||
}
|
||||
} else {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
||||
Score timeleft = object.getScore(temp);
|
||||
timeleft.setScore(arena.timer);
|
||||
|
||||
public static void updateScoreboard(Arena arena) {
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||
Scoreboard board = arena.scoreboard;
|
||||
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
|
||||
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);
|
||||
Score timeleft = object.getScore(temp);
|
||||
timeleft.setScore(arena.timer);
|
||||
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||
Score seekers = object.getScore(temp);
|
||||
seekers.setScore(arena.seekers.size());
|
||||
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||
Score hiders = object.getScore(temp);
|
||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||
|
||||
if (arena.gameState == ArenaState.INGAME) {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(board);
|
||||
}
|
||||
} else {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||
Score seekers = object.getScore(temp);
|
||||
seekers.setScore(arena.seekers.size());
|
||||
|
||||
public static void removeScoreboard(Player player) {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||
Score hiders = object.getScore(temp);
|
||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||
|
||||
if (arena.gameState == ArenaState.INGAME) {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(board);
|
||||
}
|
||||
} else {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateScoreboard(Arena arena) {
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||
Scoreboard board = arena.scoreboard;
|
||||
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
|
||||
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);
|
||||
Score timeleft = object.getScore(temp);
|
||||
timeleft.setScore(arena.timer);
|
||||
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||
Score seekers = object.getScore(temp);
|
||||
seekers.setScore(arena.seekers.size());
|
||||
|
||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||
Score hiders = object.getScore(temp);
|
||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||
|
||||
if (arena.gameState == ArenaState.INGAME) {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(board);
|
||||
}
|
||||
} else {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeScoreboard(Player player) {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
||||
|
@ -1,185 +1,184 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SignsHandler {
|
||||
|
||||
public static void createSign(SignChangeEvent event, String[] lines, Location location) {
|
||||
if (lines[1] != null) {
|
||||
if (lines[1].equalsIgnoreCase("leave")) {
|
||||
boolean saved = false;
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get("leave_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set("leave_" + number + ".arenaName", "leave");
|
||||
MemoryStorage.signs.getFile().set("leave_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
public static void createSign(SignChangeEvent event, String[] lines, Location location) {
|
||||
if (lines[1] != null) {
|
||||
if (lines[1].equalsIgnoreCase("leave")) {
|
||||
boolean saved = false;
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get("leave_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set("leave_" + number + ".arenaName", "leave");
|
||||
MemoryStorage.signs.getFile().set("leave_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
} else if (lines[1].equalsIgnoreCase("shop")) {
|
||||
boolean saved = false;
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get("shop_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set("shop_" + number + ".arenaName", "shop");
|
||||
MemoryStorage.signs.getFile().set("shop_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
} else if (lines[1].equalsIgnoreCase("shop")) {
|
||||
boolean saved = false;
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get("shop_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set("shop_" + number + ".arenaName", "shop");
|
||||
MemoryStorage.signs.getFile().set("shop_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean saved = false;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (lines[1].equals(arena.arenaName)) {
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
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 + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean saved = false;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (lines[1].equals(arena.arenaName)) {
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
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 + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!saved) {
|
||||
MessageManager.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!saved) {
|
||||
MessageManager.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeSign(Location location) {
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc.equals(location)) {
|
||||
MemoryStorage.signs.getFile().set(sign, null);
|
||||
MemoryStorage.signs.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void removeSign(Location location) {
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc.equals(location)) {
|
||||
MemoryStorage.signs.getFile().set(sign, null);
|
||||
MemoryStorage.signs.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSign(Location location) {
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc.equals(location)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public static boolean isSign(Location location) {
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc.equals(location)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void updateSigns() {
|
||||
MemoryStorage.signs.load();
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
public static void updateSigns() {
|
||||
MemoryStorage.signs.load();
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
|
||||
// check if that area is actually loaded. If not move on.
|
||||
if (loc.getWorld().isChunkLoaded(loc.getBlockX() >> 4, loc.getBlockZ() >> 4)) {
|
||||
if (loc.getBlock().getState() instanceof Sign) {
|
||||
Sign signblock = (Sign) loc.getBlock().getState();
|
||||
String[] lines = signblock.getLines();
|
||||
if (sign.contains("leave")) {
|
||||
// check if that area is actually loaded. If not move on.
|
||||
if (loc.getWorld().isChunkLoaded(loc.getBlockX() >> 4, loc.getBlockZ() >> 4)) {
|
||||
if (loc.getBlock().getState() instanceof Sign) {
|
||||
Sign signblock = (Sign) loc.getBlock().getState();
|
||||
String[] lines = signblock.getLines();
|
||||
if (sign.contains("leave")) {
|
||||
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location);
|
||||
int linecount = 0;
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||
}
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location);
|
||||
int linecount = 0;
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
signblock.update();
|
||||
} else if (sign.contains("shop")) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location);
|
||||
int linecount = 0;
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||
}
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
signblock.update();
|
||||
} else if (sign.contains("shop")) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location);
|
||||
int linecount = 0;
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
signblock.update();
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (lines[1].endsWith(arena.arenaName)) {
|
||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_WAITING.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
signblock.update();
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (lines[1].endsWith(arena.arenaName)) {
|
||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_WAITING.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_STARTING.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_STARTING.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
} else if (arena.gameState.equals(ArenaState.INGAME)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_INGAME.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
} else if (arena.gameState.equals(ArenaState.INGAME)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_INGAME.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
removeSign(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
removeSign(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -16,47 +15,47 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SolidBlockHandler {
|
||||
|
||||
public static void makePlayerUnsolid(Player player) {
|
||||
ItemStack block = player.getInventory().getItem(8);
|
||||
if (block == null) {
|
||||
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!");
|
||||
return;
|
||||
}
|
||||
|
||||
Block pBlock = player.getLocation().getBlock();
|
||||
public static void makePlayerUnsolid(Player player) {
|
||||
ItemStack block = player.getInventory().getItem(8);
|
||||
if (block == null) {
|
||||
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!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
||||
pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
||||
}
|
||||
Block pBlock = player.getLocation().getBlock();
|
||||
|
||||
block.setAmount(5);
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||
if (!pl.equals(player)) {
|
||||
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
||||
} else {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||
}
|
||||
} else {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||
}
|
||||
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
||||
pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
||||
}
|
||||
|
||||
MemoryStorage.hiddenLocWater.remove(player);
|
||||
}
|
||||
}
|
||||
block.setAmount(5);
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||
if (!pl.equals(player)) {
|
||||
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
||||
} else {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||
}
|
||||
} else {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_BAT_HURT, 1, 1);
|
||||
block.removeEnchantment(Enchantment.DURABILITY);
|
||||
MemoryStorage.hiddenLocWater.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
for (Player playerShow : Bukkit.getOnlinePlayers()) {
|
||||
playerShow.showPlayer(BlockHunt.plugin, player);
|
||||
}
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_BAT_HURT, 1, 1);
|
||||
block.removeEnchantment(Enchantment.DURABILITY);
|
||||
|
||||
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType());
|
||||
DisguiseAPI.disguiseToAll(player, disguise);
|
||||
for (Player playerShow : Bukkit.getOnlinePlayers()) {
|
||||
playerShow.showPlayer(BlockHunt.plugin, player);
|
||||
}
|
||||
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid);
|
||||
}
|
||||
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType());
|
||||
DisguiseAPI.disguiseToAll(player, disguise);
|
||||
|
||||
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-disabledPlugin: '%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.'
|
||||
info: '%NDisplays the plugin''s info.'
|
||||
help: '%NShows a list of commands.'
|
||||
reload: '%NReloads all configs.'
|
||||
join: '%NJoins a BlockHunt game.'
|
||||
leave: '%NLeave a BlockHunt game.'
|
||||
list: '%NShows a list of available arenas.'
|
||||
shop: '%NOpens the BlockHunt shop.'
|
||||
start: '%NForces an arena to start.'
|
||||
wand: '%NGives you the wand selection tool.'
|
||||
create: '%NCreates an arena from your selection.'
|
||||
set: '%NOpens a panel to set settings.'
|
||||
setwarp: '%NSets warps for your arena.'
|
||||
remove: '%NDeletes an Arena.'
|
||||
tokens: '%NChange someones tokens.'
|
||||
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.'
|
||||
info:'%NDisplays the plugin''s info.'
|
||||
help:'%NShows a list of commands.'
|
||||
reload:'%NReloads all configs.'
|
||||
join:'%NJoins a BlockHunt game.'
|
||||
leave:'%NLeave a BlockHunt game.'
|
||||
list:'%NShows a list of available arenas.'
|
||||
shop:'%NOpens the BlockHunt shop.'
|
||||
start:'%NForces an arena to start.'
|
||||
wand:'%NGives you the wand selection tool.'
|
||||
create:'%NCreates an arena from your selection.'
|
||||
set:'%NOpens a panel to set settings.'
|
||||
setwarp:'%NSets warps for your arena.'
|
||||
remove:'%NDeletes an Arena.'
|
||||
tokens:'%NChange someones tokens.'
|
||||
#buttons
|
||||
button-add: '%NAdd %A%1%%N to %A%2%%N'
|
||||
button-add2: Add
|
||||
button-setting: '%NSetting %A%1%%N is now: %A%2%%N.'
|
||||
button-remove: '%NRemove %A%1%%N from %A%2%%N'
|
||||
button-remove2: Remove
|
||||
button-add:'%NAdd %A%1%%N to %A%2%%N'
|
||||
button-add2:Add
|
||||
button-setting:'%NSetting %A%1%%N is now: %A%2%%N.'
|
||||
button-remove:'%NRemove %A%1%%N from %A%2%%N'
|
||||
button-remove2:Remove
|
||||
#Normal
|
||||
reloadedConfigs: '%TAG&aReloaded all configs!'
|
||||
joinJoinedArena: '%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
||||
leaveYouLeft: '%TAG%NYou left the arena! Thanks for playing!'
|
||||
leaveLeftArena: '%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
||||
startForced: '%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
||||
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).'
|
||||
createCreatedArena: '%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
||||
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!'
|
||||
ingameSeekerChoosen: '%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
||||
ingameBlock: '%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
||||
ingameArenaEnd: '%TAG%NThe arena will end in %A%1%%N second(s)!'
|
||||
ingameSeekerSpawned: '%TAG%A%playername%%N has spawned as a seeker!'
|
||||
ingameGivenSword: '%TAG%NYou were given a sword!'
|
||||
ingameHiderDied: '%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
||||
ingameHidersLeft: '%NHider(s) left: %A%left%%N'
|
||||
ingameSeekerDied: '%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
||||
winSeekers: '%TAG%NThe %ASEEKERS%N have won!'
|
||||
winHiders: '%TAG%NThe %AHIDERS%N have won!'
|
||||
setwarpWarpSet: '%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
||||
addedToken: '%TAG%A%amount%%N tokens were added to your account!'
|
||||
removeRemovedArena: '%TAG%NRemoved arena ''%A%name%%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.'
|
||||
ingameNowSolid: '%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
||||
ingameNoMoreSolid: '%TAG%NYou''re no longer a solid block!'
|
||||
shopBoughtItem: '%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
||||
shopChoosenBlock: '%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
||||
shopChoosenSeeker: '%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
||||
shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!'
|
||||
ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N'
|
||||
|
||||
reloadedConfigs:'%TAG&aReloaded all configs!'
|
||||
joinJoinedArena:'%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
||||
leaveYouLeft:'%TAG%NYou left the arena! Thanks for playing!'
|
||||
leaveLeftArena:'%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
||||
startForced:'%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
||||
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).'
|
||||
createCreatedArena:'%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
||||
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!'
|
||||
ingameSeekerChoosen:'%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
||||
ingameBlock:'%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
||||
ingameArenaEnd:'%TAG%NThe arena will end in %A%1%%N second(s)!'
|
||||
ingameSeekerSpawned:'%TAG%A%playername%%N has spawned as a seeker!'
|
||||
ingameGivenSword:'%TAG%NYou were given a sword!'
|
||||
ingameHiderDied:'%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
||||
ingameHidersLeft:'%NHider(s) left: %A%left%%N'
|
||||
ingameSeekerDied:'%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
||||
winSeekers:'%TAG%NThe %ASEEKERS%N have won!'
|
||||
winHiders:'%TAG%NThe %AHIDERS%N have won!'
|
||||
setwarpWarpSet:'%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
||||
addedToken:'%TAG%A%amount%%N tokens were added to your account!'
|
||||
removeRemovedArena:'%TAG%NRemoved arena ''%A%name%%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.'
|
||||
ingameNowSolid:'%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
||||
ingameNoMoreSolid:'%TAG%NYou''re no longer a solid block!'
|
||||
shopBoughtItem:'%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
||||
shopChoosenBlock:'%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
||||
shopChoosenSeeker:'%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
||||
shopChoosenHiders:'%TAG%NYou''ve choosen to be a %Ahider%N!'
|
||||
ingameBlocksLeft:'%TAG%NRemaining blocks: %A%1%%N'
|
||||
# Warnings
|
||||
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!'
|
||||
unableToCommand: '%TAG%WSorry but that command is disabled in the arena.'
|
||||
ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!'
|
||||
arenaStopped: '%TAG%WThe arena has been forced to stop!'
|
||||
|
||||
error-noPermission: '%TAG%EYou don''t have the permissions to do that!'
|
||||
error-notANumber: '%TAG%E''%A%1%%E'' is not a number!'
|
||||
error-commandNotEnabled: '%TAG%EThis command has been disabled!'
|
||||
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-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-noArena: '%TAG%ENo arena found with the name ''%A%name%%E''.'
|
||||
error-onlyIngame: '%TAG%EThis is an only in-game command!'
|
||||
error-joinAlreadyJoined: '%TAG%EYou''ve already joined an arena!'
|
||||
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-joinArenaIngame: '%TAG%EThis game has already started.'
|
||||
error-joinFull: '%TAG%EUnable to join this arena. It''s full!'
|
||||
error-joinInventoryNotEmpty: '%TAG%EYour inventory should be empty before joining!'
|
||||
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-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-setTooLowNumber: '%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
||||
error-setNotABlock: '%TAG%EThat is not a block!'
|
||||
error-setwarpWarpNotFound: '%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
||||
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-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-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||
error-teleportFailed: '%TAG%EUnable to teleport you into the arena.'
|
||||
error-teleportBlocked: '%TAG%EYou cannot teleport while playing!'
|
||||
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!'
|
||||
unableToCommand:'%TAG%WSorry but that command is disabled in the arena.'
|
||||
ingameNoSolidPlace:'%TAG%WThat''s not a valid place to become solid!'
|
||||
arenaStopped:'%TAG%WThe arena has been forced to stop!'
|
||||
error-noPermission:'%TAG%EYou don''t have the permissions to do that!'
|
||||
error-notANumber:'%TAG%E''%A%1%%E'' is not a number!'
|
||||
error-commandNotEnabled:'%TAG%EThis command has been disabled!'
|
||||
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-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-noArena:'%TAG%ENo arena found with the name ''%A%name%%E''.'
|
||||
error-onlyIngame:'%TAG%EThis is an only in-game command!'
|
||||
error-joinAlreadyJoined:'%TAG%EYou''ve already joined an arena!'
|
||||
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-joinArenaIngame:'%TAG%EThis game has already started.'
|
||||
error-joinFull:'%TAG%EUnable to join this arena. It''s full!'
|
||||
error-joinInventoryNotEmpty:'%TAG%EYour inventory should be empty before joining!'
|
||||
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-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-setTooLowNumber:'%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
||||
error-setNotABlock:'%TAG%EThat is not a block!'
|
||||
error-setwarpWarpNotFound:'%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
||||
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-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-shopMaxHidersReached:'%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||
error-teleportFailed:'%TAG%EUnable to teleport you into the arena.'
|
||||
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-disabledPlugin: '%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%authors%%N.'
|
||||
info: '%NDisplays the plugin''s info.'
|
||||
help: '%NShows a list of commands.'
|
||||
reload: '%NReloads all configs.'
|
||||
join: '%NJoins a BlockHunt game.'
|
||||
leave: '%NLeave a BlockHunt game.'
|
||||
list: '%NShows a list of available arenas.'
|
||||
shop: '%NOpens the BlockHunt shop.'
|
||||
start: '%NForces an arena to start.'
|
||||
wand: '%NGives you the wand selection tool.'
|
||||
create: '%NCreates an arena from your selection.'
|
||||
set: '%NOpens a panel to set settings.'
|
||||
setwarp: '%NSets warps for your arena.'
|
||||
remove: '%NDeletes an Arena.'
|
||||
tokens: '%NChange someones tokens.'
|
||||
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.'
|
||||
info:'%NDisplays the plugin''s info.'
|
||||
help:'%NShows a list of commands.'
|
||||
reload:'%NReloads all configs.'
|
||||
join:'%NJoins a BlockHunt game.'
|
||||
leave:'%NLeave a BlockHunt game.'
|
||||
list:'%NShows a list of available arenas.'
|
||||
shop:'%NOpens the BlockHunt shop.'
|
||||
start:'%NForces an arena to start.'
|
||||
wand:'%NGives you the wand selection tool.'
|
||||
create:'%NCreates an arena from your selection.'
|
||||
set:'%NOpens a panel to set settings.'
|
||||
setwarp:'%NSets warps for your arena.'
|
||||
remove:'%NDeletes an Arena.'
|
||||
tokens:'%NChange someones tokens.'
|
||||
#buttons
|
||||
button-add: '%NAdd %A%1%%N to %A%2%%N'
|
||||
button-add2: Add
|
||||
button-setting: '%NSetting %A%1%%N is now: %A%2%%N.'
|
||||
button-remove: '%NRemove %A%1%%N from %A%2%%N'
|
||||
button-remove2: Remove
|
||||
button-add:'%NAdd %A%1%%N to %A%2%%N'
|
||||
button-add2:Add
|
||||
button-setting:'%NSetting %A%1%%N is now: %A%2%%N.'
|
||||
button-remove:'%NRemove %A%1%%N from %A%2%%N'
|
||||
button-remove2:Remove
|
||||
#Normal
|
||||
reloadedConfigs: '%TAG&aReloaded all configs!'
|
||||
joinJoinedArena: '%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
||||
leaveYouLeft: '%TAG%NYou left the arena! Thanks for playing!'
|
||||
leaveLeftArena: '%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
||||
startForced: '%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
||||
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).'
|
||||
createCreatedArena: '%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
||||
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!'
|
||||
ingameSeekerChoosen: '%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
||||
ingameBlock: '%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
||||
ingameArenaEnd: '%TAG%NThe arena will end in %A%1%%N second(s)!'
|
||||
ingameSeekerSpawned: '%TAG%A%playername%%N has spawned as a seeker!'
|
||||
ingameGivenSword: '%TAG%NYou were given a sword!'
|
||||
ingameHiderDied: '%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
||||
ingameHidersLeft: '%NHider(s) left: %A%left%%N'
|
||||
ingameSeekerDied: '%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
||||
winSeekers: '%TAG%NThe %ASEEKERS%N have won!'
|
||||
winHiders: '%TAG%NThe %AHIDERS%N have won!'
|
||||
setwarpWarpSet: '%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
||||
addedToken: '%TAG%A%amount%%N tokens were added to your account!'
|
||||
removeRemovedArena: '%TAG%NRemoved arena ''%A%name%%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.'
|
||||
ingameNowSolid: '%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
||||
ingameNoMoreSolid: '%TAG%NYou''re no longer a solid block!'
|
||||
shopBoughtItem: '%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
||||
shopChoosenBlock: '%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
||||
shopChoosenSeeker: '%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
||||
shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!'
|
||||
ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N'
|
||||
|
||||
reloadedConfigs:'%TAG&aReloaded all configs!'
|
||||
joinJoinedArena:'%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)'
|
||||
leaveYouLeft:'%TAG%NYou left the arena! Thanks for playing!'
|
||||
leaveLeftArena:'%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)'
|
||||
startForced:'%TAG%NYou forced to start arena ''%A%arenaname%%N''!'
|
||||
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).'
|
||||
createCreatedArena:'%TAG%NCreated an arena with the name ''%A%name%%N''.'
|
||||
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!'
|
||||
ingameSeekerChoosen:'%TAG%NPlayer %A%seeker%%N has been choosen as seeker!'
|
||||
ingameBlock:'%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.'
|
||||
ingameArenaEnd:'%TAG%NThe arena will end in %A%1%%N second(s)!'
|
||||
ingameSeekerSpawned:'%TAG%A%playername%%N has spawned as a seeker!'
|
||||
ingameGivenSword:'%TAG%NYou were given a sword!'
|
||||
ingameHiderDied:'%TAG%NHider %A%playername%%N was killed by %A%killer%%N!'
|
||||
ingameHidersLeft:'%NHider(s) left: %A%left%%N'
|
||||
ingameSeekerDied:'%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!'
|
||||
winSeekers:'%TAG%NThe %ASEEKERS%N have won!'
|
||||
winHiders:'%TAG%NThe %AHIDERS%N have won!'
|
||||
setwarpWarpSet:'%TAG%NSet warp ''%A%warp%%N'' to your location!'
|
||||
addedToken:'%TAG%A%amount%%N tokens were added to your account!'
|
||||
removeRemovedArena:'%TAG%NRemoved arena ''%A%name%%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.'
|
||||
ingameNowSolid:'%TAG%NYou''re now a solid ''%A%block%%N'' block!'
|
||||
ingameNoMoreSolid:'%TAG%NYou''re no longer a solid block!'
|
||||
shopBoughtItem:'%TAG%NYou''ve bought the ''%A%itemname%%N'' item!'
|
||||
shopChoosenBlock:'%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!'
|
||||
shopChoosenSeeker:'%TAG%NYou''ve choosen to be a %Aseeker%N!'
|
||||
shopChoosenHiders:'%TAG%NYou''ve choosen to be a %Ahider%N!'
|
||||
ingameBlocksLeft:'%TAG%NRemaining blocks: %A%1%%N'
|
||||
# Warnings
|
||||
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!'
|
||||
unableToCommand: '%TAG%WSorry but that command is disabled in the arena.'
|
||||
ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!'
|
||||
arenaStopped: '%TAG%WThe arena has been forced to stop!'
|
||||
|
||||
error-noPermission: '%TAG%EYou don''t have the permissions to do that!'
|
||||
error-notANumber: '%TAG%E''%A%1%%E'' is not a number!'
|
||||
error-commandNotEnabled: '%TAG%EThis command has been disabled!'
|
||||
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-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-noArena: '%TAG%ENo arena found with the name ''%A%name%%E''.'
|
||||
error-onlyIngame: '%TAG%EThis is an only in-game command!'
|
||||
error-joinAlreadyJoined: '%TAG%EYou''ve already joined an arena!'
|
||||
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-joinArenaIngame: '%TAG%EThis game has already started.'
|
||||
error-joinFull: '%TAG%EUnable to join this arena. It''s full!'
|
||||
error-joinInventoryNotEmpty: '%TAG%EYour inventory should be empty before joining!'
|
||||
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-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-setTooLowNumber: '%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
||||
error-setNotABlock: '%TAG%EThat is not a block!'
|
||||
error-setwarpWarpNotFound: '%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
||||
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-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-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||
error-teleportFailed: '%TAG%EUnable to teleport you into the arena.'
|
||||
error-teleportBlocked: '%TAG%EYou cannot teleport while playing!'
|
||||
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!'
|
||||
unableToCommand:'%TAG%WSorry but that command is disabled in the arena.'
|
||||
ingameNoSolidPlace:'%TAG%WThat''s not a valid place to become solid!'
|
||||
arenaStopped:'%TAG%WThe arena has been forced to stop!'
|
||||
error-noPermission:'%TAG%EYou don''t have the permissions to do that!'
|
||||
error-notANumber:'%TAG%E''%A%1%%E'' is not a number!'
|
||||
error-commandNotEnabled:'%TAG%EThis command has been disabled!'
|
||||
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-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-noArena:'%TAG%ENo arena found with the name ''%A%name%%E''.'
|
||||
error-onlyIngame:'%TAG%EThis is an only in-game command!'
|
||||
error-joinAlreadyJoined:'%TAG%EYou''ve already joined an arena!'
|
||||
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-joinArenaIngame:'%TAG%EThis game has already started.'
|
||||
error-joinFull:'%TAG%EUnable to join this arena. It''s full!'
|
||||
error-joinInventoryNotEmpty:'%TAG%EYour inventory should be empty before joining!'
|
||||
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-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-setTooLowNumber:'%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.'
|
||||
error-setNotABlock:'%TAG%EThat is not a block!'
|
||||
error-setwarpWarpNotFound:'%TAG%EWarp ''%A%warp%%E'' is not valid!'
|
||||
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-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-shopMaxHidersReached:'%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||
error-teleportFailed:'%TAG%EUnable to teleport you into the arena.'
|
||||
error-teleportBlocked:'%TAG%EYou cannot teleport while playing!'
|
||||
|
@ -5,19 +5,19 @@ api-version: ${spigot.api.version}
|
||||
authors:
|
||||
- Steffion
|
||||
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
|
||||
commands:
|
||||
BlockHunt:
|
||||
usage: /<command>
|
||||
description: N/A
|
||||
aliases:
|
||||
- bh
|
||||
- prophunt
|
||||
- ph
|
||||
- hideandseek
|
||||
- has
|
||||
- hs
|
||||
- seekandfind
|
||||
- saf
|
||||
- sf
|
||||
- bh
|
||||
- prophunt
|
||||
- ph
|
||||
- hideandseek
|
||||
- has
|
||||
- hs
|
||||
- seekandfind
|
||||
- saf
|
||||
- sf
|
@ -13,7 +13,7 @@ TestArena:
|
||||
pitch: 4.19999
|
||||
yaw: -182.09694
|
||||
hidersTakeFallDamage: false
|
||||
seekersWinCommands: []
|
||||
seekersWinCommands: [ ]
|
||||
killTokens: 0
|
||||
gameTime: 660
|
||||
hidersWarp:
|
||||
@ -28,7 +28,7 @@ TestArena:
|
||||
seekersTakeFallDamage: false
|
||||
hidersCanHurtHiders: false
|
||||
maxPlayers: 40
|
||||
hidersWinCommands: []
|
||||
hidersWinCommands: [ ]
|
||||
timeInLobbyUntilStart: 50
|
||||
minPlayers: 5
|
||||
timeUntilHidersSword: 0
|
||||
@ -40,7 +40,7 @@ TestArena:
|
||||
z: -130.5
|
||||
pitch: 4.200027
|
||||
yaw: 41.700073
|
||||
allowedCommands: []
|
||||
allowedCommands: [ ]
|
||||
amountSeekersOnStart: 1
|
||||
pos1:
|
||||
==: org.bukkit.Location
|
||||
|
Loading…
Reference in New Issue
Block a user