mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-17 21:02:12 +01:00
commit
68f6b19cd5
@ -45,7 +45,7 @@ If you want to learn how to use DungeonsXL step by step, please have a look at t
|
|||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
### Server
|
### Server
|
||||||
DungeonsXL works with Spigot 1.8 and higher. However, support for 1.14 / 1.13 has a higher priority than support for 1.8-1.12. Old builds that support older versions are unusable for production environments. See [here](../../wiki/legacy-support) for detailed information. DungeonsXL only works with Spigot and does not support CraftBukkit builds.
|
DungeonsXL works with Spigot 1.8 and higher. However, support for 1.15 / 1.14 / 1.13 has a higher priority than support for 1.8-1.12. Old builds that support older versions are unusable for production environments. See [here](../../wiki/legacy-support) for detailed information. DungeonsXL only works with Spigot and does not support CraftBukkit builds.
|
||||||
|
|
||||||
### Building information and dependencies
|
### Building information and dependencies
|
||||||
Building DungeonsXL from source requires [Apache Maven](https://maven.apache.org/).
|
Building DungeonsXL from source requires [Apache Maven](https://maven.apache.org/).
|
||||||
@ -67,7 +67,6 @@ Make sure that your server uses Java 8 or higher.
|
|||||||
Supported.
|
Supported.
|
||||||
|
|
||||||
### Known incompatibilities
|
### Known incompatibilities
|
||||||
* Towny
|
|
||||||
* Corpses
|
* Corpses
|
||||||
* PerWorldInventory
|
* PerWorldInventory
|
||||||
|
|
||||||
|
26
adapter/pom.xml
Normal file
26
adapter/pom.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<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>de.erethon.dungeonsxl</groupId>
|
||||||
|
<artifactId>dungeonsxl-adapter</artifactId>
|
||||||
|
<version>0.18-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<parent>
|
||||||
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
|
<artifactId>dungeonsxl-parent</artifactId>
|
||||||
|
<version>0.18-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
|
<artifactId>dungeonsxl-api</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>${spigotVersion.latest}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.erethon.dungeonsxl.adapter.block;
|
package de.erethon.dungeonsxl.adapter.block;
|
||||||
|
|
||||||
import de.erethon.dungeonsxl.util.DColor;
|
import de.erethon.dungeonsxl.api.player.PlayerGroup.Color;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ public interface BlockAdapter {
|
|||||||
|
|
||||||
void openDoor(Block block);
|
void openDoor(Block block);
|
||||||
|
|
||||||
void setBlockWoolColor(Block block, DColor color);
|
void setBlockWoolColor(Block block, Color color);
|
||||||
|
|
||||||
BlockFace getFacing(Block block);
|
BlockFace getFacing(Block block);
|
||||||
|
|
165
api/LICENSE
Normal file
165
api/LICENSE
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
18
api/pom.xml
18
api/pom.xml
@ -9,6 +9,24 @@
|
|||||||
<artifactId>dungeonsxl-parent</artifactId>
|
<artifactId>dungeonsxl-parent</artifactId>
|
||||||
<version>0.18-SNAPSHOT</version>
|
<version>0.18-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>javadoc</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
|
289
api/src/main/java/de/erethon/dungeonsxl/api/DungeonsAPI.java
Normal file
289
api/src/main/java/de/erethon/dungeonsxl/api/DungeonsAPI.java
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.mob.ExMob;
|
||||||
|
import de.erethon.commons.misc.Registry;
|
||||||
|
import de.erethon.dungeonsxl.api.dungeon.Dungeon;
|
||||||
|
import de.erethon.dungeonsxl.api.dungeon.Game;
|
||||||
|
import de.erethon.dungeonsxl.api.dungeon.GameRule;
|
||||||
|
import de.erethon.dungeonsxl.api.mob.DungeonMob;
|
||||||
|
import de.erethon.dungeonsxl.api.mob.ExternalMobProvider;
|
||||||
|
import de.erethon.dungeonsxl.api.player.GlobalPlayer;
|
||||||
|
import de.erethon.dungeonsxl.api.player.GroupAdapter;
|
||||||
|
import de.erethon.dungeonsxl.api.player.PlayerClass;
|
||||||
|
import de.erethon.dungeonsxl.api.player.PlayerGroup;
|
||||||
|
import de.erethon.dungeonsxl.api.sign.DungeonSign;
|
||||||
|
import de.erethon.dungeonsxl.api.world.EditWorld;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
||||||
|
import de.erethon.dungeonsxl.api.world.ResourceWorld;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The API main interface.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface DungeonsAPI extends Plugin {
|
||||||
|
|
||||||
|
static final File PLUGIN_ROOT = new File("plugins/DungeonsXL");
|
||||||
|
static final File BACKUPS = new File(PLUGIN_ROOT, "backups");
|
||||||
|
static final File LANGUAGES = new File(PLUGIN_ROOT, "languages");
|
||||||
|
static final File MAPS = new File(PLUGIN_ROOT, "maps");
|
||||||
|
static final File PLAYERS = new File(PLUGIN_ROOT, "players");
|
||||||
|
static final File SCRIPTS = new File(PLUGIN_ROOT, "scripts");
|
||||||
|
static final File ANNOUNCERS = new File(SCRIPTS, "announcers");
|
||||||
|
static final File CLASSES = new File(SCRIPTS, "classes");
|
||||||
|
static final File DUNGEONS = new File(SCRIPTS, "dungeons");
|
||||||
|
static final File SIGNS = new File(SCRIPTS, "signs");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a cache of player wrapper objects.
|
||||||
|
*
|
||||||
|
* @return a cache of player wrapper objects
|
||||||
|
*/
|
||||||
|
Registry<UUID, GlobalPlayer> getPlayerCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the loaded classes.
|
||||||
|
*
|
||||||
|
* @return a registry of the loaded classes
|
||||||
|
*/
|
||||||
|
Registry<String, PlayerClass> getClassRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the sign types.
|
||||||
|
*
|
||||||
|
* @return a registry of the sign types
|
||||||
|
*/
|
||||||
|
Registry<String, Class<? extends DungeonSign>> getSignRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the trigger types.
|
||||||
|
*
|
||||||
|
* @return a registry of the trigger types
|
||||||
|
* @deprecated stub
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
Registry<String, Class<? extends Trigger>> getTriggerRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the requirement types.
|
||||||
|
*
|
||||||
|
* @return a registry of the requirement types
|
||||||
|
*/
|
||||||
|
Registry<String, Class<? extends Requirement>> getRequirementRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the reward types.
|
||||||
|
*
|
||||||
|
* @return a registry of the reward types
|
||||||
|
*/
|
||||||
|
Registry<String, Class<? extends Reward>> getRewardRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the dungeons.
|
||||||
|
*
|
||||||
|
* @return a registry of the dungeons
|
||||||
|
*/
|
||||||
|
Registry<String, Dungeon> getDungeonRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the resources worlds.
|
||||||
|
*
|
||||||
|
* @return a registry of the resources worlds
|
||||||
|
*/
|
||||||
|
Registry<String, ResourceWorld> getMapRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the instance worlds.
|
||||||
|
*
|
||||||
|
* @return a registry of the instance worlds
|
||||||
|
*/
|
||||||
|
Registry<Integer, InstanceWorld> getInstanceRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the game rules.
|
||||||
|
*
|
||||||
|
* @return a registry of the game rules
|
||||||
|
*/
|
||||||
|
Registry<String, GameRule> getGameRuleRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registry of the external mob providers.
|
||||||
|
*
|
||||||
|
* @return a registry of the external mob providers
|
||||||
|
*/
|
||||||
|
Registry<String, ExternalMobProvider> getExternalMobProviderRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes DungeonsXL track external group and synchronize them with its own groups.
|
||||||
|
*
|
||||||
|
* @param groupAdapter the group adapter to register
|
||||||
|
*/
|
||||||
|
void registerGroupAdapter(GroupAdapter groupAdapter);
|
||||||
|
|
||||||
|
/* Object initialization */
|
||||||
|
/**
|
||||||
|
* Creates a new group.
|
||||||
|
*
|
||||||
|
* @param leader the leader
|
||||||
|
* @return a new group
|
||||||
|
*/
|
||||||
|
PlayerGroup createGroup(Player leader);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new group.
|
||||||
|
*
|
||||||
|
* @param leader the leader
|
||||||
|
* @param color the color that represents the group and sets the name
|
||||||
|
* @return a new group or null if values are invalid
|
||||||
|
*/
|
||||||
|
PlayerGroup createGroup(Player leader, PlayerGroup.Color color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new group.
|
||||||
|
*
|
||||||
|
* @param leader the leader
|
||||||
|
* @param name the group's name - must be unique
|
||||||
|
* @return a new group or null if values are invalid
|
||||||
|
*/
|
||||||
|
PlayerGroup createGroup(Player leader, String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new group.
|
||||||
|
*
|
||||||
|
* @param leader the leader
|
||||||
|
* @param dungeon the dungeon to play
|
||||||
|
* @return a new group or null if values are invalid
|
||||||
|
*/
|
||||||
|
PlayerGroup createGroup(Player leader, Dungeon dungeon);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new group.
|
||||||
|
*
|
||||||
|
* @param leader the leader
|
||||||
|
* @param members the group members with or without the leader
|
||||||
|
* @param name the name of the group
|
||||||
|
* @param dungeon the dungeon to play
|
||||||
|
* @return a new group or null if values are invalid
|
||||||
|
*/
|
||||||
|
PlayerGroup createGroup(Player leader, Collection<Player> members, String name, Dungeon dungeon);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @param triggerId the identifier used in mob triggers
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld, String triggerId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @param type the ExMob type of the entity
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld, ExMob type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @param type the ExMob type of the entity
|
||||||
|
* @param triggerId the identifier used in mob triggers
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld, ExMob type, String triggerId);
|
||||||
|
|
||||||
|
/* Getters */
|
||||||
|
/**
|
||||||
|
* Returns an existing {@link DungeonMob} object that wraps the given {@link LivingEntity} object or null if none exists.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @return an existing {@link DungeonMob} object that wraps the given {@link LivingEntity} object or null if none exists
|
||||||
|
*/
|
||||||
|
DungeonMob getDungeonMob(LivingEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game the given group plays.
|
||||||
|
*
|
||||||
|
* @param group the group
|
||||||
|
* @return the game the given group plays
|
||||||
|
*/
|
||||||
|
Game getGame(PlayerGroup group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game the given player plays.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
* @return the game the given player plays
|
||||||
|
*/
|
||||||
|
Game getGame(Player player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game played in the given instance world.
|
||||||
|
*
|
||||||
|
* @param world the instance world
|
||||||
|
* @return the game played in the given instance world
|
||||||
|
*/
|
||||||
|
Game getGame(World world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the GameWorld that wraps the given instance world.
|
||||||
|
*
|
||||||
|
* @param world the instance world
|
||||||
|
* @return the GameWorld that wraps the given instance world
|
||||||
|
*/
|
||||||
|
GameWorld getGameWorld(World world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the EditWorld that wraps the given instance world.
|
||||||
|
*
|
||||||
|
* @param world the instance world
|
||||||
|
* @return the EditWorld that wraps the given instance worl
|
||||||
|
*/
|
||||||
|
EditWorld getEditWorld(World world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the given world is an instance.
|
||||||
|
*
|
||||||
|
* @param world the world
|
||||||
|
* @return if the given world is an instance
|
||||||
|
*/
|
||||||
|
boolean isInstance(World world);
|
||||||
|
|
||||||
|
}
|
50
api/src/main/java/de/erethon/dungeonsxl/api/Requirement.java
Normal file
50
api/src/main/java/de/erethon/dungeonsxl/api/Requirement.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Something a player needs to fulfill in order to be allowed to start the game (= trigger a ready sign).
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface Requirement {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the requirement from the given requirements {@link de.erethon.dungeonsxl.api.dungeon.GameRule} section.
|
||||||
|
*
|
||||||
|
* @param config the requirements config section
|
||||||
|
*/
|
||||||
|
void setup(ConfigurationSection config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the given player fulfills the requirements. If true, this lets him start the game (= trigger a ready sign).
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
* @return if the given player fulfills the requirements
|
||||||
|
*/
|
||||||
|
boolean check(Player player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is fired after the {@link #check(Player)} has been accepted. It demands the requirement from the given player. This may be empty for a "key" or may
|
||||||
|
* take something away for a "fee" requirement.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
*/
|
||||||
|
void demand(Player player);
|
||||||
|
|
||||||
|
}
|
34
api/src/main/java/de/erethon/dungeonsxl/api/Reward.java
Normal file
34
api/src/main/java/de/erethon/dungeonsxl/api/Reward.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Something players are given when they successfully finish a {@link de.erethon.dungeonsxl.api.dungeon.Dungeon}.
|
||||||
|
* <p>
|
||||||
|
* @see de.erethon.dungeonsxl.api.player.PlayerGroup#getRewards()
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface Reward {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the reward to the given player.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
*/
|
||||||
|
void giveTo(Player player);
|
||||||
|
|
||||||
|
}
|
33
api/src/main/java/de/erethon/dungeonsxl/api/Trigger.java
Normal file
33
api/src/main/java/de/erethon/dungeonsxl/api/Trigger.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated stub
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public interface Trigger {
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
boolean isTriggered();
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
Player getPlayer();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.dungeon;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link GameRule} where the value is a {@link java.util.Collection}.
|
||||||
|
*
|
||||||
|
* @param <T> the type of the collection
|
||||||
|
* @param <V> the type of the game rule value
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public class CollectionGameRule<T, V extends Collection<T>> extends GameRule<V> {
|
||||||
|
|
||||||
|
public CollectionGameRule(Class type, String key, V defaultValue) {
|
||||||
|
super(type, key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void merge(GameRuleContainer overriding, GameRuleContainer subsidiary, GameRuleContainer writeTo) {
|
||||||
|
V write = writeTo.getState(this);
|
||||||
|
write.addAll(subsidiary.getState(this));
|
||||||
|
write.addAll(overriding.getState(this));
|
||||||
|
writeTo.setState(this, write);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
224
api/src/main/java/de/erethon/dungeonsxl/api/dungeon/Dungeon.java
Normal file
224
api/src/main/java/de/erethon/dungeonsxl/api/dungeon/Dungeon.java
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.dungeon;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.world.ResourceWorld;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dungeon consists of floors and settings including its game rules.
|
||||||
|
* <p>
|
||||||
|
* MFD = multiple floor dungeon; SFD = single floor dungeon.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface Dungeon {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name.
|
||||||
|
*
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name to the given value.
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
*/
|
||||||
|
void setName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if this dungeon has multiple floors.
|
||||||
|
*
|
||||||
|
* @return if this dungeon has multiple floors
|
||||||
|
*/
|
||||||
|
boolean isMultiFloor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the map to instantiate.
|
||||||
|
* <p>
|
||||||
|
* This method is the same as {@link #getStartFloor()} but a bit more intuitive for SFDs.
|
||||||
|
*
|
||||||
|
* @return the map to instantiate
|
||||||
|
*/
|
||||||
|
default ResourceWorld getMap() {
|
||||||
|
return getStartFloor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the first floor of this dungeon.
|
||||||
|
*
|
||||||
|
* @return the first floor of this dungeon
|
||||||
|
*/
|
||||||
|
ResourceWorld getStartFloor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the first floor of this dungeon.
|
||||||
|
*
|
||||||
|
* @param startFloor the startFloor to set
|
||||||
|
*/
|
||||||
|
void setStartFloor(ResourceWorld startFloor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the last floor of this dungeon or null if this is an SFD.
|
||||||
|
*
|
||||||
|
* @return the last floor of this dungeon or null if this is an SFD
|
||||||
|
*/
|
||||||
|
ResourceWorld getEndFloor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the last floor of this MFD.
|
||||||
|
*
|
||||||
|
* @param endFloor the last floor
|
||||||
|
*/
|
||||||
|
void setEndFloor(ResourceWorld endFloor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of the floors without start and end floor.
|
||||||
|
*
|
||||||
|
* @return a list of the floors without start and end floor
|
||||||
|
*/
|
||||||
|
List<ResourceWorld> getFloors();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given floor.
|
||||||
|
*
|
||||||
|
* @param resource the resource to add
|
||||||
|
*/
|
||||||
|
void addFloor(ResourceWorld resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given floor.
|
||||||
|
*
|
||||||
|
* @param resource the resource to remove
|
||||||
|
*/
|
||||||
|
void removeFloor(ResourceWorld resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the amount of floors in this dungeon including start and end floor.
|
||||||
|
* <p>
|
||||||
|
* This may be less than the size of {@link #getFloors()} + 2 if not all floors from the list are used.
|
||||||
|
*
|
||||||
|
* @return the amount of floors in this dungeon including start and end floor
|
||||||
|
*/
|
||||||
|
int getFloorCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the amount of floors that shall be played.
|
||||||
|
*
|
||||||
|
* @param floorCount the amount of floors to set
|
||||||
|
*/
|
||||||
|
void setFloorCount(int floorCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if floors cannot be played once if floors are selected randomly from the list.
|
||||||
|
*
|
||||||
|
* @return the removeWhenPlayed if floors cannot be played once if floors are selected randomly from the list
|
||||||
|
*/
|
||||||
|
boolean getRemoveWhenPlayed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if floors cannot be played once if floors are selected randomly from the list.
|
||||||
|
*
|
||||||
|
* @param removeWhenPlayed if floors cannot be played once if floors are selected randomly from the list
|
||||||
|
*/
|
||||||
|
void setRemoveWhenPlayed(boolean removeWhenPlayed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The values from this game rule container will override all values of the game rule containers of the dungeon's maps.
|
||||||
|
*
|
||||||
|
* @return the override values
|
||||||
|
*/
|
||||||
|
GameRuleContainer getOverrideValues();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the game rule container whose values override all values of the game rule containers of the dungeon's maps.
|
||||||
|
*
|
||||||
|
* @param rules the override values
|
||||||
|
*/
|
||||||
|
void setOverrideValues(GameRuleContainer rules);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The values from this game rule container will be overriden by values of the game rule containers of the dungeon's maps. They will however still override
|
||||||
|
* the values from the main config.
|
||||||
|
*
|
||||||
|
* @return the default values
|
||||||
|
*/
|
||||||
|
GameRuleContainer getDefaultValues();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the game rule container whose values will be overriden by values of the game rule containers of the dungeon's maps. They will however still override
|
||||||
|
* the values from the main config.
|
||||||
|
*
|
||||||
|
* @param rules the default values
|
||||||
|
*/
|
||||||
|
void setDefaultValues(GameRuleContainer rules);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the floor is either in the floors list or the start / end floor.
|
||||||
|
*
|
||||||
|
* @param resource the ResourceWorld to check
|
||||||
|
* @return true if the floor is either in the floors list or the start / end floor.
|
||||||
|
*/
|
||||||
|
default boolean containsFloor(ResourceWorld resource) {
|
||||||
|
return getFloors().contains(resource) || getStartFloor().equals(resource) || getEndFloor().equals(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the floor is either in the floors list or the start / end floor.
|
||||||
|
*
|
||||||
|
* @param mapName the name of the map to check
|
||||||
|
* @return true if the floor is either in the floors list or the start / end floor.
|
||||||
|
*/
|
||||||
|
default boolean containsFloor(String mapName) {
|
||||||
|
for (ResourceWorld world : getFloors()) {
|
||||||
|
if (world.getName().equals(mapName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getStartFloor().getName().equals(mapName) || getEndFloor().getName().equals(mapName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the rules of this game.
|
||||||
|
* <p>
|
||||||
|
* This is not necessarily represented 1:1 by a config file because it is usually merged together through {@link #setupRules()}.
|
||||||
|
*
|
||||||
|
* @return the rules of this game
|
||||||
|
*/
|
||||||
|
GameRuleContainer getRules();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rules of the game.
|
||||||
|
*
|
||||||
|
* @param rules the rules
|
||||||
|
*/
|
||||||
|
void setRules(GameRuleContainer rules);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the rules with the following priority: 1. Game type 2. Dungeon config: Override values 3. Floor config 4. Dungeon config: Default values 5. Main
|
||||||
|
* config: Default values 6. The default values
|
||||||
|
*/
|
||||||
|
void setupRules();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns false if there are errors in the setup; true if not.
|
||||||
|
*
|
||||||
|
* @return false if there are errors in the setup; true if not
|
||||||
|
*/
|
||||||
|
boolean isSetupCorrect();
|
||||||
|
|
||||||
|
}
|
165
api/src/main/java/de/erethon/dungeonsxl/api/dungeon/Game.java
Normal file
165
api/src/main/java/de/erethon/dungeonsxl/api/dungeon/Game.java
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.dungeon;
|
||||||
|
|
||||||
|
import de.erethon.commons.player.PlayerCollection;
|
||||||
|
import de.erethon.dungeonsxl.api.player.PlayerGroup;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import de.erethon.dungeonsxl.api.world.ResourceWorld;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the rules of playing in a dungeon.
|
||||||
|
* <p>
|
||||||
|
* Tracks the progress of groups in a dungeon and handles their interaction with each other.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: wave and kill counter methods
|
||||||
|
public interface Game {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if this is a tutorial game.
|
||||||
|
*
|
||||||
|
* @return if this is a tutorial game
|
||||||
|
*/
|
||||||
|
boolean isTutorial();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if this is a tutorial game
|
||||||
|
*
|
||||||
|
* @param tutorial if this is a tutorial game
|
||||||
|
*/
|
||||||
|
void setTutorial(boolean tutorial);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a read-only List of the groups that are playing this game.
|
||||||
|
*
|
||||||
|
* @return a read-only List of the groups that are playing this game
|
||||||
|
*/
|
||||||
|
List<PlayerGroup> getGroups();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given group to this game.
|
||||||
|
*
|
||||||
|
* @param group the group
|
||||||
|
*/
|
||||||
|
void addGroup(PlayerGroup group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given group from this game.
|
||||||
|
*
|
||||||
|
* @param group the group
|
||||||
|
*/
|
||||||
|
void removeGroup(PlayerGroup group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the group has started (=if the ready sign has been triggered).
|
||||||
|
*
|
||||||
|
* @return if the group has started
|
||||||
|
*/
|
||||||
|
boolean hasStarted();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the status of the game to have started / not yet started.
|
||||||
|
*
|
||||||
|
* @param started if the game has started
|
||||||
|
*/
|
||||||
|
void setStarted(boolean started);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game instance in which this game takes place.
|
||||||
|
*
|
||||||
|
* @return the game instance in which this game takes place
|
||||||
|
*/
|
||||||
|
GameWorld getWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the game instance in which this game takes place.
|
||||||
|
*
|
||||||
|
* @param gameWorld the game instance in which this game takes place
|
||||||
|
*/
|
||||||
|
void setWorld(GameWorld gameWorld);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the rules of the dungeon of this game.
|
||||||
|
* <p>
|
||||||
|
* This is not necessarily represented 1:1 by a config file because it is usually merged together through {@link Dungeon#setupRules()}.
|
||||||
|
*
|
||||||
|
* @return the rules of the dungeon of this game
|
||||||
|
*/
|
||||||
|
default GameRuleContainer getRules() {
|
||||||
|
return getDungeon().getRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a read-only List of the remaining floors to play.
|
||||||
|
*
|
||||||
|
* @return a read-only List of the remaining floors to play
|
||||||
|
*/
|
||||||
|
List<ResourceWorld> getUnplayedFloors();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the amount of played floors in this game.
|
||||||
|
*
|
||||||
|
* @return the amount of played floors in this game
|
||||||
|
*/
|
||||||
|
int getFloorCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dungeon that "hosts" this game.
|
||||||
|
*
|
||||||
|
* @return the dungeon that "hosts" this game
|
||||||
|
*/
|
||||||
|
Dungeon getDungeon();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the players playing the game.
|
||||||
|
*
|
||||||
|
* @return the players playing the game
|
||||||
|
*/
|
||||||
|
PlayerCollection getPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if there are no groups in this game; false if not.
|
||||||
|
*
|
||||||
|
* @return true if there are no groups in this game; false if not
|
||||||
|
*/
|
||||||
|
boolean isEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes this game.
|
||||||
|
*/
|
||||||
|
void delete();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if all groups of the game have finished it; false if not.
|
||||||
|
*
|
||||||
|
* @return true if all groups of the game have finished it; false if not
|
||||||
|
*/
|
||||||
|
default boolean isFinished() {
|
||||||
|
return getGroups().stream().allMatch(PlayerGroup::isFinished);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a message to each player in each group.
|
||||||
|
*
|
||||||
|
* @param message the message. Supports color codes
|
||||||
|
*/
|
||||||
|
default void sendMessage(String message) {
|
||||||
|
getGroups().forEach(g -> g.sendMessage(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.dungeon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A game goal defines what the players have to do in order to finish the game.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public enum GameGoal {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default goal. The game ends when the end is reached.
|
||||||
|
*/
|
||||||
|
END,
|
||||||
|
/**
|
||||||
|
* The game does not end. Instead, the goal is to survive as long as possible to beat a highscore.
|
||||||
|
*/
|
||||||
|
HIGHSCORE,
|
||||||
|
/**
|
||||||
|
* The game ends when a player dies and only one group is left.
|
||||||
|
*/
|
||||||
|
LAST_MAN_STANDING,
|
||||||
|
/**
|
||||||
|
* The game ends when a group reachs a specific score.
|
||||||
|
*/
|
||||||
|
REACH_SCORE,
|
||||||
|
/**
|
||||||
|
* The game ends after a specific time. The goal is to get the highest score until then.
|
||||||
|
*/
|
||||||
|
TIME_SCORE,
|
||||||
|
/**
|
||||||
|
* The game ends after a specific time. The goal is to survive until then.
|
||||||
|
*/
|
||||||
|
TIME_SURVIVAL;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,320 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.dungeon;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.CaliburnAPI;
|
||||||
|
import de.erethon.caliburn.item.ExItem;
|
||||||
|
import de.erethon.caliburn.mob.ExMob;
|
||||||
|
import de.erethon.caliburn.mob.VanillaMob;
|
||||||
|
import de.erethon.commons.misc.EnumUtil;
|
||||||
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
|
import de.erethon.dungeonsxl.api.Requirement;
|
||||||
|
import de.erethon.dungeonsxl.api.Reward;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a game rule for a {@link Game}.
|
||||||
|
*
|
||||||
|
* @param <V> the type of the game rule value
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// TODO: These values aren't properly fetched from config yet: values that involve Caliburn, requirements & rewards; maybe messages.
|
||||||
|
// Check special merging rules for damageProtectedEntities and interactionProtectedEntities.
|
||||||
|
public class GameRule<V> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shall players play the dungeon with their own items or do you want to use classes?
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> KEEP_INVENTORY_ON_ENTER = new GameRule<>(Boolean.class, "keepInventoryOnEnter", false);
|
||||||
|
/**
|
||||||
|
* Shall players keep their inventory when they leave the dungeon without succeeding?
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> KEEP_INVENTORY_ON_ESCAPE = new GameRule<>(Boolean.class, "keepInventoryOnEscape", false);
|
||||||
|
/**
|
||||||
|
* Shall players keep their inventory when they finish the dungeon?
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> KEEP_INVENTORY_ON_FINISH = new GameRule<>(Boolean.class, "keepInventoryOnFinish", false);
|
||||||
|
/**
|
||||||
|
* Shall players lose their items when they die (do not mix up this with "onEscape"!)?
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> KEEP_INVENTORY_ON_DEATH = new GameRule<>(Boolean.class, "keepInventoryOnDeath", true);
|
||||||
|
/**
|
||||||
|
* If the Lobby is disabled. This applies only to Dungeons that have to be solved alone and where there are no classes to choose from.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> IS_LOBBY_DISABLED = new GameRule<>(Boolean.class, "isLobbyDisabled", false);
|
||||||
|
/**
|
||||||
|
* The game mode.
|
||||||
|
*/
|
||||||
|
public static final GameRule<GameMode> GAME_MODE = new GameRule<>(GameMode.class, "gameMode", GameMode.SURVIVAL);
|
||||||
|
/**
|
||||||
|
* If players may fly.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> FLY = new GameRule<>(Boolean.class, "fly", false);
|
||||||
|
/**
|
||||||
|
* If players can build and destroy blocks in this world.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> BREAK_BLOCKS = new GameRule<>(Boolean.class, "breakBlocks", false);
|
||||||
|
/**
|
||||||
|
* If players may destroy blocks they placed themselves.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> BREAK_PLACED_BLOCKS = new GameRule<>(Boolean.class, "breakPlacedBlocks", false);
|
||||||
|
/**
|
||||||
|
* A whitelist of breakable blocks. breakBlocks is supposed to be set to "true" if this should be used.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Map<ExItem, HashSet<ExItem>>> BREAK_WHITELIST = new MapGameRule<>(Map.class, "breakWhitelist", null);
|
||||||
|
/**
|
||||||
|
* A list of all entity types that shall be protected from damage. If this is left out AND if breakBlocks is false, armor stands, paintings and item frames
|
||||||
|
* will be protected by default. If this is left out and if breakBlocks is true, nothing will be protected by default.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Set<ExMob>> DAMAGE_PROTECTED_ENTITIES = new CollectionGameRule<>(Set.class, "damageProtectedEntities", new HashSet<>(Arrays.asList(
|
||||||
|
VanillaMob.ARMOR_STAND,
|
||||||
|
VanillaMob.ITEM_FRAME,
|
||||||
|
VanillaMob.PAINTING
|
||||||
|
)));
|
||||||
|
/**
|
||||||
|
* If this is left out AND if breakBlocks is false, armor stands and item frames will be protected by default. If this is left out and if breakBlocks is
|
||||||
|
* true, nothing will be protected by default.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Set<ExMob>> INTERACTION_PROTECTED_ENTITIES = new CollectionGameRule<>(Set.class, "interactionProtectedEntities", new HashSet<>(Arrays.asList(
|
||||||
|
VanillaMob.ARMOR_STAND,
|
||||||
|
VanillaMob.ITEM_FRAME
|
||||||
|
)));
|
||||||
|
/**
|
||||||
|
* If blocks may be placed.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> PLACE_BLOCKS = new GameRule<>(Boolean.class, "placeBlocks", false);
|
||||||
|
/**
|
||||||
|
* A whitelist of placeable blocks. placeBlocks is supposed to be set to "true" if this should be used.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Set<ExItem>> PLACE_WHITELIST = new CollectionGameRule<>(Set.class, "placeWhitelist", null);
|
||||||
|
/**
|
||||||
|
* If it should rain permanently in the dungeon.
|
||||||
|
* <p>
|
||||||
|
* true = permanent rain; false = permanent sun; leaving this out = random weather like in vanilla Minecraft
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> RAIN = new GameRule<>(Boolean.class, "rain", null);
|
||||||
|
/**
|
||||||
|
* Thunderstorms.
|
||||||
|
*
|
||||||
|
* @see #RAIN
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> THUNDER = new GameRule<>(Boolean.class, "thunder", null);
|
||||||
|
/**
|
||||||
|
* The time ticks (to be used like in the vanilla /time command).
|
||||||
|
*/
|
||||||
|
public static final GameRule<Long> TIME = new GameRule<>(Long.class, "time", null);
|
||||||
|
/**
|
||||||
|
* PvP
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> PLAYER_VERSUS_PLAYER = new GameRule<>(Boolean.class, "playerVersusPlayer", false);
|
||||||
|
/**
|
||||||
|
* Friendly fire refers just to members of the same group.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> FRIENDLY_FIRE = new GameRule<>(Boolean.class, "friendlyFire", false);
|
||||||
|
/**
|
||||||
|
* Amount of lives a player initially has when he enters a dungeon.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> INITIAL_LIVES = new GameRule<>(Integer.class, "initialLives", -1);
|
||||||
|
/**
|
||||||
|
* Alternatively to {@link #INITIAL_LIVES player lives}, you can use group lives.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> INITIAL_GROUP_LIVES = new GameRule<>(Integer.class, "initialGroupLives", -1);
|
||||||
|
/**
|
||||||
|
* Score used for capture the flag and similar game types.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> INITIAL_SCORE = new GameRule<>(Integer.class, "initialScore", 3);
|
||||||
|
/**
|
||||||
|
* The amount of goals to score before the game ends. -1 = not used.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> SCORE_GOAL = new GameRule<>(Integer.class, "scoreGoal", -1);
|
||||||
|
/**
|
||||||
|
* Time in hours when the game may be played again after it has been started.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TIME_TO_NEXT_PLAY_AFTER_START = new GameRule<>(Integer.class, "timeToNextPlayAfterStart", 0);
|
||||||
|
/**
|
||||||
|
* When the game may be played again after it has been finished.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TIME_TO_NEXT_PLAY_AFTER_FINISH = new GameRule<>(Integer.class, "timeToNextPlayAfterFinish", 0);
|
||||||
|
/**
|
||||||
|
* When loot may be taken away out of the dungeon again.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TIME_TO_NEXT_LOOT = new GameRule<>(Integer.class, "timeToNextLoot", 0);
|
||||||
|
/**
|
||||||
|
* The cooldown between two mob waves.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TIME_TO_NEXT_WAVE = new GameRule<>(Integer.class, "timeToNextWave", 10);
|
||||||
|
/**
|
||||||
|
* The time left to finish the game; -1 if no timer is used.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TIME_TO_FINISH = new GameRule<>(Integer.class, "timeToFinish", -1);
|
||||||
|
/**
|
||||||
|
* Time until a player is kicked out of a group after he leaves the server.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TIME_UNTIL_KICK_OFFLINE_PLAYER = new GameRule<>(Integer.class, "timeUntilKickOfflinePlayer", 0);
|
||||||
|
/**
|
||||||
|
* A list of requirements. Note that requirements will be ignored if the player has the dxl.ignorerequirements permission node.
|
||||||
|
*/
|
||||||
|
public static final GameRule<List<Requirement>> REQUIREMENTS = new CollectionGameRule<>(List.class, "requirements", new ArrayList<>());
|
||||||
|
/**
|
||||||
|
* One of these Dungeons must be finished ("any" for any dungeon).
|
||||||
|
*/
|
||||||
|
public static final GameRule<List<String>> MUST_FINISH_ONE = new CollectionGameRule<>(List.class, "mustFinishOne", null);
|
||||||
|
/**
|
||||||
|
* All of these Dungeons must be finished. If you do not want any, leave this empty.
|
||||||
|
*/
|
||||||
|
public static final GameRule<List<String>> MUST_FINISH_ALL = new CollectionGameRule<>(List.class, "mustFinishAll", null);
|
||||||
|
/**
|
||||||
|
* This can be used to give rewards. The default implementation does not do this at the moment.
|
||||||
|
*/
|
||||||
|
public static final GameRule<List<Reward>> REWARDS = new CollectionGameRule<>(List.class, "rewards", new ArrayList<>());
|
||||||
|
/**
|
||||||
|
* These commands can be used by all players if they are in the dungeon. DXL commands like /dxl leavecan be used by default.
|
||||||
|
*/
|
||||||
|
public static final GameRule<List<String>> GAME_COMMAND_WHITELIST = new CollectionGameRule<>(List.class, "gameCommandWhitelist", new ArrayList<>());
|
||||||
|
/**
|
||||||
|
* A list of permissions players get while they play the game. The permissions get removed as soon as the player leaves the game. Requires Vault and a
|
||||||
|
* permissions plugin like PermissionsEx.
|
||||||
|
*/
|
||||||
|
public static final GameRule<List<String>> GAME_PERMISSIONS = new CollectionGameRule<>(List.class, "gamePermissions", new ArrayList<>());
|
||||||
|
/**
|
||||||
|
* Use this to replace the default ready / new floor message. If titles are deactivated in the main config, this is not going to work.
|
||||||
|
*/
|
||||||
|
public static final GameRule<String> TITLE = new GameRule<>(String.class, "title", null);
|
||||||
|
/**
|
||||||
|
* Use this to replace the default ready / new floor message. If titles are deactivated in the main config, this is not going to work.
|
||||||
|
*/
|
||||||
|
public static final GameRule<String> SUBTITLE = new GameRule<>(String.class, "subtitle", null);
|
||||||
|
/**
|
||||||
|
* Use this to replace the default ready / new floor message. If titles are deactivated in the main config, this is not going to work.
|
||||||
|
*/
|
||||||
|
public static final GameRule<String> ACTION_BAR = new GameRule<>(String.class, "actionBar", null);
|
||||||
|
/**
|
||||||
|
* Use this to replace the default ready / new floor message. If titles are deactivated in the main config, this is not going to work.
|
||||||
|
*/
|
||||||
|
public static final GameRule<String> CHAT = new GameRule<>(String.class, "chat", null);
|
||||||
|
/**
|
||||||
|
* Use this to replace the default ready / new floor message. If titles are deactivated in the main config, this is not going to work.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TITLE_FADE_IN = new GameRule<>(Integer.class, "titleFadeIn", 20);
|
||||||
|
/**
|
||||||
|
* Use this to replace the default ready / new floor message. If titles are deactivated in the main config, this is not going to work.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TITLE_FADE_OUT = new GameRule<>(Integer.class, "titleFadeOut", 20);
|
||||||
|
/**
|
||||||
|
* Use this to replace the default ready / new floor message. If titles are deactivated in the main config, this is not going to work.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Integer> TITLE_SHOW = new GameRule<>(Integer.class, "titleShow", 60);
|
||||||
|
/**
|
||||||
|
* Messages; also to be created with /dxl msg
|
||||||
|
*/
|
||||||
|
public static final GameRule<Map<Integer, String>> MESSAGES = new MapGameRule<>(Map.class, "msgs", new HashMap<>());
|
||||||
|
/**
|
||||||
|
* Items you cannot drop or destroy.
|
||||||
|
*/
|
||||||
|
public static final GameRule<List<ExItem>> SECURE_OBJECTS = new CollectionGameRule<>(List.class, "secureObjects", new ArrayList<>());
|
||||||
|
/**
|
||||||
|
* If group tags are used.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> GROUP_TAG_ENABLED = new GameRule<>(Boolean.class, "groupTagEnabled", false);
|
||||||
|
|
||||||
|
protected Class<V> type;
|
||||||
|
private String key;
|
||||||
|
private V defaultValue;
|
||||||
|
|
||||||
|
public GameRule(Class<V> type, String key, V defaultValue) {
|
||||||
|
this.type = type;
|
||||||
|
this.key = key;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the configuration key of the game rule.
|
||||||
|
*
|
||||||
|
* @return the configuration key of the game rule
|
||||||
|
*/
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value used if nothing is specified by a game rule provider.
|
||||||
|
*
|
||||||
|
* @return the value used if nothing is specified by a game rule provider
|
||||||
|
*/
|
||||||
|
public V getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the given value is an instance of {@link V}.
|
||||||
|
*
|
||||||
|
* @param value the value
|
||||||
|
* @return if the given value is an instance of {@link V}
|
||||||
|
*/
|
||||||
|
public boolean isValidValue(Object value) {
|
||||||
|
return type.isInstance(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the state of the game rule fetched from the config.
|
||||||
|
* <p>
|
||||||
|
* If the type of this game rule is an enum, Strings as config values that are the {@link Enum#name()} of an enum value are converted
|
||||||
|
* automatically.
|
||||||
|
*
|
||||||
|
* @param api the API instance
|
||||||
|
* @param caliburn the CaliburnAPI instance
|
||||||
|
* @param container the game rule container whose state is to be set
|
||||||
|
* @param config the config to fetch the value from
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public V fromConfig(DungeonsAPI api, CaliburnAPI caliburn, GameRuleContainer container, ConfigurationSection config) {
|
||||||
|
Object value = config.get(getKey());
|
||||||
|
|
||||||
|
if (Enum.class.isAssignableFrom(type)) {
|
||||||
|
if (!(value instanceof String)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
value = EnumUtil.getEnumIgnoreCase((Class<? extends Enum>) type, (String) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isValidValue(value) ? (V) value : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the state attached to the game rule of two GameRuleContainers.
|
||||||
|
* <p>
|
||||||
|
* This may be overriden if necessary, for example if the value is a {@link java.util.Collection} and the desired behavior is to merge the values instead of
|
||||||
|
* keeping the overriding one.
|
||||||
|
*
|
||||||
|
* @param overriding the state of this container will by default be copied to the "writeTo" container if it is not null
|
||||||
|
* @param subsidiary the state of this container will by default be copied to the "writeTo" container if the state of the "overriding" container is null
|
||||||
|
* @param writeTo the state of the game rule will be set to the one of either "overriding" or "subsidiary". This container may be == to one of the
|
||||||
|
* others.
|
||||||
|
*/
|
||||||
|
public void merge(GameRuleContainer overriding, GameRuleContainer subsidiary, GameRuleContainer writeTo) {
|
||||||
|
V overridingValue = overriding.getState(this);
|
||||||
|
V subsidiaryValue = subsidiary.getState(this);
|
||||||
|
writeTo.setState(this, overridingValue != null ? overridingValue : subsidiaryValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.dungeon;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A container for {@link GameRule}s.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public class GameRuleContainer {
|
||||||
|
|
||||||
|
private Map<GameRule<?>, Object> rules = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the state of the GameRule or UNDEFINED_STATE if it is not defined
|
||||||
|
*
|
||||||
|
* @param <V> the type of the value of the rule
|
||||||
|
* @param rule the rule
|
||||||
|
* @return the state of the rule
|
||||||
|
*/
|
||||||
|
public <V> V getState(GameRule<V> rule) {
|
||||||
|
if (!rules.containsKey(rule)) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return (V) rules.get(rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state of the GameRule.Set it to null to remove the rule from the map sothat a subsidiary provider can set it.
|
||||||
|
*
|
||||||
|
* @param <V> the type of the value of the rule
|
||||||
|
* @param rule the rule
|
||||||
|
* @param state the new state of the rule in this container
|
||||||
|
*/
|
||||||
|
public <V> void setState(GameRule<V> rule, V state) {
|
||||||
|
if (state == null) {
|
||||||
|
rules.remove(rule);
|
||||||
|
} else if (rule.isValidValue(state)) {
|
||||||
|
rules.put(rule, state);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("state is not a valid value for rule " + rule.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the rule from the map sothat a subsidiary provider can set it.
|
||||||
|
*
|
||||||
|
* @param rule the GameRule to unset
|
||||||
|
*/
|
||||||
|
public void unsetState(GameRule<?> rule) {
|
||||||
|
rules.remove(rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills the values that are not yet set with values from a subsidiary container.
|
||||||
|
*
|
||||||
|
* @param subsidiary the GameRules that override the values that are null.
|
||||||
|
*/
|
||||||
|
public void merge(GameRuleContainer subsidiary) {
|
||||||
|
rules.entrySet().forEach(e -> e.getKey().merge(this, subsidiary, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.dungeon;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link GameRule} where the value is a {@link java.util.Map}.
|
||||||
|
*
|
||||||
|
* @param <TK> the type of the map key
|
||||||
|
* @param <TV> the type of the map value
|
||||||
|
* @param <V> the type of the game rule value
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public class MapGameRule<TK, TV, V extends Map<TK, TV>> extends GameRule<V> {
|
||||||
|
|
||||||
|
public MapGameRule(Class type, String key, V defaultValue) {
|
||||||
|
super(type, key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void merge(GameRuleContainer overriding, GameRuleContainer subsidiary, GameRuleContainer writeTo) {
|
||||||
|
V write = writeTo.getState(this);
|
||||||
|
write.putAll(subsidiary.getState(this));
|
||||||
|
write.putAll(overriding.getState(this));
|
||||||
|
writeTo.setState(this, write);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.mob;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.mob.ExMob;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for a mob spawned in a dungeon.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface DungeonMob {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the entity that is wrapped by this object.
|
||||||
|
*
|
||||||
|
* @return the entity that is wrapped by this object
|
||||||
|
*/
|
||||||
|
LivingEntity getEntity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Caliburn representation of the mob or null if it is spawned by an external plugin.
|
||||||
|
*
|
||||||
|
* @return the Caliburn representation of the mob or null if it is spawned by an external plugin
|
||||||
|
*/
|
||||||
|
ExMob getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the mob is spawned by an external plugin.
|
||||||
|
*
|
||||||
|
* @return if the mob is spawned by an external plugin
|
||||||
|
*/
|
||||||
|
default boolean isExternalMob() {
|
||||||
|
return getType() == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the String used to identify this mob for example in the context of triggers.
|
||||||
|
*
|
||||||
|
* @return the String used to identify this mob for example in the context of triggers
|
||||||
|
*/
|
||||||
|
String getTriggerId();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.mob;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Other plugins / libraries that can handle and spawn mobs.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface ExternalMobProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the identifier used on mob signs to spawn mobs from this provider.
|
||||||
|
*
|
||||||
|
* @return the identifier used on mob signs to spawn mobs from this provider
|
||||||
|
*/
|
||||||
|
String getIdentifier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw console spawn command of the provider.
|
||||||
|
* <p>
|
||||||
|
* This method is necessary for the default implementation of {@link #getCommand(String, String, double, double, double)}.
|
||||||
|
*
|
||||||
|
* @return the raw console spawn command of the provider
|
||||||
|
*/
|
||||||
|
String getRawCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the console spawn command of the provider with values replaced to spawn the mob represented by the given String.
|
||||||
|
* <p>
|
||||||
|
* The default implementation uses %mob%, %world%, %x%, %y% and %z% as placeholders and alternatively %block_x% etc. if values without decimals are needed.
|
||||||
|
* <p>
|
||||||
|
* This method is used in the default implementation of {@link #summon(String, org.bukkit.Location)}.
|
||||||
|
*
|
||||||
|
* @param mob the mob identifier
|
||||||
|
* @param world the game world
|
||||||
|
* @param x the x coordinate
|
||||||
|
* @param y the y coordinate
|
||||||
|
* @param z the z coordinate
|
||||||
|
* @return the command with replaced variables
|
||||||
|
*/
|
||||||
|
default String getCommand(String mob, String world, double x, double y, double z) {
|
||||||
|
return getRawCommand().replace("%mob%", mob).replace("%world%", world)
|
||||||
|
.replace("%x%", String.valueOf(x)).replace("%y%", String.valueOf(y)).replace("%z%", String.valueOf(z))
|
||||||
|
.replace("%block_x%", String.valueOf(Location.locToBlock(x)))
|
||||||
|
.replace("%block_y%", String.valueOf(Location.locToBlock(y)))
|
||||||
|
.replace("%block_z%", String.valueOf(Location.locToBlock(z)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summons the mob.
|
||||||
|
* <p>
|
||||||
|
* The default implementation requires {@link #getCommand(String, String, double, double, double)} to be implemented.
|
||||||
|
*
|
||||||
|
* @param mob the mob identifier
|
||||||
|
* @param location the location where the mob will be spawned
|
||||||
|
*/
|
||||||
|
default void summon(String mob, Location location) {
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), getCommand(mob, location.getWorld().getName(), location.getX(), location.getY(), location.getZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.player;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.world.EditWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a player in an edit instance.
|
||||||
|
* <p>
|
||||||
|
* All players in an edit world have one wrapper object that is an instance of EditPlayer.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: g/s lines copy, poke
|
||||||
|
public interface EditPlayer extends InstancePlayer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link de.erethon.dungeonsxl.api.world.EditWorld} the player is editing.
|
||||||
|
*
|
||||||
|
* @return the {@link de.erethon.dungeonsxl.api.world.EditWorld} the player is editing
|
||||||
|
*/
|
||||||
|
EditWorld getEditWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the lines of a sign the player has copied with a stick tool in an array with the length of four.
|
||||||
|
*
|
||||||
|
* @return the lines of a sign the player has copied with a stick tool in an array with the length of four
|
||||||
|
*/
|
||||||
|
String[] getCopiedLines();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the memorized sign lines.
|
||||||
|
*
|
||||||
|
* @param copiedLines the lines
|
||||||
|
*/
|
||||||
|
void setCopiedLines(String[] copiedLines);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the player leave the edit world without saving the progress.
|
||||||
|
*/
|
||||||
|
void escape();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,208 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.player;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a player in a game dungeon instance.
|
||||||
|
* <p>
|
||||||
|
* All players in a game world have one wrapper object that is an instance of GamePlayer.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: isInTestMode, setReady, [wolf, group tag, requirement, loot check methods], finishFloor
|
||||||
|
public interface GamePlayer extends InstancePlayer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player is ready to start the game.
|
||||||
|
* <p>
|
||||||
|
* This is usually achieved by triggering a ready sign.
|
||||||
|
*
|
||||||
|
* @return if the player is ready to start the game
|
||||||
|
*/
|
||||||
|
boolean isReady();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player finished the game.
|
||||||
|
* <p>
|
||||||
|
* This is usually achieved by triggering an end sign.
|
||||||
|
* <p>
|
||||||
|
* It is used for both the end of a whole dungeon and the end of a floor.
|
||||||
|
*
|
||||||
|
* @return if the player finished the game
|
||||||
|
*/
|
||||||
|
boolean isFinished();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the player finished their game.
|
||||||
|
*
|
||||||
|
* @param finished if the player finished the game
|
||||||
|
*/
|
||||||
|
void setFinished(boolean finished);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player's class or null if they have none.
|
||||||
|
*
|
||||||
|
* @return the player's class
|
||||||
|
*/
|
||||||
|
PlayerClass getPlayerClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets and applies the given class.
|
||||||
|
*
|
||||||
|
* @param playerClass the class
|
||||||
|
*/
|
||||||
|
void setPlayerClass(PlayerClass playerClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the location of the last checkpoint the player reached.
|
||||||
|
*
|
||||||
|
* @return the location of the last checkpoint the player reached
|
||||||
|
*/
|
||||||
|
Location getLastCheckpoint();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the location of the last checkpoint the player reached.
|
||||||
|
* <p>
|
||||||
|
* This is where the player respawns if they die and have -1 or >0 {@link #getLives() lives} left.
|
||||||
|
*
|
||||||
|
* @param checkpoint the checkpoint location
|
||||||
|
*/
|
||||||
|
void setLastCheckpoint(Location checkpoint);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the saved time millis from when the player went offline.
|
||||||
|
*
|
||||||
|
* @return the saved time millis from when the player went offline
|
||||||
|
*/
|
||||||
|
long getOfflineTimeMillis();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the saved time millis from when the player went offline.
|
||||||
|
*
|
||||||
|
* @param time the time millis
|
||||||
|
*/
|
||||||
|
void setOfflineTimeMillis(long time);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the original amount of lives the player had in the current game or -1 if lives aren't used.
|
||||||
|
*
|
||||||
|
* @return the original amount of lives the player had in the current game or -1 if lives aren't used
|
||||||
|
*/
|
||||||
|
int getInitialLives();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the original amount of lives the player had in the current game; -1 means lives aren't used.
|
||||||
|
*
|
||||||
|
* @param lives the amount of lives
|
||||||
|
*/
|
||||||
|
void setInitialLives(int lives);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the lives the player has left or -1 if per player lives aren't used.
|
||||||
|
*
|
||||||
|
* @return the lives the player has left or -1 if per player lives aren't used
|
||||||
|
*/
|
||||||
|
int getLives();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the lives the player has left.
|
||||||
|
* <p>
|
||||||
|
* This is not to be used if the dungeon uses group lives.
|
||||||
|
*
|
||||||
|
* @param lives the lives
|
||||||
|
*/
|
||||||
|
void setLives(int lives);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player is stealing another group's flag.
|
||||||
|
*
|
||||||
|
* @return if the player is stealing another group's flag
|
||||||
|
*/
|
||||||
|
boolean isStealingFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the group whose flag the player robbed; null if the player isn't stealing any.
|
||||||
|
*
|
||||||
|
* @return the group whose flag the player robbed; null if the player isn't stealing any
|
||||||
|
*/
|
||||||
|
PlayerGroup getRobbedGroup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the player to be stealing the team flag of the given group.
|
||||||
|
*
|
||||||
|
* @param group the group
|
||||||
|
*/
|
||||||
|
void setRobbedGroup(PlayerGroup group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scores a point.
|
||||||
|
*/
|
||||||
|
void captureFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the player leave his group and dungeon.
|
||||||
|
* <p>
|
||||||
|
* This sends default messages to the player.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
default void leave() {
|
||||||
|
leave(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the player leave his group and dungeon.
|
||||||
|
*
|
||||||
|
* @param sendMessages if default messages shall be sent to the player
|
||||||
|
*/
|
||||||
|
void leave(boolean sendMessages);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Treats the player as if they lost their last life and kicks them from the dungeon.
|
||||||
|
*/
|
||||||
|
void kill();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the player to be ready to start the dungeon game, like when a ready sign is triggered.
|
||||||
|
* <p>
|
||||||
|
* If all other players in the group are already {@link #isReady() ready}, the game is started.
|
||||||
|
*
|
||||||
|
* @return if the game has been started.
|
||||||
|
*/
|
||||||
|
boolean ready();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Respawns the player. Also teleports DXL pets if there are any.
|
||||||
|
*/
|
||||||
|
void respawn();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The player finishs the current game.
|
||||||
|
* <p>
|
||||||
|
* This sends default messages to the player.
|
||||||
|
*/
|
||||||
|
default void finish() {
|
||||||
|
finish(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The player finishs the current game.
|
||||||
|
*
|
||||||
|
* @param sendMessages if default messages shall be sent to the player
|
||||||
|
*/
|
||||||
|
void finish(boolean sendMessages);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.player;
|
||||||
|
|
||||||
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
|
import de.erethon.commons.player.PlayerWrapper;
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a player anywhere on the server.
|
||||||
|
* <p>
|
||||||
|
* All players on the server, including the ones in dungeons, have one wrapper object that is an instance of GlobalPlayer.
|
||||||
|
* <p>
|
||||||
|
* Do not cache this for the whole runtime (or use {@link de.erethon.commons.player.PlayerCollection}). The object may be deleted and replaced with an object of
|
||||||
|
* the appropriate type when the player enters or leaves an instance.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: getters and setters: data, portal, cached item, announcer, reward items; startTutorial
|
||||||
|
public interface GlobalPlayer extends PlayerWrapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player's group.
|
||||||
|
*
|
||||||
|
* @return the player's group.
|
||||||
|
*/
|
||||||
|
PlayerGroup getGroup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player uses the built-in group chat.
|
||||||
|
*
|
||||||
|
* @return if the player uses the built-in group chat
|
||||||
|
*/
|
||||||
|
boolean isInGroupChat();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the player uses the built-in group chat.
|
||||||
|
*
|
||||||
|
* @param groupChat if the player shall use the built-in group chat
|
||||||
|
*/
|
||||||
|
void setInGroupChat(boolean groupChat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player may read messages from the built-in group chat.
|
||||||
|
*
|
||||||
|
* @return if the player may read messages from the built-in group chat
|
||||||
|
*/
|
||||||
|
boolean isInChatSpyMode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the player may read messages from the built-in group chat.
|
||||||
|
*
|
||||||
|
* @param chatSpyMode if the player may read messages from the built-in group chat
|
||||||
|
*/
|
||||||
|
void setInChatSpyMode(boolean chatSpyMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the player has the given permission.
|
||||||
|
*
|
||||||
|
* @param permission the permission
|
||||||
|
* @return if the player has the given permission
|
||||||
|
*/
|
||||||
|
default boolean hasPermission(String permission) {
|
||||||
|
return getPlayer().hasPermission(permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the reward items a player collected in a dungeon game.
|
||||||
|
*
|
||||||
|
* @return the reward items a player collected in a dungeon game
|
||||||
|
*/
|
||||||
|
public List<ItemStack> getRewardItems();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player has any reward items left.
|
||||||
|
*
|
||||||
|
* @return if the player has any reward items left
|
||||||
|
*/
|
||||||
|
public boolean hasRewardItemsLeft();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player is currently breaking a global protection (=using /dxl break).
|
||||||
|
*
|
||||||
|
* @return if the player is currently breaking a global protection (=using /dxl break)
|
||||||
|
*/
|
||||||
|
boolean isInBreakMode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the player into or out of break mode; see {@link #isInBreakMode()}.
|
||||||
|
*
|
||||||
|
* @param breakMode if the player may break global protections
|
||||||
|
*/
|
||||||
|
void setInBreakMode(boolean breakMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a message to the player.
|
||||||
|
* <p>
|
||||||
|
* Supports color codes.
|
||||||
|
*
|
||||||
|
* @param message the message to send
|
||||||
|
*/
|
||||||
|
default void sendMessage(String message) {
|
||||||
|
MessageUtil.sendMessage(getPlayer(), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Respawns the player at his old position before he was in a dungeon.
|
||||||
|
*
|
||||||
|
* @param keepInventory if the saved status shall be reset
|
||||||
|
*/
|
||||||
|
void reset(boolean keepInventory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Respawns the player at his old position before he was in a dungeon.
|
||||||
|
*
|
||||||
|
* @param tpLoc the location where the player shall respawn
|
||||||
|
* @param keepInventory if the saved status shall be reset
|
||||||
|
*/
|
||||||
|
void reset(Location tpLoc, boolean keepInventory);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.player;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implement and register in order to track a group.
|
||||||
|
*
|
||||||
|
* @param <T> the external group object
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public abstract class GroupAdapter<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How the implementation handles players.
|
||||||
|
*/
|
||||||
|
public enum Philosophy {
|
||||||
|
/**
|
||||||
|
* The group persists upon restarts.
|
||||||
|
* <p>
|
||||||
|
* DungeonsXL under no circumstances creates persistent external groups.
|
||||||
|
*/
|
||||||
|
PERSISTENT,
|
||||||
|
/**
|
||||||
|
* The group continues to exist as long as the server is running, but does not persist upon restarts.
|
||||||
|
*/
|
||||||
|
RUNTIME,
|
||||||
|
/**
|
||||||
|
* Players are kicked from the group when they leave the server.
|
||||||
|
*/
|
||||||
|
ONLINE
|
||||||
|
}
|
||||||
|
|
||||||
|
private Philosophy philosophy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param philosophy the player handling philosophy
|
||||||
|
*/
|
||||||
|
protected GroupAdapter(Philosophy philosophy) {
|
||||||
|
this.philosophy = philosophy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player handling philosophy.
|
||||||
|
*
|
||||||
|
* @return the player handling philosophy
|
||||||
|
*/
|
||||||
|
public Philosophy getPhilosophy() {
|
||||||
|
return philosophy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a dungeon group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the external group.
|
||||||
|
*
|
||||||
|
* @param eGroup the external group
|
||||||
|
* @return a dungeon group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the external group
|
||||||
|
*/
|
||||||
|
public abstract PlayerGroup createPlayerGroup(T eGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an external group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the dungeon
|
||||||
|
* group.
|
||||||
|
*
|
||||||
|
* @param dGroup the dungeon group
|
||||||
|
* @return an external group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the dungeon group
|
||||||
|
*/
|
||||||
|
public abstract T createExternalGroup(PlayerGroup dGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dungeon group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the external
|
||||||
|
* group or null of none exists.
|
||||||
|
*
|
||||||
|
* @param eGroup the external group
|
||||||
|
* @return the dungeon group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the external
|
||||||
|
* group
|
||||||
|
*/
|
||||||
|
public abstract PlayerGroup getPlayerGroup(T eGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the external group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the dungeon
|
||||||
|
* group.
|
||||||
|
*
|
||||||
|
* @param dGroup the dungeon group
|
||||||
|
* @return the external group {@link #areCorresponding(PlayerGroup, Object) corresponding} with the dungeon
|
||||||
|
* group
|
||||||
|
*/
|
||||||
|
public abstract T getExternalGroup(PlayerGroup dGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dungeon group that mirrors the external group.
|
||||||
|
* <p>
|
||||||
|
* Creates a dungeon group if none exists.
|
||||||
|
*
|
||||||
|
* @param eGroup the dungeon group
|
||||||
|
* @return the dungeon group that mirrors the dungeon group
|
||||||
|
*/
|
||||||
|
public PlayerGroup getOrCreatePlayerGroup(T eGroup) {
|
||||||
|
PlayerGroup dGroup = getPlayerGroup(eGroup);
|
||||||
|
if (dGroup == null) {
|
||||||
|
dGroup = createPlayerGroup(eGroup);
|
||||||
|
}
|
||||||
|
return dGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the external group that mirrors the dungeon group.
|
||||||
|
* <p>
|
||||||
|
* Creates an external group if none exists.
|
||||||
|
*
|
||||||
|
* @param dGroup the dungeon group
|
||||||
|
* @return the external group that mirrors the dungeon group
|
||||||
|
*/
|
||||||
|
public T getOrCreateExternalGroup(PlayerGroup dGroup) {
|
||||||
|
T eGroup = getExternalGroup(dGroup);
|
||||||
|
if (eGroup == null && getPhilosophy() != Philosophy.PERSISTENT) {
|
||||||
|
eGroup = createExternalGroup(dGroup);
|
||||||
|
}
|
||||||
|
return eGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if two groups are corresponding.
|
||||||
|
* <p>
|
||||||
|
* Corresponding groups are groups that should be regarded as one from the perspective of a player.
|
||||||
|
* <p>
|
||||||
|
* Two null values are regarded as corresponding.
|
||||||
|
*
|
||||||
|
* @param dGroup the dungeon group
|
||||||
|
* @param eGroup the external group
|
||||||
|
* @return if the two groups are corresponding
|
||||||
|
*/
|
||||||
|
public abstract boolean areCorresponding(PlayerGroup dGroup, T eGroup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures that the player is in {@link #areCorresponding(PlayerGroup, Object) corresponding} groups.
|
||||||
|
* <p>
|
||||||
|
* If the player is in an external group but not in a corresponding dungeon group, they are added to the corresponding dungeon group.
|
||||||
|
* If no dungeon group exists, it is created automatically. Switching dungeon groups forces the player to leave their dungeon.
|
||||||
|
* <p>
|
||||||
|
* If the player is in a dungeon group but not in an external group, the player is added to the corresponding external group if it exists.
|
||||||
|
* If no corresponding external group exists, a new one is only created if the {@link #getPhilosophy() philosophy} is either
|
||||||
|
* {@link Philosophy#RUNTIME} or {@link Philosophy#ONLINE}.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
*/
|
||||||
|
public void syncPlayer(Player player) {
|
||||||
|
throw new UnsupportedOperationException("TODO");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.player;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a player in an instance.
|
||||||
|
* <p>
|
||||||
|
* All players in a world instantiated by DungeonsXL, have one wrapper object that is an instance of InstancePlayer.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: setWorld, clearPlayerData, delete, chat, update
|
||||||
|
public interface InstancePlayer extends GlobalPlayer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The world of the instance, where the player is supposed to be.
|
||||||
|
*
|
||||||
|
* @return the world of the instance
|
||||||
|
*/
|
||||||
|
World getWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the player leave his group and dungeon.
|
||||||
|
*/
|
||||||
|
void leave();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.player;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.CaliburnAPI;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a class and a class script.
|
||||||
|
*
|
||||||
|
* @author Frank Baumann, Daniel Saukel
|
||||||
|
*/
|
||||||
|
public class PlayerClass {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private List<ItemStack> items = new ArrayList<>();
|
||||||
|
private boolean dog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a PlayerClass from a class YAML file. The name is taken from the file name.
|
||||||
|
*
|
||||||
|
* @param caliburn the CaliburnAPI instance
|
||||||
|
* @param file the class config file
|
||||||
|
*/
|
||||||
|
public PlayerClass(CaliburnAPI caliburn, File file) {
|
||||||
|
this(caliburn, file.getName().substring(0, file.getName().length() - 4), YamlConfiguration.loadConfiguration(file));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a PlayerClass from the given class config.
|
||||||
|
*
|
||||||
|
* @param caliburn the CaliburnAPI instance
|
||||||
|
* @param name the class name
|
||||||
|
* @param config the config
|
||||||
|
*/
|
||||||
|
public PlayerClass(CaliburnAPI caliburn, String name, FileConfiguration config) {
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
if (config.contains("items")) {
|
||||||
|
items = caliburn.deserializeStackList(config, "items");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.contains("dog")) {
|
||||||
|
dog = config.getBoolean("dog");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerClass(String name, List<ItemStack> items, boolean dog) {
|
||||||
|
this.items = items;
|
||||||
|
this.name = name;
|
||||||
|
this.dog = dog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the class.
|
||||||
|
*
|
||||||
|
* @return the name of the class
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of the items this class gives to a player.
|
||||||
|
*
|
||||||
|
* @return the list of the the items this class gives to a player
|
||||||
|
*/
|
||||||
|
public List<ItemStack> getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given item to this class.
|
||||||
|
*
|
||||||
|
* @param itemStack the ItemStack to add
|
||||||
|
*/
|
||||||
|
public void addItem(ItemStack itemStack) {
|
||||||
|
items.add(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given item from this class.
|
||||||
|
*
|
||||||
|
* @param itemStack the ItemStack to remove
|
||||||
|
*/
|
||||||
|
public void removeItem(ItemStack itemStack) {
|
||||||
|
items.remove(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the class gives the player a dog.
|
||||||
|
*
|
||||||
|
* @return if the class has a dog
|
||||||
|
* @deprecated More dynamic pet features might make this obsolete in the future.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public boolean hasDog() {
|
||||||
|
return dog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the class gives the player a dog.
|
||||||
|
*
|
||||||
|
* @param dog if the class shall give the player a dog
|
||||||
|
* @deprecated More dynamic pet features might make this obsolete in the future.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setDog(boolean dog) {
|
||||||
|
this.dog = dog;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,402 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.player;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.item.ExItem;
|
||||||
|
import de.erethon.caliburn.item.VanillaItem;
|
||||||
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
|
import de.erethon.commons.compatibility.Version;
|
||||||
|
import de.erethon.commons.player.PlayerCollection;
|
||||||
|
import de.erethon.dungeonsxl.api.Reward;
|
||||||
|
import de.erethon.dungeonsxl.api.dungeon.Dungeon;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a group of players provided by DungeonsXL.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: setDungeon, setPlaying, [color, unplayed floor, floor count methods], isEmpty, isCustom, teleport,
|
||||||
|
// finish, finishFloor, startGame, winGame, requirements methods
|
||||||
|
public interface PlayerGroup {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Links different color types together.
|
||||||
|
*/
|
||||||
|
public enum Color {
|
||||||
|
|
||||||
|
BLACK(ChatColor.BLACK, DyeColor.BLACK, VanillaItem.BLACK_WOOL),
|
||||||
|
DARK_GRAY(ChatColor.DARK_GRAY, DyeColor.GRAY, VanillaItem.GRAY_WOOL),
|
||||||
|
LIGHT_GRAY(ChatColor.GRAY, DyeColor.valueOf(Version.isAtLeast(Version.MC1_13) ? "LIGHT_GRAY" : "SILVER"), VanillaItem.LIGHT_GRAY_WOOL),
|
||||||
|
WHITE(ChatColor.WHITE, DyeColor.WHITE, VanillaItem.WHITE_WOOL),
|
||||||
|
DARK_GREEN(ChatColor.DARK_GREEN, DyeColor.GREEN, VanillaItem.GREEN_WOOL),
|
||||||
|
LIGHT_GREEN(ChatColor.GREEN, DyeColor.LIME, VanillaItem.LIME_WOOL),
|
||||||
|
CYAN(ChatColor.DARK_AQUA, DyeColor.CYAN, VanillaItem.CYAN_WOOL),
|
||||||
|
DARK_BLUE(ChatColor.DARK_BLUE, DyeColor.BLUE, VanillaItem.BLUE_WOOL),
|
||||||
|
LIGHT_BLUE(ChatColor.AQUA, DyeColor.LIGHT_BLUE, VanillaItem.LIGHT_BLUE_WOOL),
|
||||||
|
PURPLE(ChatColor.DARK_PURPLE, DyeColor.PURPLE, VanillaItem.PURPLE_WOOL),
|
||||||
|
MAGENTA(ChatColor.LIGHT_PURPLE, DyeColor.MAGENTA, VanillaItem.MAGENTA_WOOL),
|
||||||
|
DARK_RED(ChatColor.DARK_RED, DyeColor.BROWN, VanillaItem.BROWN_WOOL),
|
||||||
|
LIGHT_RED(ChatColor.RED, DyeColor.RED, VanillaItem.RED_WOOL),
|
||||||
|
ORANGE(ChatColor.GOLD, DyeColor.ORANGE, VanillaItem.ORANGE_WOOL),
|
||||||
|
YELLOW(ChatColor.YELLOW, DyeColor.YELLOW, VanillaItem.YELLOW_WOOL),
|
||||||
|
PINK(ChatColor.BLUE, DyeColor.PINK, VanillaItem.PINK_WOOL);
|
||||||
|
|
||||||
|
private ChatColor chat;
|
||||||
|
private DyeColor dye;
|
||||||
|
private VanillaItem woolMaterial;
|
||||||
|
|
||||||
|
Color(ChatColor chat, DyeColor dye, VanillaItem woolMaterial) {
|
||||||
|
this.chat = chat;
|
||||||
|
this.dye = dye;
|
||||||
|
this.woolMaterial = woolMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ChatColor.
|
||||||
|
*
|
||||||
|
* @return the ChatColor
|
||||||
|
*/
|
||||||
|
public ChatColor getChatColor() {
|
||||||
|
return chat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the DyeColor.
|
||||||
|
*
|
||||||
|
* @return the DyeColor
|
||||||
|
*/
|
||||||
|
public DyeColor getDyeColor() {
|
||||||
|
return dye;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the RGB value.
|
||||||
|
*
|
||||||
|
* @return the RGB value
|
||||||
|
*/
|
||||||
|
public int getRGBColor() {
|
||||||
|
return dye.getColor().asRGB();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the wool material.
|
||||||
|
*
|
||||||
|
* @return the wool material
|
||||||
|
*/
|
||||||
|
public VanillaItem getWoolMaterial() {
|
||||||
|
return woolMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the GroupColor matching the ChatColor or null if none exists.
|
||||||
|
*
|
||||||
|
* @param color the ChatColor to check
|
||||||
|
* @return the GroupColor matching the ChatColor or null if none exists
|
||||||
|
*/
|
||||||
|
public static Color getByChatColor(ChatColor color) {
|
||||||
|
for (Color groupColor : values()) {
|
||||||
|
if (groupColor.chat == color) {
|
||||||
|
return groupColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the GroupColor matching the DyeColor or null if none exists.
|
||||||
|
*
|
||||||
|
* @param color the DyeColor to check
|
||||||
|
* @return the GroupColor matching the DyeColor or null if none exists.
|
||||||
|
*/
|
||||||
|
public static Color getByDyeColor(DyeColor color) {
|
||||||
|
for (Color groupColor : values()) {
|
||||||
|
if (groupColor.dye == color) {
|
||||||
|
return groupColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the GroupColor matching the wool material or null if none exists.
|
||||||
|
*
|
||||||
|
* @param wool the wool material to check
|
||||||
|
* @return the GroupColor matching the wool material or null if none exists
|
||||||
|
*/
|
||||||
|
public static Color getByWoolType(ExItem wool) {
|
||||||
|
for (Color groupColor : values()) {
|
||||||
|
if (groupColor.woolMaterial == wool) {
|
||||||
|
return groupColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ID.
|
||||||
|
*
|
||||||
|
* @return the ID
|
||||||
|
*/
|
||||||
|
int getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the formatted name.
|
||||||
|
* <p>
|
||||||
|
* This is the name used e.g. in messages.
|
||||||
|
*
|
||||||
|
* @return the formatted name
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw, unformatted name.
|
||||||
|
* <p>
|
||||||
|
* This is the name used e.g. in command arguments.
|
||||||
|
*
|
||||||
|
* @return the raw, unformatted name
|
||||||
|
*/
|
||||||
|
String getRawName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name.
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
*/
|
||||||
|
void setName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name to a default value taken from the color.
|
||||||
|
* <p>
|
||||||
|
* In the default implementation, this is nameOfTheColor#{@link #getId()}
|
||||||
|
*
|
||||||
|
* @param color the color
|
||||||
|
*/
|
||||||
|
default void setName(Color color) {
|
||||||
|
setName(color.toString() + "#" + getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The player who has permission to manage the group.
|
||||||
|
*
|
||||||
|
* @return the player who has permission to manage the group
|
||||||
|
*/
|
||||||
|
Player getLeader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the leader to another group member.
|
||||||
|
*
|
||||||
|
* @param player the new leader
|
||||||
|
*/
|
||||||
|
void setLeader(Player player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a PlayerCollection of the group members
|
||||||
|
*
|
||||||
|
* @return a PlayerCollection of the group members
|
||||||
|
*/
|
||||||
|
PlayerCollection getMembers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a player to the group.
|
||||||
|
* <p>
|
||||||
|
* The default implemenation calls {@link #addPlayer(Player, boolean)} with messages set to true.
|
||||||
|
*
|
||||||
|
* @param player the player to add
|
||||||
|
*/
|
||||||
|
default void addPlayer(Player player) {
|
||||||
|
addPlayer(player, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a player to the group.
|
||||||
|
*
|
||||||
|
* @param player the player to add
|
||||||
|
* @param message if messages shall be sent
|
||||||
|
*/
|
||||||
|
void addPlayer(Player player, boolean message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a player from the group.
|
||||||
|
* <p>
|
||||||
|
* The default implemenation calls {@link #removePlayer(Player, boolean)} with messages set to true.
|
||||||
|
*
|
||||||
|
* @param player the player to add
|
||||||
|
*/
|
||||||
|
default void removePlayer(Player player) {
|
||||||
|
addPlayer(player, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a player from the group.
|
||||||
|
*
|
||||||
|
* @param player the player to add
|
||||||
|
* @param message if messages shall be sent
|
||||||
|
*/
|
||||||
|
void removePlayer(Player player, boolean message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a PlayerCollection of the players who are invited to join the group but did not yet do so.
|
||||||
|
*
|
||||||
|
* @return a PlayerCollection of the players who are invited to join the group but did not yet do so
|
||||||
|
*/
|
||||||
|
PlayerCollection getInvitedPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invites a player to join the group.
|
||||||
|
*
|
||||||
|
* @param player the player to invite
|
||||||
|
* @param message if messages shall be sent
|
||||||
|
*/
|
||||||
|
void addInvitedPlayer(Player player, boolean message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an invitation priviously made for a player to join the group.
|
||||||
|
*
|
||||||
|
* @param player the player to uninvite
|
||||||
|
* @param message if messages shall be sent
|
||||||
|
*/
|
||||||
|
void removeInvitedPlayer(Player player, boolean message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all invitations for players who are not online.
|
||||||
|
*/
|
||||||
|
void clearOfflineInvitedPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game world the group is in.
|
||||||
|
*
|
||||||
|
* @return the game world the group is in
|
||||||
|
*/
|
||||||
|
GameWorld getGameWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the game world the group is in.
|
||||||
|
*
|
||||||
|
* @param gameWorld the game world to set
|
||||||
|
*/
|
||||||
|
void setGameWorld(GameWorld gameWorld);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dungeon the group is playing or has remembered to play next.
|
||||||
|
* <p>
|
||||||
|
* The latter is for example used when a group is created by a group sign sothat a portal or the auto-join function knows where to send the group.
|
||||||
|
*
|
||||||
|
* @return the dungeon the group is playing or has remembered to play next
|
||||||
|
*/
|
||||||
|
Dungeon getDungeon();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the group is already playing its remembered {@link #getDungeon() dungeon}.
|
||||||
|
*
|
||||||
|
* @return if the group is already playing its remembered {@link #getDungeon() dungeon}
|
||||||
|
*/
|
||||||
|
boolean isPlaying();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the rewards that are memorized for the group. These are given when the game is finished.
|
||||||
|
*
|
||||||
|
* @return the rewards
|
||||||
|
*/
|
||||||
|
List<Reward> getRewards();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memorizes the given reward for the group. These are given when the game is finished.
|
||||||
|
*
|
||||||
|
* @param reward the reward
|
||||||
|
*/
|
||||||
|
void addReward(Reward reward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given reward.
|
||||||
|
*
|
||||||
|
* @param reward the reward
|
||||||
|
*/
|
||||||
|
void removeReward(Reward reward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the initial amount of lives or -1 if group lives are not used.
|
||||||
|
*
|
||||||
|
* @return the initial amount of lives or -1 if group lives are not used
|
||||||
|
*/
|
||||||
|
int getInitialLives();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the initial amount of lives.
|
||||||
|
* <p>
|
||||||
|
* The value must be >=0 or -1, which means unlimited lives.
|
||||||
|
*
|
||||||
|
* @param lives the new amount of lives known as the initial amount
|
||||||
|
*/
|
||||||
|
void setInitialLives(int lives);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the amount of lives the group currently has left or -1 if group lives are not used.
|
||||||
|
*
|
||||||
|
* @return the amount of lives the group currently has left or -1 if group lives are not used
|
||||||
|
*/
|
||||||
|
int getLives();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the amount of lives the group currently has left.
|
||||||
|
* <p>
|
||||||
|
* The value must be >=0 or -1, which means unlimited lives.
|
||||||
|
*
|
||||||
|
* @param lives the amount of lives the group currently has left
|
||||||
|
*/
|
||||||
|
void setLives(int lives);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if all players of the group have finished the game; false if not.
|
||||||
|
*
|
||||||
|
* @return true if all players of the group have finished the game; false if not
|
||||||
|
*/
|
||||||
|
boolean isFinished();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disbands the group.
|
||||||
|
*/
|
||||||
|
void delete();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a message to all players in the group.
|
||||||
|
* <p>
|
||||||
|
* Supports color codes.
|
||||||
|
*
|
||||||
|
* @param message the message to sent
|
||||||
|
* @param except Players who shall not receive the message
|
||||||
|
*/
|
||||||
|
default void sendMessage(String message, Player... except) {
|
||||||
|
members:
|
||||||
|
for (Player player : getMembers().getOnlinePlayers()) {
|
||||||
|
if (!player.isOnline()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (Player nope : except) {
|
||||||
|
if (player == nope) {
|
||||||
|
continue members;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MessageUtil.sendMessage(player, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.item.VanillaItem;
|
||||||
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
|
import de.erethon.dungeonsxl.api.Trigger;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeletal implementation of {@link DungeonSign}.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public abstract class AbstractDSign implements DungeonSign {
|
||||||
|
|
||||||
|
public static final String ERROR_0 = ChatColor.DARK_RED + "## ERROR ##";
|
||||||
|
public static final String ERROR_1 = ChatColor.WHITE + "Please";
|
||||||
|
public static final String ERROR_2 = ChatColor.WHITE + "contact an";
|
||||||
|
public static final String ERROR_3 = ChatColor.WHITE + "Admin!";
|
||||||
|
|
||||||
|
protected DungeonsAPI api;
|
||||||
|
private Sign sign;
|
||||||
|
private String[] lines;
|
||||||
|
private GameWorld gameWorld;
|
||||||
|
private Set<Trigger> triggers = new HashSet<>();
|
||||||
|
private boolean initialized;
|
||||||
|
private boolean erroneous;
|
||||||
|
|
||||||
|
protected AbstractDSign(DungeonsAPI api, Sign sign, String[] lines, GameWorld gameWorld) {
|
||||||
|
this.api = api;
|
||||||
|
this.sign = sign;
|
||||||
|
this.lines = lines;
|
||||||
|
this.gameWorld = gameWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Sign getSign() {
|
||||||
|
return sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getLines() {
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GameWorld getGameWorld() {
|
||||||
|
return gameWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Trigger> getTriggers() {
|
||||||
|
return triggers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTrigger(Trigger trigger) {
|
||||||
|
triggers.add(trigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeTrigger(Trigger trigger) {
|
||||||
|
triggers.remove(trigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setToAir() {
|
||||||
|
sign.getBlock().setType(VanillaItem.AIR.getMaterial());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isErroneous() {
|
||||||
|
return erroneous;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markAsErroneous(String reason) {
|
||||||
|
erroneous = true;
|
||||||
|
sign.setLine(0, ERROR_0);
|
||||||
|
sign.setLine(1, ERROR_1);
|
||||||
|
sign.setLine(2, ERROR_2);
|
||||||
|
sign.setLine(3, ERROR_3);
|
||||||
|
sign.update();
|
||||||
|
|
||||||
|
MessageUtil.log(api, "&4A sign at &6" + sign.getX() + ", " + sign.getY() + ", " + sign.getZ() + "&4 is erroneous!");
|
||||||
|
MessageUtil.log(api, getName() + ": " + reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
100
api/src/main/java/de/erethon/dungeonsxl/api/sign/Button.java
Normal file
100
api/src/main/java/de/erethon/dungeonsxl/api/sign/Button.java
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
|
import de.erethon.dungeonsxl.api.Trigger;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A sign that performs a specific action every time it is triggered. It can have, but typically does not have a state. Consider using {@link Deactivatable) for
|
||||||
|
* sign that change themselves when they are triggered.
|
||||||
|
* <p>
|
||||||
|
* For example, a classes sign with the default interact trigger sets your class every time you punch it.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public abstract class Button extends AbstractDSign {
|
||||||
|
|
||||||
|
protected Button(DungeonsAPI api, Sign sign, String[] lines, GameWorld gameWorld) {
|
||||||
|
super(api, sign, lines, gameWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the sign is triggered without one particular player being the cause.
|
||||||
|
* <p>
|
||||||
|
* <b>Note that the default implementation of {@link #push(org.bukkit.entity.Player)} assumes that the sign does not need player specific behavior and
|
||||||
|
* simply calls this method, while the default implementation of this method assumes that the sign should perform {@link #push(org.bukkit.entity.Player)}
|
||||||
|
* for each player in the game world. This leaves a button sign with a stackoverflow if not one of both methods at least is overriden. Consider using a
|
||||||
|
* {@link Passive} sign instead if you need a sign that simply marks places and ignores being triggered.</b>
|
||||||
|
*/
|
||||||
|
public void push() {
|
||||||
|
getGameWorld().getPlayers().forEach(p -> push(p.getPlayer()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the sign is triggered.
|
||||||
|
* <p>
|
||||||
|
* This is the default {@link #trigger(org.bukkit.entity.Player)} behavior.
|
||||||
|
* <p>
|
||||||
|
* <b>Note that the default implementation of this method assumes that the sign does not need player specific behavior and simply calls {@link #push()},
|
||||||
|
* while the default implementation of {@link #push()} assumes that the sign should perform {@link #push(org.bukkit.entity.Player)} for each player in the
|
||||||
|
* game world. This leaves a button sign with a stackoverflow if not one of both methods at least is overriden. Consider using a {@link Passive} sign
|
||||||
|
* instead if you need a sign that simply marks places and ignores being triggered.</b>
|
||||||
|
*
|
||||||
|
* @param player the player who triggered the sign
|
||||||
|
* @return if the action is done successfully
|
||||||
|
*/
|
||||||
|
public boolean push(Player player) {
|
||||||
|
push();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
if (isErroneous()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Trigger trigger : getTriggers()) {
|
||||||
|
if (!trigger.isTriggered()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trigger.getPlayer() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (push(trigger.getPlayer())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
push();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the same as {@link #push(org.bukkit.entity.Player)}.
|
||||||
|
*
|
||||||
|
* @param player the player who triggered the sign or null if no one in particular triggered it
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void trigger(Player player) {
|
||||||
|
push(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
|
import de.erethon.commons.player.PlayerCollection;
|
||||||
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
|
import de.erethon.dungeonsxl.api.Trigger;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link DungeonSign} that changes its state when triggered.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public abstract class Deactivatable extends AbstractDSign {
|
||||||
|
|
||||||
|
protected boolean active;
|
||||||
|
private PlayerCollection playersActivated = new PlayerCollection();
|
||||||
|
|
||||||
|
protected Deactivatable(DungeonsAPI api, Sign sign, String[] lines, GameWorld gameWorld) {
|
||||||
|
super(api, sign, lines, gameWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state to active.
|
||||||
|
* <p>
|
||||||
|
* This might not be meaningful if the sign uses {@link #activate(org.bukkit.entity.Player)}.
|
||||||
|
*/
|
||||||
|
public void activate() {
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state to active for the given player.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
* @return if the action was successful
|
||||||
|
*/
|
||||||
|
public boolean activate(Player player) {
|
||||||
|
return playersActivated.add(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state to inactive.
|
||||||
|
* <p>
|
||||||
|
* This might not be meaningful if the sign uses {@link #deactivate(org.bukkit.entity.Player)}.
|
||||||
|
*/
|
||||||
|
public void deactivate() {
|
||||||
|
active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state to inactive for the given player.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
* @return if the action was successful
|
||||||
|
*/
|
||||||
|
public boolean deactivate(Player player) {
|
||||||
|
return playersActivated.remove(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign is currently in its activated state.
|
||||||
|
* <p>
|
||||||
|
* This might not be meaningful if the sign uses {@link #isActive(org.bukkit.entity.Player)}.
|
||||||
|
*
|
||||||
|
* @return if the sign is currently in its activated state
|
||||||
|
*/
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign is activated for the given player.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
* @return if the sign is activated for the given player
|
||||||
|
*/
|
||||||
|
public boolean isActive(Player player) {
|
||||||
|
return playersActivated.contains(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
if (isErroneous()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Trigger trigger : getTriggers()) {
|
||||||
|
if (!trigger.isTriggered()) {
|
||||||
|
deactivate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trigger.getPlayer() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activate(trigger.getPlayer())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,178 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.Trigger;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for all dungeon signs.
|
||||||
|
*
|
||||||
|
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface DungeonSign {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name to identify the sign.
|
||||||
|
*
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the permission node that is required to build a sign of this type.
|
||||||
|
*
|
||||||
|
* @return the build permission
|
||||||
|
*/
|
||||||
|
String getBuildPermission();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign gets initialized when the dungeon is loaded instead of when the game starts.
|
||||||
|
*
|
||||||
|
* @return if the sign gets initialized when the dungeon is loaded instead of when the game starts
|
||||||
|
*/
|
||||||
|
boolean isOnDungeonInit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign block is breakable after the initialization.
|
||||||
|
*
|
||||||
|
* @return if the sign block is breakable after the initialization
|
||||||
|
*/
|
||||||
|
boolean isProtected();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the block type of the sign is set to air after the initialization.
|
||||||
|
*
|
||||||
|
* @return if the block type of the sign is set to air after the initialization
|
||||||
|
*/
|
||||||
|
boolean isSetToAir();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the sign that represents event point.
|
||||||
|
*
|
||||||
|
* @return the sign that represents event point
|
||||||
|
*/
|
||||||
|
Sign getSign();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw lines of this sign in an array with 4 elements.
|
||||||
|
*
|
||||||
|
* @return the raw lines of this sign in an array with 4 elements
|
||||||
|
*/
|
||||||
|
String[] getLines();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game world this sign is in; null if this is an edit world.
|
||||||
|
*
|
||||||
|
* @return the game world this sign is in; null if this is an edit world
|
||||||
|
*/
|
||||||
|
GameWorld getGameWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Set of the triggers registered for this sign.
|
||||||
|
*
|
||||||
|
* @return a Set of the triggers registered for this sign
|
||||||
|
*/
|
||||||
|
Set<Trigger> getTriggers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign has triggers.
|
||||||
|
*
|
||||||
|
* @return if the sign has triggers
|
||||||
|
*/
|
||||||
|
default boolean hasTriggers() {
|
||||||
|
return !getTriggers().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a trigger to the sign.
|
||||||
|
*
|
||||||
|
* @param trigger the trigger
|
||||||
|
*/
|
||||||
|
void addTrigger(Trigger trigger);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to remove a trigger from the sign.
|
||||||
|
*
|
||||||
|
* @param trigger the trigger
|
||||||
|
*/
|
||||||
|
void removeTrigger(Trigger trigger);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the sign listen for its triggers if it {@link #hasTriggers()}.
|
||||||
|
* <p>
|
||||||
|
* {@link #trigger(org.bukkit.entity.Player)}s the sign if it does not have any triggers.
|
||||||
|
* (Note that some signs have interaction triggers by default, like ready signs).
|
||||||
|
*/
|
||||||
|
void initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign is {@link #initialize()}d.
|
||||||
|
*
|
||||||
|
* @return if the sign is {@link #initialize()}d
|
||||||
|
*/
|
||||||
|
boolean isInitialized();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers the sign. The effects are defined by the implementation.
|
||||||
|
*
|
||||||
|
* @param player the player who triggered the sign or null if no one in particular triggered it
|
||||||
|
*/
|
||||||
|
void trigger(Player player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the sign.
|
||||||
|
*/
|
||||||
|
void update();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the sign to air if it is not erroneous and if its type requires this.
|
||||||
|
* <p>
|
||||||
|
* Signs are usually to be set to air upon initialization, but this is not done automatically because some signs need different behavior. Script signs for
|
||||||
|
* example are not set to air because this would override whatever a block sign in its script does.
|
||||||
|
*
|
||||||
|
* @return if the sign type was set to air
|
||||||
|
*/
|
||||||
|
boolean setToAir();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign is valid.
|
||||||
|
* <p>
|
||||||
|
* A sign is invalid when it lacks needed parameters or if illegal arguments have been entered.
|
||||||
|
*
|
||||||
|
* @return if the sign is valid
|
||||||
|
*/
|
||||||
|
default boolean validate() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the sign is erroneous.
|
||||||
|
*
|
||||||
|
* @return if the sign is erroneous
|
||||||
|
*/
|
||||||
|
boolean isErroneous();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a placeholder to show that the sign is setup incorrectly.
|
||||||
|
*
|
||||||
|
* @param reason the reason why the sign is marked as erroneous
|
||||||
|
*/
|
||||||
|
void markAsErroneous(String reason);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A sign that does not do anything on its own. Its function is mostly to mark locations or blocks, like lobby or bed signs.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public abstract class Passive extends AbstractDSign {
|
||||||
|
|
||||||
|
protected Passive(DungeonsAPI api, Sign sign, String[] lines, GameWorld gameWorld) {
|
||||||
|
super(api, sign, lines, gameWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does nothing.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final void update() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does nothing.
|
||||||
|
*
|
||||||
|
* @param player unused
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final void trigger(Player player) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
50
api/src/main/java/de/erethon/dungeonsxl/api/sign/Rocker.java
Normal file
50
api/src/main/java/de/erethon/dungeonsxl/api/sign/Rocker.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A sign that has a <i>deactivated</i> and an <i>activated state</i> and can switch between these two.
|
||||||
|
* <p>
|
||||||
|
* For example, if a door sign is activated, the door opens - if it is deactivated, the door closes. The state may be set for the whole game world or for the
|
||||||
|
* player who triggered the sign depending on the context.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public abstract class Rocker extends Deactivatable {
|
||||||
|
|
||||||
|
protected Rocker(DungeonsAPI api, Sign sign, String[] lines, GameWorld gameWorld) {
|
||||||
|
super(api, sign, lines, gameWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activates the sign if it is not yet active and deactivates it if it is already active.
|
||||||
|
*
|
||||||
|
* @param player the player who triggered the sign or null if no one in particular triggered it
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void trigger(Player player) {
|
||||||
|
if (!isActive()) {
|
||||||
|
activate(player);
|
||||||
|
} else {
|
||||||
|
deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
61
api/src/main/java/de/erethon/dungeonsxl/api/sign/Windup.java
Normal file
61
api/src/main/java/de/erethon/dungeonsxl/api/sign/Windup.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.sign;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A sign with an attached task that does actions in a set interval {@link #n} times, like a mob sign that spawns {@link #n} mobs. It is similar to a
|
||||||
|
* {@link Rocker} as it expires (=is deactivated).
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public abstract class Windup extends Deactivatable {
|
||||||
|
|
||||||
|
protected double interval = -1;
|
||||||
|
/**
|
||||||
|
* How many times the task is supposed to be executed (unless it is cancelled).
|
||||||
|
*/
|
||||||
|
protected int n;
|
||||||
|
/**
|
||||||
|
* How many times the task has been executed.
|
||||||
|
*/
|
||||||
|
protected int k;
|
||||||
|
|
||||||
|
protected Windup(DungeonsAPI api, Sign sign, String[] lines, GameWorld gameWorld) {
|
||||||
|
super(api, sign, lines, gameWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the task interval in seconds.
|
||||||
|
*
|
||||||
|
* @return the task interval
|
||||||
|
*/
|
||||||
|
public double getIntervalSeconds() {
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the task interval in seconds.
|
||||||
|
*
|
||||||
|
* @return the task interval
|
||||||
|
*/
|
||||||
|
public long getIntervalTicks() {
|
||||||
|
return (long) (interval * 20L);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.world;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A raw resource world instance to edit the dungeon map. There is never more than one edit world per resource world.
|
||||||
|
* <p>
|
||||||
|
* An edit world is not equal to a {@link de.erethon.dungeonsxl.api.dungeon.Dungeon}.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface EditWorld extends InstanceWorld {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the block as a {@link de.erethon.dungeonsxl.api.sign.DungeonSign} sothat it can later be saved persistently.
|
||||||
|
*
|
||||||
|
* @param block a DungeonSign block
|
||||||
|
*/
|
||||||
|
void registerSign(Block block);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the sign data and overrides the resource with the changes.
|
||||||
|
*/
|
||||||
|
void save();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void delete() {
|
||||||
|
delete(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes this edit instance.
|
||||||
|
*
|
||||||
|
* @param save whether this world should be {@link #save()}ed
|
||||||
|
*/
|
||||||
|
void delete(boolean save);
|
||||||
|
|
||||||
|
}
|
105
api/src/main/java/de/erethon/dungeonsxl/api/world/GameWorld.java
Normal file
105
api/src/main/java/de/erethon/dungeonsxl/api/world/GameWorld.java
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.world;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.dungeon.Dungeon;
|
||||||
|
import de.erethon.dungeonsxl.api.dungeon.Game;
|
||||||
|
import de.erethon.dungeonsxl.api.mob.DungeonMob;
|
||||||
|
import java.util.Collection;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A playable resource instance. There may be any amount of GameWorlds per {@link ResourceWorld}.
|
||||||
|
* <p>
|
||||||
|
* A game world is not equal to a {@link de.erethon.dungeonsxl.api.dungeon.Dungeon}.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: [gameblock, secure objects, classes signs, mobs, triggers] methods, getMobCount(), setPlaying(), startGame(), listener methods
|
||||||
|
public interface GameWorld extends InstanceWorld {
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
START_FLOOR,
|
||||||
|
END_FLOOR,
|
||||||
|
DEFAULT
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link Type} of this GameWorld.
|
||||||
|
*
|
||||||
|
* @return the {@link Type} of this GameWorld
|
||||||
|
*/
|
||||||
|
Type getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the {@link Type} of this GameWorld.
|
||||||
|
*
|
||||||
|
* @param type the type
|
||||||
|
*/
|
||||||
|
void setType(Type type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game that is played in the game world.
|
||||||
|
*
|
||||||
|
* @return the game that is played in the game world
|
||||||
|
*/
|
||||||
|
Game getGame();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dungeon that the game world is part of.
|
||||||
|
* <p>
|
||||||
|
* Note: While a {@link ResourceWorld} may be part of multiple dungeons, an instance is instantiated per game and thus has just one dungeon.
|
||||||
|
*
|
||||||
|
* @return the dungeon that the game world is part of
|
||||||
|
*/
|
||||||
|
Dungeon getDungeon();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the living dungeon mobs
|
||||||
|
*
|
||||||
|
* @return the living dungeon mobs
|
||||||
|
*/
|
||||||
|
Collection<DungeonMob> getMobs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the given dungeon mob
|
||||||
|
*
|
||||||
|
* @param mob the mob
|
||||||
|
*/
|
||||||
|
void addMob(DungeonMob mob);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters the given dungeon mob
|
||||||
|
*
|
||||||
|
* @param mob the mob
|
||||||
|
*/
|
||||||
|
public void removeMob(DungeonMob mob);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the game has begun in the game world.
|
||||||
|
*
|
||||||
|
* @return if the game has begun in the game world
|
||||||
|
*/
|
||||||
|
boolean isPlaying();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the start location of the world. This may be set by a start {@link de.erethon.dungeonsxl.api.sign.DungeonSign sign} or, if none exists, the
|
||||||
|
* Vanilla spawn location of the {@link #getWorld() world}.
|
||||||
|
*
|
||||||
|
* @return the start location of the world
|
||||||
|
*/
|
||||||
|
Location getStartLocation();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.world;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.player.InstancePlayer;
|
||||||
|
import de.erethon.dungeonsxl.api.sign.DungeonSign;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Super interface for worlds that are instantiated by DungeonsXL.
|
||||||
|
* <p>
|
||||||
|
* An instance world is not equal to a {@link de.erethon.dungeonsxl.api.dungeon.Dungeon}.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: getConfig, exists, setWeather
|
||||||
|
public interface InstanceWorld {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the resource world of this instance.
|
||||||
|
* <p>
|
||||||
|
* Use {@link #getWorld()}{@link org.bukkit.World#getName() #getName()} to get the name of the instantiated world (like e.g. DXL_Game_1).
|
||||||
|
*
|
||||||
|
* @return the name of the resource world of this instance
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the saved map this instance was loaded from.
|
||||||
|
*
|
||||||
|
* @return the saved map this instance was loaded from
|
||||||
|
*/
|
||||||
|
ResourceWorld getResource();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the world folder.
|
||||||
|
*
|
||||||
|
* @return the world folder
|
||||||
|
*/
|
||||||
|
File getFolder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the wrapped Bukkit world.
|
||||||
|
*
|
||||||
|
* @return the wrapped Bukkit world
|
||||||
|
*/
|
||||||
|
World getWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ID. This is usually the number in the map name.
|
||||||
|
*
|
||||||
|
* @return the ID
|
||||||
|
*/
|
||||||
|
int getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a collection of the signs in this instance.
|
||||||
|
*
|
||||||
|
* @return a collection of the signs in this instance
|
||||||
|
*/
|
||||||
|
Collection<DungeonSign> getDungeonSigns();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a dungeon sign to this instance.
|
||||||
|
*
|
||||||
|
* @param sign the sign
|
||||||
|
*/
|
||||||
|
void addDungeonSign(DungeonSign sign);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a dungeon sign from this instance.
|
||||||
|
*
|
||||||
|
* @param sign the sign
|
||||||
|
*/
|
||||||
|
void removeDungeonSign(DungeonSign sign);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the location of the lobby where players spawn by default when they are teleported into the dungeon.
|
||||||
|
*
|
||||||
|
* @return the location of the lobby where players spawn by default when they are teleported into the dungeon
|
||||||
|
*/
|
||||||
|
Location getLobbyLocation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default spawn location of the instance.
|
||||||
|
* <p>
|
||||||
|
* This is not persistent and does not create a lobby sign.
|
||||||
|
*
|
||||||
|
* @param location the location
|
||||||
|
*/
|
||||||
|
void setLobbyLocation(Location location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the players in the instance.
|
||||||
|
*
|
||||||
|
* @return the players in the instance
|
||||||
|
*/
|
||||||
|
Collection<InstancePlayer> getPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a message to all players in the instance.
|
||||||
|
*
|
||||||
|
* @param message the message to send
|
||||||
|
*/
|
||||||
|
void sendMessage(String message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes all players leave the world. Attempts to let them leave properly if they are correct DInstancePlayers; teleports them to the spawn if they are not.
|
||||||
|
*/
|
||||||
|
void kickAllPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes this instance.
|
||||||
|
*/
|
||||||
|
void delete();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api.world;
|
||||||
|
|
||||||
|
import de.erethon.dungeonsxl.api.dungeon.Dungeon;
|
||||||
|
import java.io.File;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A stored world that can be instantiated as an {@link EditWorld} or as a {@link GameWorld}.
|
||||||
|
* <p>
|
||||||
|
* In the default implementation, these are saved under "plugins/DungeonsXL/maps/".
|
||||||
|
* <p>
|
||||||
|
* A resource world is not equal to a {@link de.erethon.dungeonsxl.api.dungeon.Dungeon}.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
// Implementation-specific methods: getConfig, getSignData, generate
|
||||||
|
public interface ResourceWorld {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of this resource world.
|
||||||
|
* <p>
|
||||||
|
* Equals {@link #getFolder()}{@link File#getName() #getName()}.
|
||||||
|
*
|
||||||
|
* @return name of this resource world
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renames the resource world and its folder.
|
||||||
|
*
|
||||||
|
* @param name the new name
|
||||||
|
*/
|
||||||
|
void setName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the folder where this resource is stored.
|
||||||
|
*
|
||||||
|
* @return the folder where this resource is stored
|
||||||
|
*/
|
||||||
|
File getFolder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the environment of the world as defined in the config or {@link org.bukkit.World.Environment#NORMAL} if nothing is set.
|
||||||
|
*
|
||||||
|
* @return the environment of the world as defined in the config or {@link org.bukkit.World.Environment#NORMAL} if nothing is set
|
||||||
|
*/
|
||||||
|
Environment getWorldEnvironment();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the player to the list of players that are invited to edit the resource.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
*/
|
||||||
|
void addInvitedPlayer(OfflinePlayer player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the player is invited to edit the resource.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
* @return if the player is invited to edit the resource
|
||||||
|
*/
|
||||||
|
boolean isInvitedPlayer(OfflinePlayer player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a backup of the resource.
|
||||||
|
*/
|
||||||
|
void backup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the loaded edit instance of this world or generates a new one if none exists.
|
||||||
|
*
|
||||||
|
* @return the loaded edit instance of this world or generates a new one if none exists
|
||||||
|
*/
|
||||||
|
EditWorld getOrInstantiateEditWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new game instance of this resource.
|
||||||
|
*
|
||||||
|
* @return a new game instance of this resource
|
||||||
|
*/
|
||||||
|
GameWorld instantiateGameWorld();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the single floor dungeon of this resource.
|
||||||
|
*
|
||||||
|
* @return the single floor dungeon of this resource
|
||||||
|
*/
|
||||||
|
Dungeon getSingleFloorDungeon();
|
||||||
|
|
||||||
|
}
|
@ -1,126 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.erethon.dungeonsxl.util;
|
|
||||||
|
|
||||||
import de.erethon.caliburn.item.ExItem;
|
|
||||||
import de.erethon.caliburn.item.VanillaItem;
|
|
||||||
import de.erethon.commons.compatibility.Version;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.DyeColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Links different color types together.
|
|
||||||
*
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public enum DColor {
|
|
||||||
|
|
||||||
BLACK(ChatColor.BLACK, DyeColor.BLACK, VanillaItem.BLACK_WOOL),
|
|
||||||
DARK_GRAY(ChatColor.DARK_GRAY, DyeColor.GRAY, VanillaItem.GRAY_WOOL),
|
|
||||||
LIGHT_GRAY(ChatColor.GRAY, DyeColor.valueOf(Version.isAtLeast(Version.MC1_13) ? "LIGHT_GRAY" : "SILVER"), VanillaItem.LIGHT_GRAY_WOOL),
|
|
||||||
WHITE(ChatColor.WHITE, DyeColor.WHITE, VanillaItem.WHITE_WOOL),
|
|
||||||
DARK_GREEN(ChatColor.DARK_GREEN, DyeColor.GREEN, VanillaItem.GREEN_WOOL),
|
|
||||||
LIGHT_GREEN(ChatColor.GREEN, DyeColor.LIME, VanillaItem.LIME_WOOL),
|
|
||||||
CYAN(ChatColor.DARK_AQUA, DyeColor.CYAN, VanillaItem.CYAN_WOOL),
|
|
||||||
DARK_BLUE(ChatColor.DARK_BLUE, DyeColor.BLUE, VanillaItem.BLUE_WOOL),
|
|
||||||
LIGHT_BLUE(ChatColor.AQUA, DyeColor.LIGHT_BLUE, VanillaItem.LIGHT_BLUE_WOOL),
|
|
||||||
PURPLE(ChatColor.DARK_PURPLE, DyeColor.PURPLE, VanillaItem.PURPLE_WOOL),
|
|
||||||
MAGENTA(ChatColor.LIGHT_PURPLE, DyeColor.MAGENTA, VanillaItem.MAGENTA_WOOL),
|
|
||||||
DARK_RED(ChatColor.DARK_RED, DyeColor.BROWN, VanillaItem.BROWN_WOOL),
|
|
||||||
LIGHT_RED(ChatColor.RED, DyeColor.RED, VanillaItem.RED_WOOL),
|
|
||||||
ORANGE(ChatColor.GOLD, DyeColor.ORANGE, VanillaItem.ORANGE_WOOL),
|
|
||||||
YELLOW(ChatColor.YELLOW, DyeColor.YELLOW, VanillaItem.YELLOW_WOOL),
|
|
||||||
PINK(ChatColor.BLUE, DyeColor.PINK, VanillaItem.PINK_WOOL);
|
|
||||||
|
|
||||||
private ChatColor chat;
|
|
||||||
private DyeColor dye;
|
|
||||||
private VanillaItem woolMaterial;
|
|
||||||
|
|
||||||
DColor(ChatColor chat, DyeColor dye, VanillaItem woolMaterial) {
|
|
||||||
this.chat = chat;
|
|
||||||
this.dye = dye;
|
|
||||||
this.woolMaterial = woolMaterial;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the ChatColor
|
|
||||||
*/
|
|
||||||
public ChatColor getChatColor() {
|
|
||||||
return chat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the DyeColor
|
|
||||||
*/
|
|
||||||
public DyeColor getDyeColor() {
|
|
||||||
return dye;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the RGB value
|
|
||||||
*/
|
|
||||||
public int getRGBColor() {
|
|
||||||
return dye.getColor().asRGB();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the wool material
|
|
||||||
*/
|
|
||||||
public VanillaItem getWoolMaterial() {
|
|
||||||
return woolMaterial;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param color the ChatColor to check
|
|
||||||
* @return the matching DColor or null
|
|
||||||
*/
|
|
||||||
public static DColor getByChatColor(ChatColor color) {
|
|
||||||
for (DColor dColor : values()) {
|
|
||||||
if (dColor.chat == color) {
|
|
||||||
return dColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param color the DyeColor to check
|
|
||||||
* @return the matching DColor or null
|
|
||||||
*/
|
|
||||||
public static DColor getByDyeColor(DyeColor color) {
|
|
||||||
for (DColor dColor : values()) {
|
|
||||||
if (dColor.dye == color) {
|
|
||||||
return dColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param wool the wool item to check
|
|
||||||
* @return the matching DColor or null
|
|
||||||
*/
|
|
||||||
public static DColor getByWoolType(ExItem wool) {
|
|
||||||
for (DColor dColor : values()) {
|
|
||||||
if (dColor.woolMaterial == wool) {
|
|
||||||
return dColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -10,6 +10,12 @@
|
|||||||
<version>0.18-SNAPSHOT</version>
|
<version>0.18-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
|
<artifactId>dungeonsxl-adapter</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.erethon.dungeonsxl</groupId>
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
<artifactId>dungeonsxl-api</artifactId>
|
<artifactId>dungeonsxl-api</artifactId>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.erethon.dungeonsxl.adapter.block;
|
package de.erethon.dungeonsxl.adapter.block;
|
||||||
|
|
||||||
import de.erethon.dungeonsxl.util.DColor;
|
import de.erethon.dungeonsxl.api.player.PlayerGroup.Color;
|
||||||
import org.bukkit.Axis;
|
import org.bukkit.Axis;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -51,7 +51,7 @@ public class BlockAdapterBlockData implements BlockAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockWoolColor(Block block, DColor color) {
|
public void setBlockWoolColor(Block block, Color color) {
|
||||||
block.setType(color.getWoolMaterial().getMaterial());
|
block.setType(color.getWoolMaterial().getMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,12 @@
|
|||||||
<version>0.18-SNAPSHOT</version>
|
<version>0.18-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
|
<artifactId>dungeonsxl-adapter</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.erethon.dungeonsxl</groupId>
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
<artifactId>dungeonsxl-api</artifactId>
|
<artifactId>dungeonsxl-api</artifactId>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.erethon.dungeonsxl.adapter.block;
|
package de.erethon.dungeonsxl.adapter.block;
|
||||||
|
|
||||||
import de.erethon.dungeonsxl.util.DColor;
|
import de.erethon.dungeonsxl.api.player.PlayerGroup.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -45,7 +45,7 @@ public class BlockAdapterMagicValues implements BlockAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockWoolColor(Block block, DColor color) {
|
public void setBlockWoolColor(Block block, Color color) {
|
||||||
block.setTypeIdAndData(Material.WOOL.getId(), color.getDyeColor().getWoolData(), false);
|
block.setTypeIdAndData(Material.WOOL.getId(), color.getDyeColor().getWoolData(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +17,18 @@
|
|||||||
<directory>src/main/resources/</directory>
|
<directory>src/main/resources/</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>plugin.yml</include>
|
<include>plugin.yml</include>
|
||||||
|
<include>languages/*</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
|
<artifactId>dungeonsxl-adapter</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.erethon.dungeonsxl</groupId>
|
<groupId>de.erethon.dungeonsxl</groupId>
|
||||||
<artifactId>dungeonsxl-api</artifactId>
|
<artifactId>dungeonsxl-api</artifactId>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,7 +20,6 @@ import de.erethon.caliburn.CaliburnAPI;
|
|||||||
import de.erethon.caliburn.loottable.LootTable;
|
import de.erethon.caliburn.loottable.LootTable;
|
||||||
import de.erethon.commons.compatibility.Internals;
|
import de.erethon.commons.compatibility.Internals;
|
||||||
import de.erethon.commons.compatibility.Version;
|
import de.erethon.commons.compatibility.Version;
|
||||||
import de.erethon.commons.config.MessageConfig;
|
|
||||||
import de.erethon.commons.javaplugin.DREPlugin;
|
import de.erethon.commons.javaplugin.DREPlugin;
|
||||||
import de.erethon.commons.javaplugin.DREPluginSettings;
|
import de.erethon.commons.javaplugin.DREPluginSettings;
|
||||||
import de.erethon.commons.misc.FileUtil;
|
import de.erethon.commons.misc.FileUtil;
|
||||||
@ -30,7 +29,6 @@ import de.erethon.dungeonsxl.adapter.block.BlockAdapterBlockData;
|
|||||||
import de.erethon.dungeonsxl.adapter.block.BlockAdapterMagicValues;
|
import de.erethon.dungeonsxl.adapter.block.BlockAdapterMagicValues;
|
||||||
import de.erethon.dungeonsxl.announcer.AnnouncerCache;
|
import de.erethon.dungeonsxl.announcer.AnnouncerCache;
|
||||||
import de.erethon.dungeonsxl.command.DCommandCache;
|
import de.erethon.dungeonsxl.command.DCommandCache;
|
||||||
import de.erethon.dungeonsxl.config.DMessage;
|
|
||||||
import de.erethon.dungeonsxl.config.MainConfig;
|
import de.erethon.dungeonsxl.config.MainConfig;
|
||||||
import de.erethon.dungeonsxl.dungeon.DungeonCache;
|
import de.erethon.dungeonsxl.dungeon.DungeonCache;
|
||||||
import de.erethon.dungeonsxl.game.Game;
|
import de.erethon.dungeonsxl.game.Game;
|
||||||
@ -78,7 +76,6 @@ public class DungeonsXL extends DREPlugin {
|
|||||||
|
|
||||||
public static final String[] EXCLUDED_FILES = {"config.yml", "uid.dat", "DXLData.data", "data"};
|
public static final String[] EXCLUDED_FILES = {"config.yml", "uid.dat", "DXLData.data", "data"};
|
||||||
public static File BACKUPS;
|
public static File BACKUPS;
|
||||||
public static File LANGUAGES;
|
|
||||||
public static File MAPS;
|
public static File MAPS;
|
||||||
public static File PLAYERS;
|
public static File PLAYERS;
|
||||||
public static File SCRIPTS;
|
public static File SCRIPTS;
|
||||||
@ -143,7 +140,6 @@ public class DungeonsXL extends DREPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
saveData();
|
saveData();
|
||||||
messageConfig.save();
|
|
||||||
dGroups.clear();
|
dGroups.clear();
|
||||||
dWorlds.deleteAllInstances();
|
dWorlds.deleteAllInstances();
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
@ -161,11 +157,6 @@ public class DungeonsXL extends DREPlugin {
|
|||||||
BACKUPS.mkdir();
|
BACKUPS.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
LANGUAGES = new File(getDataFolder(), "languages");
|
|
||||||
if (!LANGUAGES.exists()) {
|
|
||||||
LANGUAGES.mkdir();
|
|
||||||
}
|
|
||||||
|
|
||||||
MAPS = new File(getDataFolder(), "maps");
|
MAPS = new File(getDataFolder(), "maps");
|
||||||
if (!MAPS.exists()) {
|
if (!MAPS.exists()) {
|
||||||
MAPS.mkdir();
|
MAPS.mkdir();
|
||||||
@ -213,9 +204,7 @@ public class DungeonsXL extends DREPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadConfig() {
|
public void loadConfig() {
|
||||||
messageConfig = new MessageConfig(DMessage.class, new File(LANGUAGES, "english.yml"));
|
|
||||||
mainConfig = new MainConfig(this, new File(getDataFolder(), "config.yml"));
|
mainConfig = new MainConfig(this, new File(getDataFolder(), "config.yml"));
|
||||||
messageConfig = new MessageConfig(DMessage.class, new File(LANGUAGES, mainConfig.getLanguage() + ".yml"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createCaches() {
|
public void createCaches() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,11 +19,11 @@ package de.erethon.dungeonsxl.announcer;
|
|||||||
import de.erethon.commons.chat.DefaultFontInfo;
|
import de.erethon.commons.chat.DefaultFontInfo;
|
||||||
import de.erethon.commons.chat.MessageUtil;
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
import de.erethon.dungeonsxl.DungeonsXL;
|
import de.erethon.dungeonsxl.DungeonsXL;
|
||||||
|
import de.erethon.dungeonsxl.api.player.PlayerGroup.Color;
|
||||||
import de.erethon.dungeonsxl.config.DMessage;
|
import de.erethon.dungeonsxl.config.DMessage;
|
||||||
import de.erethon.dungeonsxl.dungeon.Dungeon;
|
import de.erethon.dungeonsxl.dungeon.Dungeon;
|
||||||
import de.erethon.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import de.erethon.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import de.erethon.dungeonsxl.player.DGroup;
|
import de.erethon.dungeonsxl.player.DGroup;
|
||||||
import de.erethon.dungeonsxl.util.DColor;
|
|
||||||
import de.erethon.dungeonsxl.util.GUIUtil;
|
import de.erethon.dungeonsxl.util.GUIUtil;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -350,7 +350,7 @@ public class Announcer {
|
|||||||
public void clickGroupButton(Player player, ItemStack button) {
|
public void clickGroupButton(Player player, ItemStack button) {
|
||||||
DGroup dGroup = getDGroupByButton(button);
|
DGroup dGroup = getDGroupByButton(button);
|
||||||
DGroup pGroup = DGroup.getByPlayer(player);
|
DGroup pGroup = DGroup.getByPlayer(player);
|
||||||
DColor color = DColor.getByWoolType(plugin.getCaliburn().getExItem(button));
|
Color color = Color.getByWoolType(plugin.getCaliburn().getExItem(button));
|
||||||
|
|
||||||
for (DGroup group : dGroups) {
|
for (DGroup group : dGroups) {
|
||||||
if (dGroups.contains(pGroup) && pGroup != null && pGroup.isCustom() && pGroup.getCaptain() == player) {
|
if (dGroups.contains(pGroup) && pGroup != null && pGroup.isCustom() && pGroup.getCaptain() == player) {
|
||||||
@ -422,7 +422,7 @@ public class Announcer {
|
|||||||
|
|
||||||
boolean full = playerCount >= maxPlayersPerGroup;
|
boolean full = playerCount >= maxPlayersPerGroup;
|
||||||
|
|
||||||
DColor color = plugin.getMainConfig().getGroupColorPriority(groupCount);
|
Color color = plugin.getMainConfig().getGroupColorPriority(groupCount);
|
||||||
ItemStack button = color.getWoolMaterial().toItemStack();
|
ItemStack button = color.getWoolMaterial().toItemStack();
|
||||||
ItemMeta meta = button.getItemMeta();
|
ItemMeta meta = button.getItemMeta();
|
||||||
meta.setDisplayName(name + (full ? ChatColor.DARK_RED : ChatColor.GREEN) + " [" + playerCount + "/" + maxPlayersPerGroup + "]");
|
meta.setDisplayName(name + (full ? ChatColor.DARK_RED : ChatColor.GREEN) + " [" + playerCount + "/" + maxPlayersPerGroup + "]");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -34,7 +34,7 @@ public class BreakCommand extends DCommand {
|
|||||||
setCommand("break");
|
setCommand("break");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_BREAK.getMessage());
|
setHelp(DMessage.CMD_BREAK_HELP.getMessage());
|
||||||
setPermission(DPermission.BREAK.getNode());
|
setPermission(DPermission.BREAK.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,7 +36,7 @@ public class ChatCommand extends DCommand {
|
|||||||
setCommand("chat");
|
setCommand("chat");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_CHAT.getMessage());
|
setHelp(DMessage.CMD_CHAT_HELP.getMessage());
|
||||||
setPermission(DPermission.CHAT.getNode());
|
setPermission(DPermission.CHAT.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -34,7 +34,7 @@ public class ChatSpyCommand extends DCommand {
|
|||||||
setCommand("chatSpy");
|
setCommand("chatSpy");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_CHATSPY.getMessage());
|
setHelp(DMessage.CMD_CHATSPY_HELP.getMessage());
|
||||||
setPermission(DPermission.CHAT_SPY.getNode());
|
setPermission(DPermission.CHAT_SPY.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ public class ChatSpyCommand extends DCommand {
|
|||||||
DGlobalPlayer dPlayer = dPlayers.getByPlayer(player);
|
DGlobalPlayer dPlayer = dPlayers.getByPlayer(player);
|
||||||
|
|
||||||
dPlayer.setInChatSpyMode(!dPlayer.isInChatSpyMode());
|
dPlayer.setInChatSpyMode(!dPlayer.isInChatSpyMode());
|
||||||
MessageUtil.sendMessage(player, (dPlayer.isInChatSpyMode() ? DMessage.CMD_CHATSPY_START : DMessage.CMD_CHATSPY_STOPPED).getMessage());
|
MessageUtil.sendMessage(player, (dPlayer.isInChatSpyMode() ? DMessage.CMD_CHATSPY_STARTED : DMessage.CMD_CHATSPY_STOPPED).getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -39,7 +39,7 @@ public class CreateCommand extends DCommand {
|
|||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setCommand("create");
|
setCommand("create");
|
||||||
setHelp(DMessage.HELP_CMD_CREATE.getMessage());
|
setHelp(DMessage.CMD_CREATE_HELP.getMessage());
|
||||||
setPermission(DPermission.CREATE.getNode());
|
setPermission(DPermission.CREATE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -55,14 +55,14 @@ public class CreateCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name.length() > 15) {
|
if (name.length() > 15) {
|
||||||
MessageUtil.sendMessage(sender, DMessage.ERROR_NAME_TO_LONG.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NAME_TOO_LONG.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender instanceof ConsoleCommandSender) {
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
// Msg create
|
// Msg create
|
||||||
MessageUtil.log(plugin, DMessage.LOG_NEW_MAP.getMessage());
|
MessageUtil.log(plugin, "&6Creating new map.");
|
||||||
MessageUtil.log(plugin, DMessage.LOG_GENERATE_NEW_WORLD.getMessage());
|
MessageUtil.log(plugin, "&6Generating new world...");
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
DResourceWorld resource = new DResourceWorld(plugin, name);
|
DResourceWorld resource = new DResourceWorld(plugin, name);
|
||||||
@ -72,7 +72,7 @@ public class CreateCommand extends DCommand {
|
|||||||
editWorld.delete();
|
editWorld.delete();
|
||||||
|
|
||||||
// MSG Done
|
// MSG Done
|
||||||
MessageUtil.log(plugin, DMessage.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
MessageUtil.log(plugin, "&6World generation finished.");
|
||||||
|
|
||||||
} else if (sender instanceof Player) {
|
} else if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
@ -83,8 +83,8 @@ public class CreateCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Msg create
|
// Msg create
|
||||||
MessageUtil.log(plugin, DMessage.LOG_NEW_MAP.getMessage());
|
MessageUtil.log(plugin, "&6Creating new map.");
|
||||||
MessageUtil.log(plugin, DMessage.LOG_GENERATE_NEW_WORLD.getMessage());
|
MessageUtil.log(plugin, "&6Generating new world...");
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
DResourceWorld resource = new DResourceWorld(plugin, name);
|
DResourceWorld resource = new DResourceWorld(plugin, name);
|
||||||
@ -92,7 +92,7 @@ public class CreateCommand extends DCommand {
|
|||||||
DEditWorld editWorld = resource.generate();
|
DEditWorld editWorld = resource.generate();
|
||||||
|
|
||||||
// MSG Done
|
// MSG Done
|
||||||
MessageUtil.log(plugin, DMessage.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
MessageUtil.log(plugin, "&6World generation finished.");
|
||||||
|
|
||||||
// Tp Player
|
// Tp Player
|
||||||
new DEditPlayer(plugin, player, editWorld);
|
new DEditPlayer(plugin, player, editWorld);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -39,7 +39,7 @@ public class DeleteCommand extends DCommand {
|
|||||||
setCommand("delete");
|
setCommand("delete");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessage.HELP_CMD_DELETE.getMessage());
|
setHelp(DMessage.CMD_DELETE_HELP.getMessage());
|
||||||
setPermission(DPermission.DELETE.getNode());
|
setPermission(DPermission.DELETE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -37,7 +37,7 @@ public class DungeonItemCommand extends DCommand {
|
|||||||
setAliases("di");
|
setAliases("di");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_DUNGEON_ITEM.getMessage());
|
setHelp(DMessage.CMD_DUNGEON_ITEM_HELP.getMessage());
|
||||||
setPermission(DPermission.DUNGEON_ITEM.getNode());
|
setPermission(DPermission.DUNGEON_ITEM.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(false);
|
setConsoleCommand(false);
|
||||||
@ -63,7 +63,7 @@ public class DungeonItemCommand extends DCommand {
|
|||||||
NBTUtil.addBoolean(tag, NBTUtil.DUNGEON_ITEM_KEY, true);
|
NBTUtil.addBoolean(tag, NBTUtil.DUNGEON_ITEM_KEY, true);
|
||||||
inv.setItemInHand(NBTUtil.setTag(bukkitStack, tag));
|
inv.setItemInHand(NBTUtil.setTag(bukkitStack, tag));
|
||||||
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_SET_DUNGEON.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_SET_DUNGEON.getMessage());
|
||||||
MessageUtil.sendMessage(sender, DMessage.HELP_DUNGEON_ITEM.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_DUNGEON_ITEM_HELP.getMessage());
|
||||||
|
|
||||||
} else if (action.equalsIgnoreCase("false")) {
|
} else if (action.equalsIgnoreCase("false")) {
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
@ -71,15 +71,15 @@ public class DungeonItemCommand extends DCommand {
|
|||||||
inv.setItemInHand(NBTUtil.setTag(bukkitStack, tag));
|
inv.setItemInHand(NBTUtil.setTag(bukkitStack, tag));
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_SET_GLOBAL.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_SET_GLOBAL.getMessage());
|
||||||
MessageUtil.sendMessage(sender, DMessage.HELP_GLOBAL_ITEM.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_GLOBAL_ITEM_HELP.getMessage());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (tag != null && NBTUtil.hasKey(tag, NBTUtil.DUNGEON_ITEM_KEY)) {
|
if (tag != null && NBTUtil.hasKey(tag, NBTUtil.DUNGEON_ITEM_KEY)) {
|
||||||
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_INFO_DUNGEON.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_INFO_DUNGEON.getMessage());
|
||||||
MessageUtil.sendMessage(sender, DMessage.HELP_DUNGEON_ITEM.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_DUNGEON_ITEM_HELP.getMessage());
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_INFO_GLOBAL.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_INFO_GLOBAL.getMessage());
|
||||||
MessageUtil.sendMessage(sender, DMessage.HELP_GLOBAL_ITEM.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DUNGEON_ITEM_GLOBAL_ITEM_HELP.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,6 +17,7 @@
|
|||||||
package de.erethon.dungeonsxl.command;
|
package de.erethon.dungeonsxl.command;
|
||||||
|
|
||||||
import de.erethon.commons.chat.MessageUtil;
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
|
import de.erethon.commons.config.CommonMessage;
|
||||||
import de.erethon.dungeonsxl.DungeonsXL;
|
import de.erethon.dungeonsxl.DungeonsXL;
|
||||||
import de.erethon.dungeonsxl.config.DMessage;
|
import de.erethon.dungeonsxl.config.DMessage;
|
||||||
import de.erethon.dungeonsxl.player.DEditPlayer;
|
import de.erethon.dungeonsxl.player.DEditPlayer;
|
||||||
@ -39,7 +40,7 @@ public class EditCommand extends DCommand {
|
|||||||
setCommand("edit");
|
setCommand("edit");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_EDIT.getMessage());
|
setHelp(DMessage.CMD_EDIT_HELP.getMessage());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ public class EditCommand extends DCommand {
|
|||||||
String mapName = args[1];
|
String mapName = args[1];
|
||||||
|
|
||||||
if (!instances.exists(mapName)) {
|
if (!instances.exists(mapName)) {
|
||||||
MessageUtil.sendMessage(player, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(mapName));
|
MessageUtil.sendMessage(player, DMessage.ERROR_NO_SUCH_DUNGEON.getMessage(mapName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ public class EditCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!resource.isInvitedPlayer(player) && !DPermission.hasPermission(player, DPermission.EDIT)) {
|
if (!resource.isInvitedPlayer(player) && !DPermission.hasPermission(player, DPermission.EDIT)) {
|
||||||
MessageUtil.sendMessage(player, DMessage.ERROR_NO_PERMISSIONS.getMessage());
|
MessageUtil.sendMessage(player, CommonMessage.CMD_NO_PERMISSION.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -37,7 +37,7 @@ public class EnterCommand extends DCommand {
|
|||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setCommand("enter");
|
setCommand("enter");
|
||||||
setHelp(DMessage.HELP_CMD_ENTER.getMessage());
|
setHelp(DMessage.CMD_ENTER_HELP.getMessage());
|
||||||
setPermission(DPermission.ENTER.getNode());
|
setPermission(DPermission.ENTER.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public class EnterCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (joining.getCaptain() != captain && !DPermission.hasPermission(sender, DPermission.BYPASS)) {
|
if (joining.getCaptain() != captain && !DPermission.hasPermission(sender, DPermission.BYPASS)) {
|
||||||
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_CAPTAIN.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_LEADER.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -37,7 +37,7 @@ public class EscapeCommand extends DCommand {
|
|||||||
setCommand("escape");
|
setCommand("escape");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_ESCAPE.getMessage());
|
setHelp(DMessage.CMD_ESCAPE_HELP.getMessage());
|
||||||
setPermission(DPermission.ESCAPE.getNode());
|
setPermission(DPermission.ESCAPE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,7 +36,7 @@ public class GameCommand extends DCommand {
|
|||||||
setCommand("game");
|
setCommand("game");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_GAME.getMessage());
|
setHelp(DMessage.CMD_GAME_HELP.getMessage());
|
||||||
setPermission(DPermission.GAME.getNode());
|
setPermission(DPermission.GAME.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -39,7 +39,7 @@ public class GroupCommand extends DCommand {
|
|||||||
setCommand("group");
|
setCommand("group");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessage.HELP_CMD_GROUP.getMessage());
|
setHelp(DMessage.CMD_GROUP_HELP_MAIN.getMessage());
|
||||||
setPermission(DPermission.GROUP.getNode());
|
setPermission(DPermission.GROUP.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -272,19 +272,18 @@ public class GroupCommand extends DCommand {
|
|||||||
switch (page) {
|
switch (page) {
|
||||||
default:
|
default:
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4&l[ &61-5 &4/ &67 &4| &61 &4&l]");
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &61-5 &4/ &67 &4| &61 &4&l]");
|
||||||
MessageUtil.sendMessage(sender, "&bcreate" + "&7 - " + DMessage.HELP_CMD_GROUP_CREATE.getMessage());
|
MessageUtil.sendMessage(sender, "&bcreate" + "&7 - " + DMessage.CMD_GROUP_HELP_CREATE.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&bdisband" + "&7 - " + DMessage.HELP_CMD_GROUP_DISBAND.getMessage());
|
MessageUtil.sendMessage(sender, "&bdisband" + "&7 - " + DMessage.CMD_GROUP_HELP_DISBAND.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&binvite" + "&7 - " + DMessage.HELP_CMD_GROUP_INVITE.getMessage());
|
MessageUtil.sendMessage(sender, "&binvite" + "&7 - " + DMessage.CMD_GROUP_HELP_INVITE.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&buninvite" + "&7 - " + DMessage.HELP_CMD_GROUP_UNINVITE.getMessage());
|
MessageUtil.sendMessage(sender, "&buninvite" + "&7 - " + DMessage.CMD_GROUP_HELP_UNINVITE.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&bjoin" + "&7 - " + DMessage.HELP_CMD_GROUP_JOIN.getMessage());
|
MessageUtil.sendMessage(sender, "&bjoin" + "&7 - " + DMessage.CMD_GROUP_HELP_JOIN.getMessage());
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4&l[ &66-10 &4/ &67 &4| &62 &4&l]");
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &66-10 &4/ &67 &4| &62 &4&l]");
|
||||||
MessageUtil.sendMessage(sender, "&bkick" + "&7 - " + DMessage.HELP_CMD_GROUP_KICK.getMessage());
|
MessageUtil.sendMessage(sender, "&bkick" + "&7 - " + DMessage.CMD_GROUP_HELP_KICK.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&bshow" + "&7 - " + DMessage.HELP_CMD_GROUP_SHOW.getMessage());
|
MessageUtil.sendMessage(sender, "&bshow" + "&7 - " + DMessage.CMD_GROUP_HELP_SHOW.getMessage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,7 +36,7 @@ public class HelpCommand extends DCommand {
|
|||||||
setCommand("help");
|
setCommand("help");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_HELP.getMessage());
|
setHelp(DMessage.CMD_HELP_HELP.getMessage());
|
||||||
setPermission(DPermission.HELP.getNode());
|
setPermission(DPermission.HELP.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -38,7 +38,7 @@ public class ImportCommand extends DCommand {
|
|||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setCommand("import");
|
setCommand("import");
|
||||||
setHelp(DMessage.HELP_CMD_IMPORT.getMessage());
|
setHelp(DMessage.CMD_IMPORT_HELP.getMessage());
|
||||||
setPermission(DPermission.IMPORT.getNode());
|
setPermission(DPermission.IMPORT.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -64,8 +64,8 @@ public class ImportCommand extends DCommand {
|
|||||||
world.save();
|
world.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtil.log(plugin, DMessage.LOG_NEW_MAP.getMessage());
|
MessageUtil.log(plugin, "&6Creating new map.");
|
||||||
MessageUtil.log(plugin, DMessage.LOG_IMPORT_WORLD.getMessage());
|
MessageUtil.log(plugin, "&6Importing world...");
|
||||||
|
|
||||||
FileUtil.copyDir(source, target, "playerdata", "stats");
|
FileUtil.copyDir(source, target, "playerdata", "stats");
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,7 +35,7 @@ public class InviteCommand extends DCommand {
|
|||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setCommand("invite");
|
setCommand("invite");
|
||||||
setHelp(DMessage.HELP_CMD_INVITE.getMessage());
|
setHelp(DMessage.CMD_INVITE_HELP.getMessage());
|
||||||
setPermission(DPermission.INVITE.getNode());
|
setPermission(DPermission.INVITE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -56,7 +56,7 @@ public class InviteCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_MAP.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,7 +36,7 @@ public class JoinCommand extends DCommand {
|
|||||||
setCommand("join");
|
setCommand("join");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_JOIN.getMessage());
|
setHelp(DMessage.CMD_JOIN_HELP.getMessage());
|
||||||
setPermission(DPermission.JOIN.getNode());
|
setPermission(DPermission.JOIN.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -34,7 +34,7 @@ public class KickCommand extends DCommand {
|
|||||||
setCommand("kick");
|
setCommand("kick");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_KICK.getMessage());
|
setHelp(DMessage.CMD_KICK_HELP.getMessage());
|
||||||
setPermission(DPermission.KICK.getNode());
|
setPermission(DPermission.KICK.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -42,7 +42,7 @@ public class LeaveCommand extends DCommand {
|
|||||||
setCommand("leave");
|
setCommand("leave");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_LEAVE.getMessage());
|
setHelp(DMessage.CMD_LEAVE_HELP.getMessage());
|
||||||
setPermission(DPermission.LEAVE.getNode());
|
setPermission(DPermission.LEAVE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -42,7 +42,7 @@ public class ListCommand extends DCommand {
|
|||||||
setCommand("list");
|
setCommand("list");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(3);
|
setMaxArgs(3);
|
||||||
setHelp(DMessage.HELP_CMD_LIST.getMessage());
|
setHelp(DMessage.CMD_LIST_HELP.getMessage());
|
||||||
setPermission(DPermission.LIST.getNode());
|
setPermission(DPermission.LIST.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -38,7 +38,7 @@ public class LivesCommand extends DCommand {
|
|||||||
setCommand("lives");
|
setCommand("lives");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_LIVES.getMessage());
|
setHelp(DMessage.CMD_LIVES_HELP.getMessage());
|
||||||
setPermission(DPermission.LIVES.getNode());
|
setPermission(DPermission.LIVES.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,7 +35,7 @@ public class MainCommand extends DCommand {
|
|||||||
public MainCommand(DungeonsXL plugin) {
|
public MainCommand(DungeonsXL plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
setCommand("main");
|
setCommand("main");
|
||||||
setHelp(DMessage.HELP_CMD_MAIN.getMessage());
|
setHelp(DMessage.CMD_MAIN_HELP.getMessage());
|
||||||
setPermission(DPermission.MAIN.getNode());
|
setPermission(DPermission.MAIN.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -68,7 +68,7 @@ public class MainCommand extends DCommand {
|
|||||||
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_LOADED.getMessage(String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_LOADED.getMessage(String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, itemsxl));
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, itemsxl));
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_HELP.getMessage());
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_HELP.getMessage());
|
||||||
MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2019 Frank Baumann & contributors; lcsd. under GPLv3.");
|
MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2020 Frank Baumann & contributors; lcsd. under GPLv3.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,7 +36,7 @@ public class MsgCommand extends DCommand {
|
|||||||
setMinArgs(-1);
|
setMinArgs(-1);
|
||||||
setMaxArgs(-1);
|
setMaxArgs(-1);
|
||||||
setCommand("msg");
|
setCommand("msg");
|
||||||
setHelp(DMessage.HELP_CMD_MSG.getMessage());
|
setHelp(DMessage.CMD_MSG_HELP.getMessage());
|
||||||
setPermission(DPermission.MESSAGE.getNode());
|
setPermission(DPermission.MESSAGE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -43,7 +43,7 @@ public class PlayCommand extends DCommand {
|
|||||||
setCommand("play");
|
setCommand("play");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_PLAY.getMessage());
|
setHelp(DMessage.CMD_PLAY_HELP.getMessage());
|
||||||
setPermission(DPermission.PLAY.getNode());
|
setPermission(DPermission.PLAY.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(false);
|
setConsoleCommand(false);
|
||||||
@ -64,7 +64,7 @@ public class PlayCommand extends DCommand {
|
|||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
dungeon = new Dungeon(plugin, resource);
|
dungeon = new Dungeon(plugin, resource);
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(args[1]));
|
MessageUtil.sendMessage(player, DMessage.ERROR_NO_SUCH_DUNGEON.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public class PlayCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dGroup.getCaptain().equals(player) && !DPermission.hasPermission(player, DPermission.BYPASS)) {
|
if (!dGroup.getCaptain().equals(player) && !DPermission.hasPermission(player, DPermission.BYPASS)) {
|
||||||
MessageUtil.sendMessage(player, DMessage.ERROR_NOT_CAPTAIN.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NOT_LEADER.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dGroup.setDungeon(dungeon);
|
dGroup.setDungeon(dungeon);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -41,7 +41,7 @@ public class PortalCommand extends DCommand {
|
|||||||
setCommand("portal");
|
setCommand("portal");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_PORTAL.getMessage());
|
setHelp(DMessage.CMD_PORTAL_HELP.getMessage());
|
||||||
setPermission(DPermission.PORTAL.getNode());
|
setPermission(DPermission.PORTAL.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -43,7 +43,7 @@ public class ReloadCommand extends DCommand {
|
|||||||
setCommand("reload");
|
setCommand("reload");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_RELOAD.getMessage());
|
setHelp(DMessage.CMD_RELOAD_HELP.getMessage());
|
||||||
setPermission(DPermission.RELOAD.getNode());
|
setPermission(DPermission.RELOAD.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -96,7 +96,7 @@ public class ReloadCommand extends DCommand {
|
|||||||
plugin.loadData();
|
plugin.loadData();
|
||||||
|
|
||||||
MessageUtil.sendPluginTag(sender, plugin);
|
MessageUtil.sendPluginTag(sender, plugin);
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_RELOAD_DONE.getMessage());
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_RELOAD_SUCCESS.getMessage());
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_LOADED.getMessage(String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_LOADED.getMessage(String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, ixl));
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, ixl));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -42,7 +42,7 @@ public class RenameCommand extends DCommand {
|
|||||||
setCommand("rename");
|
setCommand("rename");
|
||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessage.HELP_CMD_RENAME.getMessage());
|
setHelp(DMessage.CMD_RENAME_HELP.getMessage());
|
||||||
setPermission(DPermission.RENAME.getNode());
|
setPermission(DPermission.RENAME.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -33,7 +33,7 @@ public class ResourcePackCommand extends DCommand {
|
|||||||
setCommand("resourcepack");
|
setCommand("resourcepack");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessage.HELP_CMD_RESOURCE_PACK.getMessage());
|
setHelp(DMessage.CMD_RESOURCE_PACK_HELP.getMessage());
|
||||||
setPermission(DPermission.RESOURCE_PACK.getNode());
|
setPermission(DPermission.RESOURCE_PACK.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,7 +35,7 @@ public class SaveCommand extends DCommand {
|
|||||||
setCommand("save");
|
setCommand("save");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_SAVE.getMessage());
|
setHelp(DMessage.CMD_SAVE_HELP.getMessage());
|
||||||
setPermission(DPermission.SAVE.getNode());
|
setPermission(DPermission.SAVE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -43,7 +43,7 @@ public class StatusCommand extends DCommand {
|
|||||||
setCommand("status");
|
setCommand("status");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_STATUS.getMessage());
|
setHelp(DMessage.CMD_STATUS_HELP.getMessage());
|
||||||
setPermission(DPermission.STATUS.getNode());
|
setPermission(DPermission.STATUS.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -42,7 +42,7 @@ public class TestCommand extends DCommand {
|
|||||||
setCommand("test");
|
setCommand("test");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessage.HELP_CMD_TEST.getMessage());
|
setHelp(DMessage.CMD_TEST_HELP.getMessage());
|
||||||
setPermission(DPermission.TEST.getNode());
|
setPermission(DPermission.TEST.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(false);
|
setConsoleCommand(false);
|
||||||
@ -61,7 +61,7 @@ public class TestCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!dGroup.getCaptain().equals(player) && !DPermission.hasPermission(player, DPermission.BYPASS)) {
|
if (!dGroup.getCaptain().equals(player) && !DPermission.hasPermission(player, DPermission.BYPASS)) {
|
||||||
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_CAPTAIN.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_LEADER.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,7 +35,7 @@ public class UninviteCommand extends DCommand {
|
|||||||
setCommand("uninvite");
|
setCommand("uninvite");
|
||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessage.HELP_CMD_UNINVITE.getMessage());
|
setHelp(DMessage.CMD_UNINVITE_HELP.getMessage());
|
||||||
setPermission(DPermission.UNINVITE.getNode());
|
setPermission(DPermission.UNINVITE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -45,7 +45,7 @@ public class UninviteCommand extends DCommand {
|
|||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
DResourceWorld resource = instances.getResourceByName(args[2]);
|
DResourceWorld resource = instances.getResourceByName(args[2]);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_MAP.getMessage(args[2]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,8 +17,6 @@
|
|||||||
package de.erethon.dungeonsxl.config;
|
package de.erethon.dungeonsxl.config;
|
||||||
|
|
||||||
import de.erethon.commons.config.Message;
|
import de.erethon.commons.config.Message;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration of all messages. The values are fetched from the language file.
|
* An enumeration of all messages. The values are fetched from the language file.
|
||||||
@ -27,271 +25,203 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
*/
|
*/
|
||||||
public enum DMessage implements Message {
|
public enum DMessage implements Message {
|
||||||
|
|
||||||
ANNOUNCER_CLICK("Announcer_Click", "&4&l=> &6CLICK HERE TO JOIN &4&l<="),
|
ANNOUNCER_CLICK("announcer.click"),
|
||||||
CMD_BREAK_PROTECTED_MODE("Cmd_Break_ProtectedMode", "&6You may not break blocks protected by DungeonsXL anymore."),
|
CMD_BREAK_BREAK_MODE("cmd.break.breakMode"),
|
||||||
CMD_BREAK_BREAK_MODE("Cmd_Break_BreakMode", "&6You may break a block protected by DungeonsXL."),
|
CMD_BREAK_HELP("cmd.break.help"),
|
||||||
CMD_CHAT_DUNGEON_CHAT("Cmd_Chat_DungeonChat", "&6You have entered the dungeon chat"),
|
CMD_BREAK_PROTECTED_MODE("cmd.break.protectedMode"),
|
||||||
CMD_CHAT_NORMAL_CHAT("Cmd_Chat_NormalChat", "&6You are now in the public chat"),
|
CMD_CHAT_HELP("cmd.chat.help"),
|
||||||
CMD_CHATSPY_STOPPED("Cmd_Chatspy_Stopped", "&6You stopped to spy the dungeon chat."),
|
CMD_CHAT_DUNGEON_CHAT("cmd.chat.dungeonChat"),
|
||||||
CMD_CHATSPY_START("Cmd_Chatspy_Start", "&6You started to spy the dungeon chat."),
|
CMD_CHAT_NORMAL_CHAT("cmd.chat.normalChat"),
|
||||||
CMD_DELETE_BACKUPS("Cmd_Delete_Backups", "&6Do you wish to delete all saved backups as well?"),
|
CMD_CHATSPY_HELP("cmd.chatspy.help"),
|
||||||
CMD_DELETE_SUCCESS("Cmd_Delete_Success", "&6Successfully deleted the map &4&v1&6."),
|
CMD_CHATSPY_STOPPED("cmd.chatspy.stopped"),
|
||||||
CMD_DUNGEON_ITEM_INFO_DUNGEON("Cmd_DungeonItem_Info_Dungeon", "&6This item is a &4dungeon item&6."),
|
CMD_CHATSPY_STARTED("cmd.chatspy.started"),
|
||||||
CMD_DUNGEON_ITEM_INFO_GLOBAL("Cmd_DungeonItem_Info_Global", "&6This item is a &4global item&6."),
|
CMD_CREATE_HELP("cmd.create.help"),
|
||||||
CMD_DUNGEON_ITEM_SET_DUNGEON("Cmd_DungeonItem_Set_Dungeon", "&6Successfully made this item a &4dungeon item&6."),
|
CMD_DELETE_BACKUPS("cmd.delete.backups"),
|
||||||
CMD_DUNGEON_ITEM_SET_GLOBAL("Cmd_DungeonItem_Set_Global", "&6Successfully made this item a &4global item&6."),
|
CMD_DELETE_HELP("cmd.delete.help"),
|
||||||
CMD_ENTER_SUCCESS("Cmd_Enter", "&6The group &4&v1 &6successfully entered the game of the group &4&v2&6."),
|
CMD_DELETE_SUCCESS("cmd.delete.success"),
|
||||||
CMD_IMPORT_SUCCESS("Cmd_Import", "&6Successfully imported the world &4&v1&6."),
|
CMD_DUNGEON_ITEM_HELP("cmd.dungeonItem.help"),
|
||||||
CMD_INVITE_SUCCESS("Cmd_Invite_Success", "&6Player &4&v1&6 was successfully invited to edit the map &4&v2&6."),
|
CMD_DUNGEON_ITEM_DUNGEON_ITEM_HELP("cmd.dungeonItem.dungeonItemHelp"),
|
||||||
CMD_KICK_SUCCESS("Cmd_Kick_Success", "&6Successfully attempted to kick &4&v1&6."),
|
CMD_DUNGEON_ITEM_GLOBAL_ITEM_HELP("cmd.dungeonItem.globalItemHelp"),
|
||||||
CMD_LEAVE_SUCCESS("Cmd_Leave_Success", "&6You have successfully left your group!"),
|
CMD_DUNGEON_ITEM_INFO_DUNGEON("cmd.dungeonItem.info.dungeon"),
|
||||||
CMD_LIVES_GROUP("Cmd_Lives_Group", "&4&v1 &6have &4&v2 &6lives left."),
|
CMD_DUNGEON_ITEM_INFO_GLOBAL("cmd.dungeonItem.info.global"),
|
||||||
CMD_LIVES_PLAYER("Cmd_Lives_Player", "&4&v1 &6has &4&v2 &6lives left."),
|
CMD_DUNGEON_ITEM_SET_DUNGEON("cmd.dungeonItem.set.dungeon"),
|
||||||
CMD_MAIN_WELCOME("Cmd_Main_Welcome", "&7Welcome to &4Dungeons&fXL"),
|
CMD_DUNGEON_ITEM_SET_GLOBAL("cmd.dungeonItem.set.global"),
|
||||||
CMD_MAIN_LOADED("Cmd_Main_Loaded", "&eMaps: &o[&v1] &eDungeons: &o[&v2] &eLoaded: &o[&v3] &ePlayers: &o[&v4]"),
|
CMD_EDIT_HELP("cmd.edit.help"),
|
||||||
CMD_MAIN_COMPATIBILITY("Cmd_Main_Compatibility", "&eInternals: &o[&v1] &eVault: &o[&v2] &eItemsXL: &o[&v3]"),
|
CMD_ENTER_HELP("cmd.enter.help"),
|
||||||
CMD_MAIN_HELP("Cmd_Main_Help", "&7Type in &o/dxl help&r&7 for further information."),
|
CMD_ENTER_SUCCESS("cmd.enter.success"),
|
||||||
CMD_MSG_ADDED("Cmd_Msg_Added", "&6New Messages (&4&v1&6) added!"),
|
CMD_ESCAPE_HELP("cmd.escape.help"),
|
||||||
CMD_MSG_UPDATED("Cmd_Msg_Updated", "&6Messages (&4&v1&6) updated!"),
|
CMD_GAME_HELP("cmd.game.help"),
|
||||||
CMD_RELOAD_DONE("Cmd_Reload_Done", "&7Successfully reloaded DungeonsXL."),
|
CMD_GROUP_HELP_MAIN("cmd.group.help.main"),
|
||||||
CMD_RELOAD_PLAYERS("Cmd_Reload_Players", "&4Warning: If you reload the plugin, all players will get kicked out of their game."),
|
CMD_GROUP_HELP_CREATE("cmd.group.help.create"),
|
||||||
CMD_RENAME_SUCCESS("Cmd_Rename_Success", "&6Successfully renamed the map &4&v1&6 to &4&v2&6."),
|
CMD_GROUP_HELP_DISBAND("cmd.group.help.disband"),
|
||||||
CMD_SAVE_SUCCESS("Cmd_Save_Success", "&6Map saved!"),
|
CMD_GROUP_HELP_INVITE("cmd.group.help.invite"),
|
||||||
CMD_UNINVITE_SUCCESS("Cmd_Uninvite_Success", "&4&v1&6's permission to edit the map &4&v2&6 has been removed successfully."),
|
CMD_GROUP_HELP_JOIN("cmd.group.help.join"),
|
||||||
ERROR_BED("Error_Bed", "&4You cannot use a bed while in a dungeon!"),
|
CMD_GROUP_HELP_KICK("cmd.group.help.kick"),
|
||||||
ERROR_CHEST_IS_OPENED("Error_ChestIsOpened", "&4This chest has already been opened."),
|
CMD_GROUP_HELP_SHOW("cmd.group.help.show"),
|
||||||
ERROR_CMD("Error_Cmd", "&4Commands are not allowed while in a dungeon!"),
|
CMD_GROUP_HELP_UNINVITE("cmd.group.help.uninvite"),
|
||||||
ERROR_CMD_NOT_EXIST_1("Error_CmdNotExist1", "&4Command &6&v1&4 does not exist!"),
|
CMD_HELP_HELP("cmd.help.help"),
|
||||||
ERROR_CMD_NOT_EXIST_2("Error_CmdNotExist2", "&4Please enter &6/dxl help&4 for help!"),
|
CMD_IMPORT_HELP("cmd.import.help"),
|
||||||
ERROR_COOLDOWN("Error_Cooldown", "&4You can only enter this dungeon every &6&v1&4 hours!"),
|
CMD_IMPORT_SUCCESS("cmd.import.success"),
|
||||||
ERROR_DISPENSER("Error_Dispenser", "&4You cannot access this dispenser!"),
|
CMD_INVITE_HELP("cmd.invite.help"),
|
||||||
ERROR_DROP("Error_Drop", "&4You cannot drop safe items"),
|
CMD_INVITE_SUCCESS("cmd.invite.success"),
|
||||||
ERROR_DUNGEON_NOT_EXIST("Error_DungeonNotExist", "&4This dungeon does not exist."),
|
CMD_JOIN_HELP("cmd.join.help"),
|
||||||
ERROR_ENDERCHEST("Error_Enderchest", "&4You cannot use an enderchest while in a dungeon!"),
|
CMD_KICK_HELP("cmd.kick.help"),
|
||||||
ERROR_IN_GROUP("Error_InGroup", "&4The player &6&v1&4 is already member of a group."),
|
CMD_KICK_SUCCESS("cmd.kick.success"),
|
||||||
ERROR_JOIN_GROUP("Error_JoinGroup", "&4You have to join a group first!"),
|
CMD_LEAVE_HELP("cmd.leave.help"),
|
||||||
ERROR_LEAVE_DUNGEON("Error_LeaveDungeon", "&4You have to leave your current dungeon first!"),
|
CMD_LEAVE_SUCCESS("cmd.leave.success"),
|
||||||
ERROR_LEAVE_GAME("Error_LeaveGame", "&4You have to leave your current game first!"),
|
CMD_LIST_HELP("cmd.list.help"),
|
||||||
ERROR_LEAVE_GROUP("Error_LeaveGroup", "&4You have to leave your group first!"),
|
CMD_LIVES_GROUP("cmd.lives.group"),
|
||||||
ERROR_MSG_ID_NOT_EXIST("Error_MsgIdNotExist", "&4Messages with Id &6&v1&4 does not exist!"),
|
CMD_LIVES_HELP("cmd.lives.help"),
|
||||||
ERROR_MSG_FORMAT("Error_MsgFormat", "&4Please use &6\" &4to mark the beginning and the end of the message!"),
|
CMD_LIVES_PLAYER("cmd.lives.player"),
|
||||||
ERROR_MSG_NO_INT("Error_MsgNoInt", "&4The argument [id] has to include a number!"),
|
CMD_MAIN_WELCOME("cmd.main.welcome"),
|
||||||
ERROR_NAME_IN_USE("Error_NameInUse", "&4The name &6&v1 &4is already in use."),
|
CMD_MAIN_LOADED("cmd.main.loaded"),
|
||||||
ERROR_NAME_TO_LONG("Error_NameToLong", "&4The name may not be longer than 15 characters!"),
|
CMD_MAIN_COMPATIBILITY("cmd.main.compatibility"),
|
||||||
ERROR_NO_CONSOLE_COMMAND("Error_NoConsoleCommand", "&6/dxl &v1&4 cannot be executed as console!"),
|
CMD_MAIN_HELP("cmd.main.help"),
|
||||||
ERROR_NO_GAME("Error_NoGame", "&4You currently do not take part in a game."),
|
CMD_MAIN_HELP_INFO("cmd.main.helpInfo"),
|
||||||
ERROR_NO_ITEM_IN_MAIN_HAND("Error_NoItemInMainHand", "&4You do not have an item in your main hand."),
|
CMD_MSG_ADDED("cmd.msg.added"),
|
||||||
ERROR_NO_LEAVE_IN_TUTORIAL("Error_NoLeaveInTutorial", "&4You cannot use this command in the tutorial!"),
|
CMD_MSG_HELP("cmd.msg.help"),
|
||||||
ERROR_NO_PERMISSIONS("Error_NoPermissions", "&4You do not have permission to do this!"),
|
CMD_MSG_UPDATED("cmd.msg.updated"),
|
||||||
ERROR_NO_PLAYER_COMMAND("Error_NoPlayerCommand", "&6/dxl &v1&4 cannot be executed as player!"),
|
CMD_PORTAL_HELP("cmd.portal.help"),
|
||||||
ERROR_NO_PROTECTED_BLOCK("Error_NoDXLBlock", "&4This is not a block protected by DungeonsXL!"),
|
CMD_PLAY_HELP("cmd.play.help"),
|
||||||
ERROR_NO_REWARDS_LEFT("Error_NoRewardsLeft", "&4You do not have any item rewards left."),
|
CMD_RELOAD_HELP("cmd.reload.help"),
|
||||||
ERROR_NO_REWARDS_TIME("error.noRewardsTime", "&4You cannot receive rewards before &6&v1&4."),
|
CMD_RELOAD_SUCCESS("cmd.reload.success"),
|
||||||
ERROR_SELF_NOT_IN_GROUP("Error_SelfNoGroup", "&4You are not in any group."),
|
CMD_RELOAD_PLAYERS("cmd.reload.players"),
|
||||||
ERROR_NO_SUCH_GROUP("Error_NoSuchGroup", "&4The group &6&v1&4 does not exist!"),
|
CMD_RENAME_HELP("cmd.rename.help"),
|
||||||
ERROR_NO_SUCH_MAP("Error_NoSuchMap", "&4The world &6&v1&4 does not exist!"),
|
CMD_RENAME_SUCCESS("cmd.rename.success"),
|
||||||
ERROR_NO_SUCH_PLAYER("Error_NoSuchPlayer", "&4The player &6&v1&4 does not exist!"),
|
CMD_RESOURCE_PACK_HELP("cmd.resourcePack.help"),
|
||||||
ERROR_NO_SUCH_RESOURCE_PACK("Error_NoSuchResourcePack", "&4The resource pack &6&v1 &4is not registered in the main configuration file!"),
|
CMD_SAVE_HELP("cmd.save.help"),
|
||||||
ERROR_NO_SUCH_SHOP("Error_NoSuchShop", "&4Shop &v1 &4not found..."),
|
CMD_SAVE_SUCCESS("cmd.save.success"),
|
||||||
ERROR_NOT_CAPTAIN("Error_NotCaptain", "&4You are not the captain of your group!"),
|
CMD_STATUS_HELP("cmd.status.help"),
|
||||||
ERROR_NOT_IN_DUNGEON("Error_NotInDungeon", "&4You are not in a dungeon!"),
|
CMD_TEST_HELP("cmd.test.help"),
|
||||||
ERROR_NOT_IN_GAME("Error_NotInGame", "&4The group &6&v1&4 is not member of a game."),
|
CMD_UNINVITE_HELP("cmd.uninvite.help"),
|
||||||
ERROR_NOT_IN_GROUP("Error_NotInGroup", "&4The player &6&v1&4 is not member of the group &6&v2&v4."),
|
CMD_UNINVITE_SUCCESS("cmd.uninvite.success"),
|
||||||
ERROR_NOT_INVITED("Error_NotInvited", "&4You are not invited to the group &6&v1&4."),
|
ERROR_BED("error.bed"),
|
||||||
ERROR_NOT_SAVED("Error_NotSaved", "&4The map &6&v1&4 has not been saved to the &6DungeonsXL/maps/ &4folder yet!"),
|
ERROR_CHEST_IS_OPENED("error.chestIsOpened"),
|
||||||
ERROR_BLOCK_OWN_TEAM("Error_BlockOwnTeam", "&4This block belongs to your own group."),
|
ERROR_CMD("error.cmd"),
|
||||||
ERROR_READY("Error_Ready", "&4Choose your class first!"),
|
ERROR_COOLDOWN("error.cooldown"),
|
||||||
ERROR_REQUIREMENTS("Error_Requirements", "&4You don't fulfill the requirements for this dungeon!"),
|
ERROR_DISPENSER("error.dispenser"),
|
||||||
ERROR_SIGN_WRONG_FORMAT("Error_SignWrongFormat", "&4The sign is not written correctly!"),
|
ERROR_DROP("error.drop"),
|
||||||
ERROR_TOO_MANY_INSTANCES("Error_TooManyInstances", "&4There are currently too many maps instantiated. Try it again in a few minutes!"),
|
ERROR_ENDERCHEST("error.enderchest"),
|
||||||
ERROR_TOO_MANY_TUTORIALS("Error_TooManyTutorials", "&4There are currently too many tutorials running. Try it again in a few minutes!"),
|
ERROR_IN_GROUP("error.inGroup"),
|
||||||
ERROR_TUTORIAL_NOT_EXIST("Error_TutorialNotExist", "&4Tutorial dungeon does not exist!"),
|
ERROR_JOIN_GROUP("error.joinGroup"),
|
||||||
HELP_CMD_BREAK("Help_Cmd_Break", "/dxl break - Break a block protected by DungeonsXL"),
|
ERROR_LEAVE_DUNGEON("error.leaveDungeon"),
|
||||||
HELP_CMD_CHAT("Help_Cmd_Chat", "/dxl chat - Change the chat mode"),
|
ERROR_LEAVE_GAME("error.leaveGame"),
|
||||||
HELP_CMD_CHATSPY("Help_Cmd_Chatspy", "/dxl chatspy - Dis/enables the spymode"),
|
ERROR_LEAVE_GROUP("error.leaveGroup"),
|
||||||
HELP_CMD_CREATE("Help_Cmd_Create", "/dxl create [name] - Creates a new dungeon map"),
|
ERROR_MSG_ID_NOT_EXIST("error.msgIdDoesNotExist"),
|
||||||
HELP_CMD_DELETE("Help_Cmd_Delete", "/dxl delete [name] - Deletes a dungeon map"),
|
ERROR_MSG_FORMAT("error.msgFormat"),
|
||||||
HELP_CMD_DUNGEON_ITEM("Help_Cmd_DungeonItem", "/dxl dungeonItem [true|false|info] - Sets the item stack in the player's hand to be one that cannot be taken out of a dungeon"),
|
ERROR_MSG_NO_INT("error.msgNoInt"),
|
||||||
HELP_CMD_EDIT("Help_Cmd_Edit", "/dxl edit [map] - Edit an existing dungeon map"),
|
ERROR_NAME_IN_USE("error.nameInUse"),
|
||||||
HELP_CMD_ENTER("Help_Cmd_Enter", "/dxl enter ([joining group]) [target group] - Let the joining group enter the game of the target group"),
|
ERROR_NAME_TOO_LONG("error.nameTooLong"),
|
||||||
HELP_CMD_ESCAPE("Help_Cmd_Escape", "/dxl escape - Leaves the current edit world without saving"),
|
ERROR_NO_GAME("error.noGame"),
|
||||||
HELP_CMD_GAME("Help_Cmd_Game", "/dxl game - Shows information about the current game session"),
|
ERROR_NO_ITEM_IN_MAIN_HAND("error.noItemInMainHand"),
|
||||||
HELP_CMD_GROUP("Help_Cmd_Group", "/dxl group - Shows group command help"),
|
ERROR_NO_LEAVE_IN_TUTORIAL("error.noLeaveInTutorial"),
|
||||||
HELP_CMD_GROUP_CREATE("Help_Cmd_GroupCreate", "/dxl group create [group] - Creates a new group"),
|
ERROR_NO_PERMISSIONS("error.noPermissions"),
|
||||||
HELP_CMD_GROUP_DISBAND("Help_Cmd_GroupDisband", "/dxl group disband ([group]) - Disbands a group"),
|
ERROR_NO_PROTECTED_BLOCK("error.noProtectedBlock"),
|
||||||
HELP_CMD_GROUP_INVITE("Help_Cmd_GroupInvite", "/dxl group invite [player]- Invites someone to your group"),
|
ERROR_NO_REWARDS_TIME("error.noRewardsTime"),
|
||||||
HELP_CMD_GROUP_UNINVITE("Help_Cmd_GroupUninvite", "/dxl group uninvite [player] - Takes back an invitation to your group"),
|
ERROR_NO_SUCH_DUNGEON("error.noSuchDungeon"),
|
||||||
HELP_CMD_GROUP_JOIN("Help_Cmd_GroupJoin", "/dxl group join [group]- Join a group"),
|
ERROR_NO_SUCH_GROUP("error.noSuchGroup"),
|
||||||
HELP_CMD_GROUP_KICK("Help_Cmd_GroupKick", "/dxl group kick [player] - Kicks a player"),
|
ERROR_NO_SUCH_MAP("error.noSuchMap"),
|
||||||
HELP_CMD_GROUP_SHOW("Help_Cmd_GroupShow", "/dxl group show [group] - Shows a group"),
|
ERROR_NO_SUCH_PLAYER("error.noSuchPlayer"),
|
||||||
HELP_CMD_HELP("Help_Cmd_Help", "/dxl help [page] - Shows the help page"),
|
ERROR_NO_SUCH_RESOURCE_PACK("error.noSuchResourcePack"),
|
||||||
HELP_CMD_IMPORT("Help_Cmd_Import", "/dxl import [world] - Imports a world from the world container as a dungeon map"),
|
ERROR_NO_SUCH_SHOP("error.noSuchShop"),
|
||||||
HELP_CMD_INVITE("Help_Cmd_Invite", "/dxl invite [player] [dungeon] - Invite a player to edit a dungeon"),
|
ERROR_NOT_IN_DUNGEON("error.notInDungeon"),
|
||||||
HELP_CMD_JOIN("Help_Cmd_Join", "/dxl join [announcement] - Opens the GUI to join a group in an upcoming game"),
|
ERROR_NOT_IN_GAME("error.notInGame"),
|
||||||
HELP_CMD_KICK("Help_Cmd_Kick", "/dxl kick [player] - Kicks the player out of his group and dungeon"),
|
ERROR_NOT_IN_GROUP("error.notInGroup"),
|
||||||
HELP_CMD_LEAVE("Help_Cmd_Leave", "/dxl leave - Leaves the current group and dungeon or edit world"),
|
ERROR_NOT_INVITED("error.notInvited"),
|
||||||
HELP_CMD_LIST("Help_Cmd_List", "/dxl list ([dungeon|map|loaded]) ([dungeon]) - Lists all dungeons"),
|
ERROR_NOT_LEADER("error.notLeader"),
|
||||||
HELP_CMD_LIVES("Help_Cmd_Lives", "/dxl lives [player] - Shows the lives a player has left"),
|
ERROR_NOT_SAVED("error.notSaved"),
|
||||||
HELP_CMD_MAIN("Help_Cmd_Main", "/dxl - General status information"),
|
ERROR_BLOCK_OWN_TEAM("error.blockOwnTeam"),
|
||||||
HELP_CMD_MSG("Help_Cmd_Msg", "/dxl msg [id] '[msg]' - Show or edit a message"),
|
ERROR_READY("error.ready"),
|
||||||
HELP_CMD_PLAY("Help_Cmd_Play", "/dxl play [name] - Allows the player to play a dungeon without a portal"),
|
ERROR_REQUIREMENTS("error.requirements"),
|
||||||
HELP_CMD_PORTAL("Help_Cmd_Portal", "/dxl portal ([material=portal])- Creates a portal that leads into a dungeon"),
|
ERROR_SELF_NOT_IN_GROUP("error.selfNotInGroup"),
|
||||||
HELP_CMD_RELOAD("Help_Cmd_Reload", "/dxl reload - Reloads the plugin"),
|
ERROR_SIGN_WRONG_FORMAT("error.signWrongFormat"),
|
||||||
HELP_CMD_RENAME("Help_Cmd_Rename", "/dxl rename [old name] [new name] - Changes the name of a map to the new one. This command does NOT break dungeons that include this map."),
|
ERROR_TOO_MANY_INSTANCES("error.tooManyInstances"),
|
||||||
HELP_CMD_REWARDS("Help_Cmd_Rewards", "/dxl rewards - Gives all left item rewards to the player"),
|
ERROR_TOO_MANY_TUTORIALS("error.tooManyTutorials"),
|
||||||
HELP_CMD_RESOURCE_PACK("Help_Cmd_ResourcePack", "/dxl resourcepack [ID] - Downloads a resourcepack registered in the main configuration file; use 'reset' to reset"),
|
ERROR_TUTORIAL_DOES_NOT_EXIST("error.tutorialDoesNotExist"),
|
||||||
HELP_CMD_SAVE("Help_Cmd_Save", "/dxl save - Saves the current dungeon"),
|
GROUP_BED_DESTROYED("group.bedDestroyed"),
|
||||||
HELP_CMD_STATUS("Help_Cmd_Status", "/dxl status - Shows the technical status of DungeonsXL"),
|
GROUP_CONGRATS("group.congrats"),
|
||||||
HELP_CMD_SETTINGS("Help_Cmd_Settings", "/dxl settings ([edit|global|player])- Opens the settings menu"),
|
GROUP_CONGRATS_SUB("group.congratsSub"),
|
||||||
HELP_CMD_TEST("Help_Cmd_Test", "/dxl test - Starts the game in test mode"),
|
GROUP_CREATED("group.create"),
|
||||||
HELP_CMD_UNINVITE("Help_Cmd_Uninvite", "/dxl uninvite [player] [dungeon] - Uninvite a player to edit a dungeon"),
|
GROUP_DEATH("group.death"),
|
||||||
HELP_DUNGEON_ITEM("Help_DungeonItem", "&6After finishing a game, &4dungeon items &6are removed from the player's inventory even if the respective dungeon setup in general allows to keep it."),
|
GROUP_DEATH_KICK("group.deathKick"),
|
||||||
HELP_GLOBAL_ITEM("Help_GlobalItem", "&6After finishing a game, &4global items &6can be taken out of dungeons if the respective dungeon setup in general allows to keep the inventory."),
|
GROUP_DEFEATED("group.defeated"),
|
||||||
GROUP_BED_DESTROYED("Group_BedDestroyed", "&6The bed of the group &4&v1 &6has been destroyed by &4&v2&6!"),
|
GROUP_DISBANDED("group.disbanded"),
|
||||||
GROUP_CONGRATS("Group_Congrats", "&6Congratulations!"),
|
GROUP_FLAG_CAPTURED("group.flagCaptured"),
|
||||||
GROUP_CONGRATS_SUB("Group_CongratsSub", "&l&4Your group &v1 &4won the match!"),
|
GROUP_FLAG_LOST("group.flagLost"),
|
||||||
GROUP_CREATED("Group_Created", "&4&v1&6 created the group &4&v2&6!"),
|
GROUP_FLAG_STEALING("group.flagStealing"),
|
||||||
GROUP_DEATH("Group_Death", "&4&v1 &6died. &4&v2 &6have &4&v3 &6lives left."),
|
GROUP_INVITED_PLAYER("group.invitedPlayer"),
|
||||||
GROUP_DEATH_KICK("Group_DeathKick", "&4&v1 &6was kicked because &4&v2 &6have no lives left."),
|
GROUP_JOINED_GAME("group.joinedGame"),
|
||||||
GROUP_DEFEATED("Group_Defeated", "&4The group &4v1 &6is defeated because it lost its last score point."),
|
GROUP_KILLED("group.killed"),
|
||||||
GROUP_DISBANDED("Group_Disbanded", "&4&v1&6 disbanded the group &4&v2&6."),
|
GROUP_KILLED_KICK("group.killedKick"),
|
||||||
GROUP_FLAG_CAPTURED("Group_FlagCaptured", "&4&v1&6 has captured the flag of the group &4&v2&6!"),
|
GROUP_LIVES_ADDED("group.livesAdded"),
|
||||||
GROUP_FLAG_LOST("Group_FlagLost", "&4&v1&6 died and lost &4&v2&6's flag."),
|
GROUP_LIVES_REMOVED("group.livesRemoved"),
|
||||||
GROUP_FLAG_STEALING("Group_FlagStealing", "&4&v1&6 is stealing the flag of the group &4&v2&6!"),
|
GROUP_KICKED_PLAYER("group.kickedPlayer"),
|
||||||
GROUP_INVITED_PLAYER("Group_InvitedPlayer", "&4&v1&6 invited the player &4&v2&6 to the group &4&v3&6."),
|
GROUP_PLAYER_JOINED("group.playerJoined"),
|
||||||
GROUP_JOINED_GAME("Group_JoinedGame", "&6Your group successfully joined the game."),
|
GROUP_REWARD_CHEST("group.rewardChest"),
|
||||||
GROUP_KILLED("Group_Killed", "&4&v1 &6was killed by &4&v2&6. &4&v3&6 have &4&v4 &6lives left."),
|
GROUP_UNINVITED_PLAYER("group.uninvitedPlayer"),
|
||||||
GROUP_KILLED_KICK("Group_KilledKick", "&4&v1&6 was killed by &4&v2&6. &4&v3 have no lives left."),
|
GROUP_WAVE_FINISHED("group.waveFinished"),
|
||||||
GROUP_LIVES_ADDED("Group_LivesAdded", "&6Your group received a bonus of &4&v1&6 lives."),
|
MISC_NO("misc.no"),
|
||||||
GROUP_LIVES_REMOVED("Group_LivesRemoved", "&6Your group lost &4&v1&6 lives!"),
|
MISC_OKAY("misc.okay"),
|
||||||
GROUP_UNINVITED_PLAYER("Group_UninvitedPlayer", "&4&v1&6 took back the invitation for &4&v2&6 to the group &4&v3&6."),
|
MISC_UNLIMITED("misc.unlimited"),
|
||||||
GROUP_KICKED_PLAYER("Group_KickedPlayer", "&4&v1&6 kicked the player &4&v2&6 from the group &4&v3&6."),
|
MISC_YES("misc.yes"),
|
||||||
GROUP_PLAYER_JOINED("Group_PlayerJoined", "&6Player &4&v1&6 has joined the group!"),
|
PLAYER_BLOCK_INFO("player.blockInfo"),
|
||||||
GROUP_REWARD_CHEST("group.rewardChest", "&6Your group has found a reward chest."),
|
PLAYER_CHECKPOINT_REACHED("player.checkpointReached"),
|
||||||
GROUP_WAVE_FINISHED("Group_WaveFinished", "&6Your group finished wave no. &4&v1&6. The next one is going to start in &4&v2&6 seconds."),
|
PLAYER_DEATH("player.death"),
|
||||||
LOG_ERROR_DUNGEON_SETUP("Log_Error_DungeonSetup", "&4The setup of dungeon &6&v1&4 is incorrect. See https://github.com/DRE2N/DungeonsXL/wiki/dungeon-configuration for reference."),
|
PLAYER_DEATH_KICK("player.deathKick"),
|
||||||
LOG_ERROR_MOB_ENCHANTMENT("Log_Error_MobEnchantment", "&4An error occurred while loading mob.yml: Enchantment &6&v1&4 doesn't exist!"),
|
PLAYER_FINISHED_DUNGEON("player.finishedDungeon"),
|
||||||
LOG_ERROR_MOBTYPE("Log_Error_MobType", "&4Error at loading mob.yml: Mob &6&v1&4 doesn't exist!"),
|
PLAYER_FINISHED_FLOOR("player.finished_Floor"),
|
||||||
LOG_ERROR_NO_CONSOLE_COMMAND("Log_Error_NoConsoleCommand", "&6/dxl &v1&4 can not be executed as console!"),
|
PLAYER_INVITED("player.invited"),
|
||||||
LOG_ERROR_SIGN_SETUP("Log_Error_SignSetup", "&4A sign at &6&v1&4 is erroneous!"),
|
PLAYER_UNINVITED("player.uninvited"),
|
||||||
LOG_GENERATE_NEW_WORLD("Log_GenerateNewWorld", "&6Generating new world..."),
|
PLAYER_JOIN_GROUP("player.joinGroup"),
|
||||||
LOG_IMPORT_WORLD("Log_ImportWorld", "&6Importing world..."),
|
PLAYER_KICKED("player.kicked"),
|
||||||
LOG_KILLED_CORRUPTED_PLAYER("Log_KilledCorruptedPlayer", "&4Killed player &6&v1 &4because the data to restore his main inventory is corrupted :("),
|
PLAYER_KILLED("player.killed"),
|
||||||
LOG_NEW_MAP("Log_NewDungeon", "&6Creating new map."),
|
PLAYER_KILLED_KICK("player.killedKick"),
|
||||||
LOG_NEW_PLAYER_DATA("Log_NewPlayerData", "&6A new player data file has been created and saved as &v1."),
|
PLAYER_LEAVE_GROUP("player.leaveGroup"),
|
||||||
LOG_WORLD_GENERATION_FINISHED("Log_WorldGenerationFinished", "&6World generation finished!"),
|
PLAYER_LEFT_GROUP("player.leftGroup"),
|
||||||
MISC_NEXT_PAGE("Misc_NextPage", "&6&lNEXT PAGE"),
|
PLAYER_LIVES_ADDED("player.livesAdded"),
|
||||||
MISC_NO("Misc_No", "&4[ NO ]"),
|
PLAYER_LIVES_REMOVED("player.livesRemoved"),
|
||||||
MISC_OKAY("Misc_Okay", "&a[ OK ]"),
|
PLAYER_LOOT_ADDED("player.lootAdded"),
|
||||||
MISC_PREVIOUS_PAGE("Misc_PreviousPage", "&6&lPREVIOUS PAGE"),
|
PLAYER_NEW_LEADER("player.newLeader"),
|
||||||
MISC_UNLIMITED("Misc_Unlimited", "unlimited"),
|
PLAYER_OFFLINE("player.offline"),
|
||||||
MISC_YES("Misc_Yes", "&a[ YES ]"),
|
PLAYER_OFFLINE_NEVER("player.offlineNever"),
|
||||||
PLAYER_BLOCK_INFO("Player_BlockInfo", "&6Block ID: &2&v1"),
|
PLAYER_PORTAL_ABORT("player.portalAbort"),
|
||||||
PLAYER_CHECKPOINT_REACHED("Player_CheckpointReached", "&6Checkpoint reached!"),
|
PLAYER_PORTAL_INTRODUCTION("player.portalIntroduction"),
|
||||||
PLAYER_DEATH("Player_Death", "&4&v1 &6died and has &4&v2 &6lives left."),
|
PLAYER_PORTAL_CREATED("player.portalCreated"),
|
||||||
PLAYER_DEATH_KICK("Player_DeathKick", "&2&v1 &6lost his last life and was kicked."),
|
PLAYER_PORTAL_PROGRESS("player.portalProgress"),
|
||||||
PLAYER_FINISHED_DUNGEON("Player_FinishedDungeon", "&6You successfully finished the dungeon!"),
|
PLAYER_PROTECTED_BLOCK_DELETED("player.protectedBlockDeleted"),
|
||||||
PLAYER_FINISHED_FLOOR("Player_Finished_Floor", "&6You successfully finished the floor."),
|
PLAYER_READY("player.ready"),
|
||||||
PLAYER_INVITED("Player_Invited", "&4&v1&6 invited you to the group &4&v2&6."),
|
PLAYER_SIGN_CREATED("player.signCreated"),
|
||||||
PLAYER_UNINVITED("Player_Uninvited", "&4&v1&6 took back your invitation to the group &4&v2&6."),
|
PLAYER_SIGN_COPIED("player.signCopied"),
|
||||||
PLAYER_JOIN_GROUP("Player_JoinGroup", "&6You successfully joined the group!"),
|
PLAYER_TIME_LEFT("player.timeLeft"),
|
||||||
PLAYER_KICKED("Player_Kicked", "&4You have been kicked out of the group &6&v1&4."),
|
PLAYER_TIME_KICK("player.timeKick"),
|
||||||
PLAYER_KILLED("Player_Killed", "&4&v1 &6was killed by &4&v2 &6and has &4&v3 &6lives left."),
|
PLAYER_TREASURES("player.treasures"),
|
||||||
PLAYER_KILLED_KICK("Player_KilledKick", "&4&v1&6 was killed by &4&v2 &6and lost his last life."),
|
PLAYER_WAIT_FOR_OTHER_PLAYERS("player.waitForOtherPlayers"),
|
||||||
PLAYER_LEAVE_GROUP("Player_LeaveGroup", "&6You have successfully left your group!"),
|
REQUIREMENT_FEE("requirement.fee"),
|
||||||
PLAYER_LEFT_GROUP("Player_LeftGroup", "&6Player &4&v1&6 has left the Group!"),
|
REWARD_GENERAL("reward.general"),
|
||||||
PLAYER_LIVES_ADDED("Player_LivesAdded", "&6Received a bonus of &4&v1&6 lives."),
|
SIGN_END("sign.end"),
|
||||||
PLAYER_LIVES_REMOVED("Player_LivesRemoved", "&6You lost &4&v1&6 lives!"),
|
SIGN_FLOOR_1("sign.floor.1"),
|
||||||
PLAYER_LOOT_ADDED("Player_LootAdded", "&4&v1&6 have been added to your reward inventory!"),
|
SIGN_FLOOR_2("sign.floor.2"),
|
||||||
PLAYER_NEW_CAPTAIN("Player_NewCaptain", "&6You are now the new captain of your group."),
|
SIGN_GLOBAL_FULL("sign.global.full"),
|
||||||
PLAYER_OFFLINE("Player_Offline", "&Player &4&v1&6 went offline. In &4&v2&6 seconds he will autmatically be kicked from the dungeon!"),
|
SIGN_GLOBAL_IS_PLAYING("sign.global.isPlaying"),
|
||||||
PLAYER_OFFLINE_NEVER("Player_OfflineNever", "&6The player &4&v1&6 went offline. He will &4not&6 be kicked from the dungeon automatically!"),
|
SIGN_GLOBAL_JOIN_GAME("sign.global.joinGame"),
|
||||||
PLAYER_PORTAL_ABORT("Player_PortalAbort", "&6Portal creation cancelled!"),
|
SIGN_GLOBAL_JOIN_GROUP("sign.global.joinGroup"),
|
||||||
PLAYER_PORTAL_INTRODUCTION("Player_PortalIntroduction", "&6Click the two edges of the portal with the wooden sword!"),
|
SIGN_GLOBAL_NEW_GAME("sign.global.newGame"),
|
||||||
PLAYER_PORTAL_CREATED("Player_PortalCreated", "&6Portal created!"),
|
SIGN_GLOBAL_NEW_GROUP("sign.global.newGroup"),
|
||||||
PLAYER_PORTAL_PROGRESS("Player_PortalProgress", "&6First edge successfully marked. You may now click at the other edge."),
|
SIGN_LEAVE("sign.leave"),
|
||||||
PLAYER_PROTECTED_BLOCK_DELETED("Player_ProtectedBlockDeleted", "&6Successfully removed the protection."),
|
SIGN_READY("sign.ready"),
|
||||||
PLAYER_READY("Player_Ready", "&6You are now ready to start the dungeon."),
|
SIGN_RESOURCE_PACK("sign.resourcePack"),
|
||||||
PLAYER_SIGN_CREATED("Player_SignCreated", "&6Successfully created a dungeon sign."),
|
SIGN_WAVE_1("sign.wave.1"),
|
||||||
PLAYER_SIGN_COPIED("Player_SignCopied", "&6Sign data copied."),
|
SIGN_WAVE_2("sign.wave.2");
|
||||||
PLAYER_TIME_LEFT("Player_TimeLeft", "&v1You have &6&v2 &v1seconds left to finish the dungeon!"),
|
|
||||||
PLAYER_TIME_KICK("Player_TimeKick", "&2&v1&6's time expired."),
|
|
||||||
PLAYER_TREASURES("Player_Treasures", "&1Treasures"),
|
|
||||||
PLAYER_WAIT_FOR_OTHER_PLAYERS("Player_WaitForOtherPlayers", "&6Waiting for team members..."),
|
|
||||||
REQUIREMENT_FEE("Requirement_Fee", "&6You have been charged &4&v1 &6for entering the dungeon."),
|
|
||||||
REWARD_GENERAL("Reward_General", "&6You received &4&v1 &6for finishing the dungeon."),
|
|
||||||
SETTINGS_ANNOUNCEMENTS_1("Settings_Announcements1", "&fToggles personal"),
|
|
||||||
SETTINGS_ANNOUNCEMENTS_2("Settings_Announcements2", "&fgame announcements."),
|
|
||||||
SETTINGS_BREAK_1("Settings_Break1", "&fAllows you to break blocks"),
|
|
||||||
SETTINGS_BREAK_2("Settings_Break2", "&fprotected by DungeonsXL."),
|
|
||||||
SETTINGS_CHAT_SPY1("Settings_ChatSpy1", "&fAllows you to receive"),
|
|
||||||
SETTINGS_CHAT_SPY2("Settings_ChatSpy2", "&fall dungeon chat messages."),
|
|
||||||
SETTINGS_TITLE("Settings_Title", "&4Settings: &o"),
|
|
||||||
SETTINGS_TITLE_EDIT("Settings_Title_Edit", "Dungeon Setup"),
|
|
||||||
SETTINGS_TITLE_GLOBAL("Settings_Title_Global", "Global Configuration"),
|
|
||||||
SETTINGS_TITLE_PLAYER("Settings_Title_Player", "Player"),
|
|
||||||
SIGN_END("sign.end", "&2END"),
|
|
||||||
SIGN_FLOOR_1("sign.floor.1", "&2ENTER"),
|
|
||||||
SIGN_FLOOR_2("sign.floor.2", "&2NEXT FLOOR"),
|
|
||||||
SIGN_GLOBAL_FULL("sign.global.full", "&4FULL"),
|
|
||||||
SIGN_GLOBAL_IS_PLAYING("sign.global.isPlaying", "&4IS PLAYING"),
|
|
||||||
SIGN_GLOBAL_JOIN_GAME("sign.global.joinGame", "&2JOIN GAME"),
|
|
||||||
SIGN_GLOBAL_JOIN_GROUP("sign.global.joinGroup", "&2JOIN GROUP"),
|
|
||||||
SIGN_GLOBAL_NEW_GAME("sign.global.newGame", "&2NEW GAME"),
|
|
||||||
SIGN_GLOBAL_NEW_GROUP("sign.global.newGroup", "&2NEW GROUP"),
|
|
||||||
SIGN_LEAVE("sign.leave", "&2LEAVE"),
|
|
||||||
SIGN_READY("sign.ready", "&2READY"),
|
|
||||||
SIGN_RESOURCE_PACK("sign.resourcePack", "&2DOWNLOAD"),
|
|
||||||
SIGN_WAVE_1("sign.wave.1", "&2START"),
|
|
||||||
SIGN_WAVE_2("sign.wave.2", "&2NEXT WAVE");
|
|
||||||
|
|
||||||
private String identifier;
|
private String path;
|
||||||
private String message;
|
|
||||||
|
|
||||||
DMessage(String identifier, String message) {
|
DMessage(String path) {
|
||||||
this.identifier = identifier;
|
this.path = path;
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Getters and setters */
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return identifier;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRaw() {
|
public String getPath() {
|
||||||
return message;
|
return path;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Statics */
|
|
||||||
/**
|
|
||||||
* @param identifier the identifier to set
|
|
||||||
* @return the message
|
|
||||||
*/
|
|
||||||
public static Message getByIdentifier(String identifier) {
|
|
||||||
for (Message message : values()) {
|
|
||||||
if (message.getIdentifier().equals(identifier)) {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a FileConfiguration containing all messages
|
|
||||||
*/
|
|
||||||
public static FileConfiguration toConfig() {
|
|
||||||
FileConfiguration config = new YamlConfiguration();
|
|
||||||
for (DMessage message : values()) {
|
|
||||||
config.set(message.getIdentifier(), message.message);
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,9 +19,9 @@ package de.erethon.dungeonsxl.config;
|
|||||||
import de.erethon.commons.config.DREConfig;
|
import de.erethon.commons.config.DREConfig;
|
||||||
import de.erethon.commons.misc.EnumUtil;
|
import de.erethon.commons.misc.EnumUtil;
|
||||||
import de.erethon.dungeonsxl.DungeonsXL;
|
import de.erethon.dungeonsxl.DungeonsXL;
|
||||||
|
import de.erethon.dungeonsxl.api.player.PlayerGroup.Color;
|
||||||
|
import static de.erethon.dungeonsxl.api.player.PlayerGroup.Color.*;
|
||||||
import de.erethon.dungeonsxl.dungeon.Dungeon;
|
import de.erethon.dungeonsxl.dungeon.Dungeon;
|
||||||
import de.erethon.dungeonsxl.util.DColor;
|
|
||||||
import static de.erethon.dungeonsxl.util.DColor.*;
|
|
||||||
import de.erethon.dungeonsxl.world.WorldConfig;
|
import de.erethon.dungeonsxl.world.WorldConfig;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -68,7 +68,7 @@ public class MainConfig extends DREConfig {
|
|||||||
private String tutorialEndGroup = "player";
|
private String tutorialEndGroup = "player";
|
||||||
|
|
||||||
/* Announcers */
|
/* Announcers */
|
||||||
private List<DColor> groupColorPriority = new ArrayList<>(Arrays.asList(
|
private List<Color> groupColorPriority = new ArrayList<>(Arrays.asList(
|
||||||
DARK_BLUE,
|
DARK_BLUE,
|
||||||
LIGHT_RED,
|
LIGHT_RED,
|
||||||
YELLOW,
|
YELLOW,
|
||||||
@ -281,7 +281,7 @@ public class MainConfig extends DREConfig {
|
|||||||
/**
|
/**
|
||||||
* @return the group colors
|
* @return the group colors
|
||||||
*/
|
*/
|
||||||
public List<DColor> getGroupColorPriority() {
|
public List<Color> getGroupColorPriority() {
|
||||||
return groupColorPriority;
|
return groupColorPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,14 +289,14 @@ public class MainConfig extends DREConfig {
|
|||||||
* @param count the group count
|
* @param count the group count
|
||||||
* @return the group color for the count
|
* @return the group color for the count
|
||||||
*/
|
*/
|
||||||
public DColor getGroupColorPriority(int count) {
|
public Color getGroupColorPriority(int count) {
|
||||||
return (count < groupColorPriority.size() && count >= 0) ? groupColorPriority.get(count) : DColor.WHITE;
|
return (count < groupColorPriority.size() && count >= 0) ? groupColorPriority.get(count) : Color.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param colors the colors to set
|
* @param colors the colors to set
|
||||||
*/
|
*/
|
||||||
public void setGroupColorPriority(List<DColor> colors) {
|
public void setGroupColorPriority(List<Color> colors) {
|
||||||
groupColorPriority = colors;
|
groupColorPriority = colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ public class MainConfig extends DREConfig {
|
|||||||
|
|
||||||
if (!config.contains("groupColorPriority")) {
|
if (!config.contains("groupColorPriority")) {
|
||||||
ArrayList<String> strings = new ArrayList<>();
|
ArrayList<String> strings = new ArrayList<>();
|
||||||
for (DColor color : groupColorPriority) {
|
for (Color color : groupColorPriority) {
|
||||||
strings.add(color.toString());
|
strings.add(color.toString());
|
||||||
}
|
}
|
||||||
config.set("groupColorPriority", strings);
|
config.set("groupColorPriority", strings);
|
||||||
@ -579,6 +579,7 @@ public class MainConfig extends DREConfig {
|
|||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
language = config.getString("language", language);
|
language = config.getString("language", language);
|
||||||
|
plugin.getMessageHandler().setDefaultLanguage(language);
|
||||||
enableEconomy = config.getBoolean("enableEconomy", enableEconomy);
|
enableEconomy = config.getBoolean("enableEconomy", enableEconomy);
|
||||||
chatEnabled = config.getBoolean("chatEnabled", chatEnabled);
|
chatEnabled = config.getBoolean("chatEnabled", chatEnabled);
|
||||||
chatFormatEdit = config.getString("chatFormat.edit", chatFormatEdit);
|
chatFormatEdit = config.getString("chatFormat.edit", chatFormatEdit);
|
||||||
@ -593,7 +594,7 @@ public class MainConfig extends DREConfig {
|
|||||||
|
|
||||||
if (config.getStringList("groupColorPriority").size() < 14) {
|
if (config.getStringList("groupColorPriority").size() < 14) {
|
||||||
ArrayList<String> strings = new ArrayList<>();
|
ArrayList<String> strings = new ArrayList<>();
|
||||||
for (DColor color : groupColorPriority) {
|
for (Color color : groupColorPriority) {
|
||||||
strings.add(color.toString());
|
strings.add(color.toString());
|
||||||
}
|
}
|
||||||
config.set("groupColorPriority", strings);
|
config.set("groupColorPriority", strings);
|
||||||
@ -605,8 +606,8 @@ public class MainConfig extends DREConfig {
|
|||||||
} else {
|
} else {
|
||||||
groupColorPriority.clear();
|
groupColorPriority.clear();
|
||||||
for (String color : config.getStringList("groupColorPriority")) {
|
for (String color : config.getStringList("groupColorPriority")) {
|
||||||
DColor dColor = EnumUtil.getEnum(DColor.class, color);
|
Color dColor = EnumUtil.getEnum(Color.class, color);
|
||||||
if (dColor != null && dColor != DColor.WHITE) {
|
if (dColor != null && dColor != Color.WHITE) {
|
||||||
groupColorPriority.add(dColor);
|
groupColorPriority.add(dColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,7 +18,6 @@ package de.erethon.dungeonsxl.dungeon;
|
|||||||
|
|
||||||
import de.erethon.commons.chat.MessageUtil;
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
import de.erethon.dungeonsxl.DungeonsXL;
|
import de.erethon.dungeonsxl.DungeonsXL;
|
||||||
import de.erethon.dungeonsxl.config.DMessage;
|
|
||||||
import de.erethon.dungeonsxl.world.DResourceWorld;
|
import de.erethon.dungeonsxl.world.DResourceWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -51,7 +50,8 @@ public class DungeonCache {
|
|||||||
dungeons.add(dungeon);
|
dungeons.add(dungeon);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.log(DMessage.LOG_ERROR_DUNGEON_SETUP.getMessage(file.getName()));
|
MessageUtil.log(plugin, "&4The setup of dungeon &6" + file.getName()
|
||||||
|
+ "&4 is incorrect. See https://github.com/DRE2N/DungeonsXL/wiki/dungeon-configuration for reference.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2019 Frank Baumann
|
* Copyright (C) 2012-2020 Frank Baumann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user