mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-25 03:55:22 +01:00
Update to DRECommons 3.1.1
This commit is contained in:
parent
9c311c3108
commit
4aa23b04c3
13
README.md
13
README.md
@ -48,10 +48,10 @@ 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 1.7.8 and higher. However, support for 1.11.x / 1.10.x / 1.9.x has a higher priority than support for 1.8.x and lower. See [here](../../wiki/legacy-support) for detailed information. Some cosmetic features require the Spigot API and will therefore not work with CraftBukkit.
|
DungeonsXL works with 1.7.8 and higher. However, support for 1.12 / 1.11.x / 1.10.x / 1.9.x has a higher priority than support for 1.8.x and lower. See [here](../../wiki/legacy-support) for detailed information. Some cosmetic features require the Spigot API and will therefore not work with CraftBukkit.
|
||||||
|
|
||||||
Older versions of DungeonsXL support versions since Minecraft 1.3.x, but of course, they are completely unsupported.
|
Older versions of DungeonsXL support versions since Minecraft 1.3.x, but of course, they are completely unsupported.
|
||||||
* [1.7.8-1.11.2](../../tree/master)
|
* [1.7.8-1.12](../../tree/master)
|
||||||
* [1.7.5](../../tree/50f772d14281bfe278dba2559d1758cc459c1a30)
|
* [1.7.5](../../tree/50f772d14281bfe278dba2559d1758cc459c1a30)
|
||||||
* [1.7.2](../../tree/eccf82b7335dfb0723e3cd37a57df1a968ea7842)
|
* [1.7.2](../../tree/eccf82b7335dfb0723e3cd37a57df1a968ea7842)
|
||||||
* [1.6.4](../../tree/780145cf783ea76fe1bfee04cf89216bd4f92e1d)
|
* [1.6.4](../../tree/780145cf783ea76fe1bfee04cf89216bd4f92e1d)
|
||||||
@ -67,14 +67,11 @@ Older versions of DungeonsXL support versions since Minecraft 1.3.x, but of cour
|
|||||||
Building DungeonsXL from source requires [Apache Maven](https://maven.apache.org/).
|
Building DungeonsXL from source requires [Apache Maven](https://maven.apache.org/).
|
||||||
Maven automatically fetches all dependencies and builds DungeonsXL; just run _build.bat_ or enter the command _mvn clean install_.
|
Maven automatically fetches all dependencies and builds DungeonsXL; just run _build.bat_ or enter the command _mvn clean install_.
|
||||||
|
|
||||||
#### BRCommons
|
#### DRECommons
|
||||||
[BRCommons](https://github.com/DRE2N/BRCommons) is a util library for common tasks. DungeonsXL contains BRCommons 1.0.6.
|
[DRECommons](https://github.com/DRE2N/DRECommons) is a util library for common tasks. DungeonsXL contains BRCommons 3.1.1.
|
||||||
|
|
||||||
#### Caliburn API
|
#### Caliburn API
|
||||||
[Caliburn](https://github.com/DRE2N/CaliburnAPI) is an API to read custom items and mobs from config files. DungeonsXL contains Caliburn Beta 0.2.3.
|
[Caliburn](https://github.com/DRE2N/CaliburnAPI) is an API to read custom items and mobs from config files. DungeonsXL contains Caliburn Beta 0.3.
|
||||||
|
|
||||||
#### ResourcePackAPI
|
|
||||||
inventivetalent's [ResourcePackAPI](https://www.spigotmc.org/resources/api-resourcepackapi-1-7-1-8-1-9-1-10.2397/) is an API to set the resourcepack of a player. DungeonsXL contains ResourcePackAPI 2.2.1.
|
|
||||||
|
|
||||||
### Java
|
### Java
|
||||||
Make sure that your server uses Java 7 or higher.
|
Make sure that your server uses Java 7 or higher.
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-abstract</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
</project>
|
|
@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 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 io.github.dre2n.dungeonsxl.util.worldloader;
|
|
||||||
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public abstract class InternalsProvider {
|
|
||||||
|
|
||||||
abstract World createWorld(WorldCreator creator);
|
|
||||||
|
|
||||||
}
|
|
72
core/pom.xml
72
core/pom.xml
@ -1,72 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-core</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-core</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<build>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<targetPath>.</targetPath>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
<directory>src/main/resources/</directory>
|
|
||||||
<includes>
|
|
||||||
<include>plugin.yml</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_11_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_10_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_9_R2</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_9_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 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 io.github.dre2n.dungeonsxl.util.worldloader;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A custom thread safe world loader.
|
|
||||||
*
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class WorldLoader {
|
|
||||||
|
|
||||||
static InternalsProvider internals;
|
|
||||||
|
|
||||||
static {
|
|
||||||
switch (CompatibilityHandler.getInstance().getInternals()) {
|
|
||||||
case v1_11_R1:
|
|
||||||
internals = new v1_11_R1();
|
|
||||||
break;
|
|
||||||
case v1_10_R1:
|
|
||||||
internals = new v1_10_R1();
|
|
||||||
break;
|
|
||||||
case v1_9_R2:
|
|
||||||
internals = new v1_9_R2();
|
|
||||||
break;
|
|
||||||
case v1_9_R1:
|
|
||||||
internals = new v1_9_R1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param creator
|
|
||||||
* the WorldCreator which stores the information to create the new world
|
|
||||||
* @return
|
|
||||||
* the new World
|
|
||||||
*/
|
|
||||||
public static World createWorld(WorldCreator creator) {
|
|
||||||
return internals.createWorld(creator);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl;
|
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.command.CustomCommand;
|
|
||||||
import io.github.dre2n.dungeonsxl.game.CustomGameType;
|
|
||||||
import io.github.dre2n.dungeonsxl.global.ChestProtection;
|
|
||||||
import io.github.dre2n.dungeonsxl.listener.*;
|
|
||||||
import io.github.dre2n.dungeonsxl.requirement.RequirementTypeCustom;
|
|
||||||
import io.github.dre2n.dungeonsxl.reward.RewardTypeCustom;
|
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSignTypeCustom;
|
|
||||||
import io.github.dre2n.dungeonsxl.trigger.TriggerTypeCustom;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class DXLTest extends JavaPlugin {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
// This is how you register /dxl subcommands.
|
|
||||||
DungeonsXL.getInstance().getCommands().addCommand(new CustomCommand());
|
|
||||||
|
|
||||||
// Register the DungeonsXL events just like any Bukkit event.
|
|
||||||
getServer().getPluginManager().registerEvents(new DGroupListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new DMobListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new DPlayerListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new DSignListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new EditWorldListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new GameWorldListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new RequirementListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new RewardListener(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new TriggerListener(), this);
|
|
||||||
|
|
||||||
// Register the custom game type
|
|
||||||
DungeonsXL.getInstance().getGameTypes().addGameType(CustomGameType.GHOST);
|
|
||||||
|
|
||||||
// There is currently no persistence API for loading the custom global protection :(
|
|
||||||
// New instances get added to the protections, anyways.
|
|
||||||
new ChestProtection(Bukkit.getWorlds().get(0).getBlockAt(0, 0, 0));
|
|
||||||
|
|
||||||
// Register the custom requirement type
|
|
||||||
DungeonsXL.getInstance().getRequirementTypes().addRequirement(RequirementTypeCustom.AWESOMENESS);
|
|
||||||
|
|
||||||
// Register the custom reward type
|
|
||||||
DungeonsXL.getInstance().getRewardTypes().addReward(RewardTypeCustom.HIGHWAY_TO_HELL);
|
|
||||||
|
|
||||||
// Register the custom edit Signs
|
|
||||||
DungeonsXL.getInstance().getDSigns().addDSign(DSignTypeCustom.CUSTOM);
|
|
||||||
|
|
||||||
// Register the custom trigger
|
|
||||||
DungeonsXL.getInstance().getTriggers().addTrigger(TriggerTypeCustom.CUSTOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.command;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class CustomCommand extends BRCommand {
|
|
||||||
|
|
||||||
public CustomCommand() {
|
|
||||||
setCommand("custom");
|
|
||||||
setMinArgs(0);
|
|
||||||
setMaxArgs(0);
|
|
||||||
setHelp("help pages message");
|
|
||||||
setPermission("permission.node");
|
|
||||||
setPlayerCommand(true);
|
|
||||||
setConsoleCommand(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
|
||||||
MessageUtil.sendMessage(sender, "This is a custom DXL command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,177 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.game;
|
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public enum CustomGameType implements GameType {
|
|
||||||
|
|
||||||
GHOST("My awesome game type", "Identifier", GameGoal.HIGHSCORE, false, false, false, false, false, false, false, GameMode.SPECTATOR, false);
|
|
||||||
|
|
||||||
private String displayName;
|
|
||||||
private String signName;
|
|
||||||
private GameGoal gameGoal;
|
|
||||||
private Boolean playerVersusPlayer;
|
|
||||||
private Boolean friendlyFire;
|
|
||||||
private Boolean rewards;
|
|
||||||
private Boolean showTime;
|
|
||||||
private Boolean breakBlocks;
|
|
||||||
private Boolean breakPlacedBlocks;
|
|
||||||
private Boolean placeBlocks;
|
|
||||||
private GameMode gameMode;
|
|
||||||
private Boolean lives;
|
|
||||||
|
|
||||||
CustomGameType(String displayName, String signName, GameGoal gameGoal, Boolean playerVersusPlayer, Boolean friendlyFire, Boolean rewards,
|
|
||||||
Boolean showTime, Boolean breakBlocks, Boolean breakPlacedBlocks, Boolean placeBlocks, GameMode gameMode, Boolean lives) {
|
|
||||||
this.displayName = displayName;
|
|
||||||
this.signName = signName;
|
|
||||||
this.gameGoal = gameGoal;
|
|
||||||
this.playerVersusPlayer = playerVersusPlayer;
|
|
||||||
this.friendlyFire = friendlyFire;
|
|
||||||
this.rewards = rewards;
|
|
||||||
this.showTime = showTime;
|
|
||||||
this.breakBlocks = breakBlocks;
|
|
||||||
this.breakPlacedBlocks = breakPlacedBlocks;
|
|
||||||
this.placeBlocks = placeBlocks;
|
|
||||||
this.gameMode = gameMode;
|
|
||||||
this.lives = lives;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GameGoal getGameGoal() {
|
|
||||||
return gameGoal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameGoal(GameGoal gameGoal) {
|
|
||||||
this.gameGoal = gameGoal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDisplayName() {
|
|
||||||
return displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDisplayName(String displayName) {
|
|
||||||
this.displayName = displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSignName() {
|
|
||||||
return signName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSignName(String signName) {
|
|
||||||
this.signName = signName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean isPlayerVersusPlayer() {
|
|
||||||
return playerVersusPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlayerVersusPlayer(Boolean playerVersusPlayer) {
|
|
||||||
this.playerVersusPlayer = playerVersusPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean isFriendlyFire() {
|
|
||||||
return friendlyFire;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFriendlyFire(Boolean friendlyFire) {
|
|
||||||
this.friendlyFire = friendlyFire;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean hasRewards() {
|
|
||||||
return rewards;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRewards(Boolean rewards) {
|
|
||||||
this.rewards = rewards;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean getShowTime() {
|
|
||||||
return showTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setShowTime(Boolean showTime) {
|
|
||||||
this.showTime = showTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean canBreakBlocks() {
|
|
||||||
return breakBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBreakBlocks(Boolean breakBlocks) {
|
|
||||||
this.breakBlocks = breakBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean canBreakPlacedBlocks() {
|
|
||||||
return breakPlacedBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBreakPlacedBlocks(Boolean breakPlacedBlocks) {
|
|
||||||
this.breakPlacedBlocks = breakPlacedBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean canPlaceBlocks() {
|
|
||||||
return placeBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlaceBlocks(Boolean placeBlocks) {
|
|
||||||
this.placeBlocks = placeBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GameMode getGameMode() {
|
|
||||||
return gameMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameMode(GameMode gameMode) {
|
|
||||||
this.gameMode = gameMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean hasLives() {
|
|
||||||
return lives;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLives(Boolean lives) {
|
|
||||||
this.lives = lives;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.global;
|
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class ChestProtection extends GlobalProtection {
|
|
||||||
|
|
||||||
private Block chest;
|
|
||||||
|
|
||||||
public ChestProtection(Block chest) {
|
|
||||||
super(chest.getWorld(), DungeonsXL.getInstance().getGlobalProtections().generateId(ChestProtection.class, chest.getWorld()));
|
|
||||||
this.chest = chest;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save(FileConfiguration config) {
|
|
||||||
String preString = "protections.chests." + getWorld().getName() + "." + getId();
|
|
||||||
|
|
||||||
config.set(preString + ".x", chest.getX());
|
|
||||||
config.set(preString + ".y", chest.getY());
|
|
||||||
config.set(preString + ".z", chest.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<Block> getBlocks() {
|
|
||||||
return Arrays.asList(chest);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.*;
|
|
||||||
import io.github.dre2n.dungeonsxl.reward.HighwayToHellReward;
|
|
||||||
import io.github.dre2n.dungeonsxl.reward.Reward;
|
|
||||||
import io.github.dre2n.dungeonsxl.reward.RewardTypeCustom;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class DGroupListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onCreate(DGroupCreateEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Cause: " + event.getCause());
|
|
||||||
MessageUtil.log(plugin, "Creator: " + event.getCreator().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDisband(DGroupDisbandEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Cause: " + event.getCause());
|
|
||||||
MessageUtil.log(plugin, "Disbander: " + event.getDisbander().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onFinishDungeon(DGroupFinishDungeonEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
|
|
||||||
MessageUtil.log("Giving one " + RewardTypeCustom.HIGHWAY_TO_HELL + " to all group members!");
|
|
||||||
Reward reward = new HighwayToHellReward();
|
|
||||||
for (Player Player : event.getDGroup().getPlayers()) {
|
|
||||||
reward.giveTo(Player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onStartFloor(DGroupStartFloorEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "GameWorld: " + event.getGameWorld().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onFinishFloor(DGroupFinishFloorEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Finished: " + event.getFinished().getName());
|
|
||||||
MessageUtil.log(plugin, "Next: " + event.getNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onReward(DGroupRewardEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Rewards: " + event.getRewards());
|
|
||||||
MessageUtil.log(plugin, "Excluded players: " + event.getExcludedPlayers());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.dmob.*;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class DMobListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDeath(DMobDeathEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DMob: " + event.getDMob());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onSpawn(DMobSpawnEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DMob: " + event.getDMob());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.*;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.instance.edit.DEditPlayerEscapeEvent;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.instance.game.DGamePlayerDeathEvent;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.instance.game.DGamePlayerFinishEvent;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class DPlayerListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDeath(DGamePlayerDeathEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DPlayer: " + event.getDPlayer().getPlayer().getName());
|
|
||||||
MessageUtil.log(plugin, "Lost lives: " + event.getLostLives());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEscape(DEditPlayerEscapeEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DPlayer: " + event.getDPlayer().getPlayer().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onFinish(DGamePlayerFinishEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DPlayer: " + event.getDPlayer().getPlayer().getName());
|
|
||||||
MessageUtil.log(plugin, "Player has to wait: " + event.getHasToWait());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onJoinDGroup(DPlayerJoinDGroupEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DPlayer: " + event.getDPlayer().getPlayer().getName());
|
|
||||||
MessageUtil.log(plugin, "DGroup: " + event.getDGroup().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onKick(DPlayerKickEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DPlayer: " + event.getDPlayer().getPlayer().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onLeaveDGroup(DPlayerLeaveDGroupEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DPlayer: " + event.getDPlayer().getPlayer().getName());
|
|
||||||
MessageUtil.log(plugin, "DGroup: " + (event.getDGroup() == null ? "" : event.getDGroup().getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*This would cause waaay too much console spam...
|
|
||||||
@EventHandler
|
|
||||||
public void onUpdate(DPlayerUpdateEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "DGamePlayer: " + event.getDPlayer().getPlayer().getName());
|
|
||||||
}*/
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.dsign.DSignRegistrationEvent;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class DSignListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onRegistration(DSignRegistrationEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "GameWorld (ID): " + (event.getGameWorld() == null ? "" : event.getGameWorld().getId()));
|
|
||||||
MessageUtil.log(plugin, "DSign: " + event.getDSign().getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.editworld.*;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class EditWorldListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onGenerate(EditWorldGenerateEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "EditWorld (ID): " + event.getEditWorld().getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onLoad(EditWorldLoadEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "EditWorld (name): " + event.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onSave(EditWorldGenerateEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "EditWorld (ID): " + event.getEditWorld().getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onUnload(EditWorldUnloadEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "EditWorld (ID): " + event.getEditWorld().getId());
|
|
||||||
MessageUtil.log(plugin, "Save?: " + event.getSave());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.gameworld.*;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class GameWorldListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onLoad(GameWorldLoadEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "GameWorld (name): " + event.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onGenerate(GameWorldStartGameEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "GameWorld (ID): " + event.getGameWorld().getId());
|
|
||||||
MessageUtil.log(plugin, "Game: " + event.getGame());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onUnload(GameWorldUnloadEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "GameWorld (ID): " + event.getGameWorld().getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.requirement.*;
|
|
||||||
import io.github.dre2n.dungeonsxl.requirement.AwesomenessRequirement;
|
|
||||||
import io.github.dre2n.dungeonsxl.requirement.RequirementTypeCustom;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class RequirementListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onCheck(RequirementCheckEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Requirement: " + event.getRequirement().getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDemand(RequirementDemandEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Requirement: " + event.getRequirement().getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onRegistration(RequirementRegistrationEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Requirement: " + event.getRequirement().getType());
|
|
||||||
|
|
||||||
if (event.getRequirement().getType() == RequirementTypeCustom.AWESOMENESS) {
|
|
||||||
MessageUtil.log(plugin, "Registering an " + RequirementTypeCustom.AWESOMENESS + " requirement.");
|
|
||||||
((AwesomenessRequirement) event.getRequirement()).setAwesomenessLevel(5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.reward.*;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class RewardListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onAddition(RewardAdditionEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Reward: " + event.getReward().getType());
|
|
||||||
MessageUtil.log(plugin, "DGroup: " + event.getDGroup().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onRegistration(RewardRegistrationEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Reward: " + event.getReward().getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.listener;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerRegistrationEvent;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class TriggerListener implements Listener {
|
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onAction(TriggerActionEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Trigger: " + event.getTrigger().getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onRegisration(TriggerRegistrationEvent event) {
|
|
||||||
MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
|
|
||||||
MessageUtil.log(plugin, "Trigger: " + event.getTrigger().getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.requirement;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class AwesomenessRequirement extends Requirement {
|
|
||||||
|
|
||||||
private RequirementType type = RequirementTypeCustom.AWESOMENESS;
|
|
||||||
|
|
||||||
private int level;
|
|
||||||
|
|
||||||
/* Getters and setters */
|
|
||||||
/**
|
|
||||||
* @return the awesomeness level
|
|
||||||
*/
|
|
||||||
public int getAwesomenessLevel() {
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param level
|
|
||||||
* the awesomeness level to set
|
|
||||||
*/
|
|
||||||
public void setAwesomenessLevel(int level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RequirementType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Actions */
|
|
||||||
@Override
|
|
||||||
public void setup(ConfigurationSection config) {
|
|
||||||
this.level = config.getInt("awesomeness");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean check(Player player) {
|
|
||||||
// Code that checks if the player has the requirement
|
|
||||||
MessageUtil.sendTitleMessage(player, "&6Are you AWESOME?");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void demand(Player player) {
|
|
||||||
// Code that removes the requirement if it is a fee
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.requirement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public enum RequirementTypeCustom implements RequirementType {
|
|
||||||
|
|
||||||
AWESOMENESS("awesomeness", AwesomenessRequirement.class);
|
|
||||||
|
|
||||||
private String identifier;
|
|
||||||
private Class<? extends Requirement> handler;
|
|
||||||
|
|
||||||
RequirementTypeCustom(String identifier, Class<? extends Requirement> handler) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
this.handler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends Requirement> getHandler() {
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.reward;
|
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class HighwayToHellReward extends Reward {
|
|
||||||
|
|
||||||
private RewardType type = RewardTypeCustom.HIGHWAY_TO_HELL;
|
|
||||||
|
|
||||||
public static final ItemStack RECORD;
|
|
||||||
|
|
||||||
static {
|
|
||||||
RECORD = new ItemStack(Material.GOLD_RECORD);
|
|
||||||
ItemMeta meta = RECORD.getItemMeta();
|
|
||||||
meta.setDisplayName(ChatColor.DARK_RED + "Highway To Hell");
|
|
||||||
meta.setLore(Arrays.asList(
|
|
||||||
ChatColor.GOLD + "1. Highway To Hell 3:28",
|
|
||||||
ChatColor.GOLD + "2. Girls Got Rhythm 3:24",
|
|
||||||
ChatColor.GOLD + "3. Walk All Over You 5:09",
|
|
||||||
ChatColor.GOLD + "4. Touch Too Much 4:26",
|
|
||||||
ChatColor.GOLD + "5. Beating Around The Bush 3:56",
|
|
||||||
ChatColor.GOLD + "6. Shot Down In Flames 3:23",
|
|
||||||
ChatColor.GOLD + "7. Get It Hot 2:34",
|
|
||||||
ChatColor.GOLD + "8. If You Want Blood (You've Got It) 4:37",
|
|
||||||
ChatColor.GOLD + "9. Love Hungry Man 4:17",
|
|
||||||
ChatColor.GOLD + "10. Night Prowler 6:16",
|
|
||||||
ChatColor.DARK_RED + "All titles A. Young - M. Young - B. Scott"
|
|
||||||
));
|
|
||||||
RECORD.setItemMeta(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void giveTo(Player player) {
|
|
||||||
// This is called when all rewards are given to the players. Each group member gets one item.
|
|
||||||
player.getInventory().addItem(RECORD);
|
|
||||||
MessageUtil.sendMessage(player, DungeonsXL.getInstance().getMessageConfig().getMessage(DMessages.REWARD_GENERAL, "1 Highway To Hell album"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RewardType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.reward;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public enum RewardTypeCustom implements RewardType {
|
|
||||||
|
|
||||||
HIGHWAY_TO_HELL("highwayToHell", HighwayToHellReward.class);
|
|
||||||
|
|
||||||
private String identifier;
|
|
||||||
private Class<? extends Reward> handler;
|
|
||||||
|
|
||||||
RewardTypeCustom(String identifier, Class<? extends Reward> handler) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
this.handler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends Reward> getHandler() {
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.sign;
|
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
|
||||||
import org.bukkit.block.Sign;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class CustomSign extends DSign {
|
|
||||||
|
|
||||||
private DSignType type = DSignTypeCustom.CUSTOM;
|
|
||||||
|
|
||||||
public CustomSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
|
||||||
super(sign, lines, gameWorld);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean check() {
|
|
||||||
// Check if the sign has the correct format
|
|
||||||
if (getSign().getLine(1).isEmpty()) {
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInit() {
|
|
||||||
// Stuff that happens when the sign is transformed
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPlayerTrigger(Player player) {
|
|
||||||
// Stuff that happens when one player triggers the sign
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTrigger() {
|
|
||||||
// Stuff that happens when the sign is triggered
|
|
||||||
remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DSignType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.sign;
|
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public enum DSignTypeCustom implements DSignType {
|
|
||||||
|
|
||||||
CUSTOM("Custom", "custom", false, false, CustomSign.class);
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String buildPermission;
|
|
||||||
private boolean onDungeonInit;
|
|
||||||
private boolean isProtected;
|
|
||||||
private Class<? extends DSign> handler;
|
|
||||||
|
|
||||||
DSignTypeCustom(String name, String buildPermission, boolean onDungeonInit, boolean isProtected, Class<? extends DSign> handler) {
|
|
||||||
this.name = name;
|
|
||||||
this.buildPermission = buildPermission;
|
|
||||||
this.onDungeonInit = onDungeonInit;
|
|
||||||
this.isProtected = isProtected;
|
|
||||||
this.handler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBuildPermission() {
|
|
||||||
return DPermissions.SIGN.getNode() + "." + buildPermission;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOnDungeonInit() {
|
|
||||||
return onDungeonInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isProtected() {
|
|
||||||
return isProtected;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends DSign> getHandler() {
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.trigger;
|
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
|
||||||
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class CustomTrigger extends Trigger {
|
|
||||||
|
|
||||||
private static Map<DGameWorld, ArrayList<CustomTrigger>> triggers = new HashMap<>();
|
|
||||||
|
|
||||||
private TriggerType type = TriggerTypeCustom.CUSTOM;
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public CustomTrigger(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTrigger(Player player) {
|
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTriggered(true);
|
|
||||||
this.setPlayer(player);
|
|
||||||
updateDSigns();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void register(DGameWorld gameWorld) {
|
|
||||||
if (!hasTriggers(gameWorld)) {
|
|
||||||
ArrayList<CustomTrigger> list = new ArrayList<>();
|
|
||||||
list.add(this);
|
|
||||||
triggers.put(gameWorld, list);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
triggers.get(gameWorld).add(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unregister(DGameWorld gameWorld) {
|
|
||||||
if (hasTriggers(gameWorld)) {
|
|
||||||
triggers.get(gameWorld).remove(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TriggerType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CustomTrigger getOrCreate(String value, DGameWorld gameWorld) {
|
|
||||||
if (triggers.containsKey(gameWorld)) {
|
|
||||||
for (CustomTrigger trigger : triggers.get(gameWorld)) {
|
|
||||||
if (trigger.value.equals(value)) {
|
|
||||||
return trigger;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CustomTrigger(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasTriggers(DGameWorld gameWorld) {
|
|
||||||
return !triggers.isEmpty() && triggers.containsKey(gameWorld);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Daniel Saukel
|
|
||||||
*
|
|
||||||
* 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 io.github.dre2n.dungeonsxl.trigger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public enum TriggerTypeCustom implements TriggerType {
|
|
||||||
|
|
||||||
CUSTOM("C", CustomTrigger.class);
|
|
||||||
|
|
||||||
private String identifier;
|
|
||||||
private Class<? extends Trigger> handler;
|
|
||||||
|
|
||||||
TriggerTypeCustom(String identifier, Class<? extends Trigger> handler) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
this.handler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends Trigger> getHandler() {
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
name: DXLTest
|
|
||||||
main: io.github.dre2n.dungeonsxl.DXLTest
|
|
||||||
version: TEST
|
|
||||||
author: Daniel Saukel
|
|
||||||
description: Test
|
|
||||||
depend: [DungeonsXL]
|
|
@ -1,40 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_10_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-craftbukkit_1_10_R1</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 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 io.github.dre2n.dungeonsxl.util.worldloader;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import net.minecraft.server.v1_10_R1.BlockPosition;
|
|
||||||
import net.minecraft.server.v1_10_R1.Convertable;
|
|
||||||
import net.minecraft.server.v1_10_R1.EntityTracker;
|
|
||||||
import net.minecraft.server.v1_10_R1.EnumDifficulty;
|
|
||||||
import net.minecraft.server.v1_10_R1.EnumGamemode;
|
|
||||||
import net.minecraft.server.v1_10_R1.IDataManager;
|
|
||||||
import net.minecraft.server.v1_10_R1.IProgressUpdate;
|
|
||||||
import net.minecraft.server.v1_10_R1.MinecraftServer;
|
|
||||||
import net.minecraft.server.v1_10_R1.ServerNBTManager;
|
|
||||||
import net.minecraft.server.v1_10_R1.WorldData;
|
|
||||||
import net.minecraft.server.v1_10_R1.WorldLoaderServer;
|
|
||||||
import net.minecraft.server.v1_10_R1.WorldManager;
|
|
||||||
import net.minecraft.server.v1_10_R1.WorldServer;
|
|
||||||
import net.minecraft.server.v1_10_R1.WorldSettings;
|
|
||||||
import net.minecraft.server.v1_10_R1.WorldType;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.craftbukkit.v1_10_R1.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
|
||||||
import org.bukkit.event.world.WorldInitEvent;
|
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class v1_10_R1 extends InternalsProvider {
|
|
||||||
|
|
||||||
MinecraftServer console;
|
|
||||||
CraftServer server = ((CraftServer) Bukkit.getServer());
|
|
||||||
Map<String, World> worlds;
|
|
||||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
|
||||||
File worldContainer = Bukkit.getWorldContainer();
|
|
||||||
Logger logger = Bukkit.getLogger();
|
|
||||||
|
|
||||||
v1_10_R1() {
|
|
||||||
try {
|
|
||||||
Field fConsole = CraftServer.class.getDeclaredField("console");
|
|
||||||
fConsole.setAccessible(true);
|
|
||||||
console = (MinecraftServer) fConsole.get(server);
|
|
||||||
|
|
||||||
Field fWorlds = CraftServer.class.getDeclaredField("worlds");
|
|
||||||
fWorlds.setAccessible(true);
|
|
||||||
worlds = (Map<String, World>) fWorlds.get(server);
|
|
||||||
|
|
||||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
World createWorld(WorldCreator creator) {
|
|
||||||
String name = creator.name();
|
|
||||||
ChunkGenerator generator = creator.generator();
|
|
||||||
File folder = new File(worldContainer, name);
|
|
||||||
World world = Bukkit.getWorld(name);
|
|
||||||
WorldType type = WorldType.getType(creator.type().getName());
|
|
||||||
boolean generateStructures = creator.generateStructures();
|
|
||||||
|
|
||||||
if (world != null) {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((folder.exists()) && (!folder.isDirectory())) {
|
|
||||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (generator == null) {
|
|
||||||
generator = server.getGenerator(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Convertable converter = new WorldLoaderServer(worldContainer, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
if (converter.isConvertable(name)) {
|
|
||||||
logger.info("Converting world '" + name + "'");
|
|
||||||
converter.convert(name, new IProgressUpdate() {
|
|
||||||
private long b = System.currentTimeMillis();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(String s) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(int i) {
|
|
||||||
if (System.currentTimeMillis() - this.b >= 1000L) {
|
|
||||||
this.b = System.currentTimeMillis();
|
|
||||||
MinecraftServer.LOGGER.info("Converting... " + i + "%");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void c(String s) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worlds.size();
|
|
||||||
boolean used = false;
|
|
||||||
do {
|
|
||||||
for (WorldServer server : console.worlds) {
|
|
||||||
used = server.dimension == dimension;
|
|
||||||
if (used) {
|
|
||||||
dimension++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (used);
|
|
||||||
boolean hardcore = false;
|
|
||||||
|
|
||||||
IDataManager sdm = new ServerNBTManager(worldContainer, name, true, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
WorldData worlddata = sdm.getWorldData();
|
|
||||||
WorldSettings worldSettings = null;
|
|
||||||
if (worlddata == null) {
|
|
||||||
worldSettings = new WorldSettings(creator.seed(), EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type);
|
|
||||||
worldSettings.setGeneratorSettings(creator.generatorSettings());
|
|
||||||
worlddata = new WorldData(worldSettings, name);
|
|
||||||
}
|
|
||||||
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
|
||||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, worlddata, dimension, console.methodProfiler, creator.environment(), generator).b();
|
|
||||||
|
|
||||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worldSettings != null) {
|
|
||||||
internal.a(worldSettings);
|
|
||||||
}
|
|
||||||
internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle();
|
|
||||||
|
|
||||||
internal.tracker = new EntityTracker(internal);
|
|
||||||
internal.addIWorldAccess(new WorldManager(console, internal));
|
|
||||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
|
||||||
internal.setSpawnFlags(true, true);
|
|
||||||
console.worlds.add(internal);
|
|
||||||
|
|
||||||
if (generator != null) {
|
|
||||||
internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld()));
|
|
||||||
}
|
|
||||||
|
|
||||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
|
||||||
logger.info("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
|
||||||
|
|
||||||
if (internal.getWorld().getKeepSpawnInMemory()) {
|
|
||||||
short short1 = 196;
|
|
||||||
long i = System.currentTimeMillis();
|
|
||||||
for (int j = -short1; j <= short1; j += 16) {
|
|
||||||
for (int k = -short1; k <= short1; k += 16) {
|
|
||||||
long l = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (l < i) {
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l > i + 1000L) {
|
|
||||||
int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
|
|
||||||
int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;
|
|
||||||
|
|
||||||
logger.info("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockPosition chunkcoordinates = internal.getSpawn();
|
|
||||||
try {
|
|
||||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
|
|
||||||
return internal.getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_11_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-craftbukkit_1_11_R1</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 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 io.github.dre2n.dungeonsxl.util.worldloader;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import net.minecraft.server.v1_11_R1.BlockPosition;
|
|
||||||
import net.minecraft.server.v1_11_R1.Convertable;
|
|
||||||
import net.minecraft.server.v1_11_R1.EntityTracker;
|
|
||||||
import net.minecraft.server.v1_11_R1.EnumDifficulty;
|
|
||||||
import net.minecraft.server.v1_11_R1.EnumGamemode;
|
|
||||||
import net.minecraft.server.v1_11_R1.IDataManager;
|
|
||||||
import net.minecraft.server.v1_11_R1.IProgressUpdate;
|
|
||||||
import net.minecraft.server.v1_11_R1.MinecraftServer;
|
|
||||||
import net.minecraft.server.v1_11_R1.ServerNBTManager;
|
|
||||||
import net.minecraft.server.v1_11_R1.WorldData;
|
|
||||||
import net.minecraft.server.v1_11_R1.WorldLoaderServer;
|
|
||||||
import net.minecraft.server.v1_11_R1.WorldManager;
|
|
||||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
|
||||||
import net.minecraft.server.v1_11_R1.WorldSettings;
|
|
||||||
import net.minecraft.server.v1_11_R1.WorldType;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
|
|
||||||
import org.bukkit.event.world.WorldInitEvent;
|
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class v1_11_R1 extends InternalsProvider {
|
|
||||||
|
|
||||||
MinecraftServer console;
|
|
||||||
CraftServer server = ((CraftServer) Bukkit.getServer());
|
|
||||||
Map<String, World> worlds;
|
|
||||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
|
||||||
File worldContainer = Bukkit.getWorldContainer();
|
|
||||||
Logger logger = Bukkit.getLogger();
|
|
||||||
|
|
||||||
v1_11_R1() {
|
|
||||||
try {
|
|
||||||
Field fConsole = CraftServer.class.getDeclaredField("console");
|
|
||||||
fConsole.setAccessible(true);
|
|
||||||
console = (MinecraftServer) fConsole.get(server);
|
|
||||||
|
|
||||||
Field fWorlds = CraftServer.class.getDeclaredField("worlds");
|
|
||||||
fWorlds.setAccessible(true);
|
|
||||||
worlds = (Map<String, World>) fWorlds.get(server);
|
|
||||||
|
|
||||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
World createWorld(WorldCreator creator) {
|
|
||||||
String name = creator.name();
|
|
||||||
ChunkGenerator generator = creator.generator();
|
|
||||||
File folder = new File(worldContainer, name);
|
|
||||||
World world = Bukkit.getWorld(name);
|
|
||||||
WorldType type = WorldType.getType(creator.type().getName());
|
|
||||||
boolean generateStructures = creator.generateStructures();
|
|
||||||
|
|
||||||
if (world != null) {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((folder.exists()) && (!folder.isDirectory())) {
|
|
||||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (generator == null) {
|
|
||||||
generator = server.getGenerator(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Convertable converter = new WorldLoaderServer(worldContainer, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
if (converter.isConvertable(name)) {
|
|
||||||
logger.info("Converting world '" + name + "'");
|
|
||||||
converter.convert(name, new IProgressUpdate() {
|
|
||||||
private long b = System.currentTimeMillis();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(String s) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(int i) {
|
|
||||||
if (System.currentTimeMillis() - this.b >= 1000L) {
|
|
||||||
this.b = System.currentTimeMillis();
|
|
||||||
MinecraftServer.LOGGER.info("Converting... " + i + "%");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void c(String s) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worlds.size();
|
|
||||||
boolean used = false;
|
|
||||||
do {
|
|
||||||
for (WorldServer server : console.worlds) {
|
|
||||||
used = server.dimension == dimension;
|
|
||||||
if (used) {
|
|
||||||
dimension++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (used);
|
|
||||||
boolean hardcore = false;
|
|
||||||
|
|
||||||
IDataManager sdm = new ServerNBTManager(worldContainer, name, true, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
WorldData worlddata = sdm.getWorldData();
|
|
||||||
WorldSettings worldSettings = null;
|
|
||||||
if (worlddata == null) {
|
|
||||||
worldSettings = new WorldSettings(creator.seed(), EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type);
|
|
||||||
worldSettings.setGeneratorSettings(creator.generatorSettings());
|
|
||||||
worlddata = new WorldData(worldSettings, name);
|
|
||||||
}
|
|
||||||
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
|
||||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, worlddata, dimension, console.methodProfiler, creator.environment(), generator).b();
|
|
||||||
|
|
||||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worldSettings != null) {
|
|
||||||
internal.a(worldSettings);
|
|
||||||
}
|
|
||||||
internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle();
|
|
||||||
|
|
||||||
internal.tracker = new EntityTracker(internal);
|
|
||||||
internal.addIWorldAccess(new WorldManager(console, internal));
|
|
||||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
|
||||||
internal.setSpawnFlags(true, true);
|
|
||||||
console.worlds.add(internal);
|
|
||||||
|
|
||||||
if (generator != null) {
|
|
||||||
internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld()));
|
|
||||||
}
|
|
||||||
|
|
||||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
|
||||||
logger.info("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
|
||||||
|
|
||||||
if (internal.getWorld().getKeepSpawnInMemory()) {
|
|
||||||
short short1 = 196;
|
|
||||||
long i = System.currentTimeMillis();
|
|
||||||
for (int j = -short1; j <= short1; j += 16) {
|
|
||||||
for (int k = -short1; k <= short1; k += 16) {
|
|
||||||
long l = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (l < i) {
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l > i + 1000L) {
|
|
||||||
int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
|
|
||||||
int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;
|
|
||||||
|
|
||||||
logger.info("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockPosition chunkcoordinates = internal.getSpawn();
|
|
||||||
try {
|
|
||||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
|
|
||||||
return internal.getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_9_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-craftbukkit_1_9_R1</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.9.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 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 io.github.dre2n.dungeonsxl.util.worldloader;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import net.minecraft.server.v1_9_R1.BlockPosition;
|
|
||||||
import net.minecraft.server.v1_9_R1.Convertable;
|
|
||||||
import net.minecraft.server.v1_9_R1.EntityTracker;
|
|
||||||
import net.minecraft.server.v1_9_R1.EnumDifficulty;
|
|
||||||
import net.minecraft.server.v1_9_R1.IDataManager;
|
|
||||||
import net.minecraft.server.v1_9_R1.IProgressUpdate;
|
|
||||||
import net.minecraft.server.v1_9_R1.MinecraftServer;
|
|
||||||
import net.minecraft.server.v1_9_R1.ServerNBTManager;
|
|
||||||
import net.minecraft.server.v1_9_R1.WorldData;
|
|
||||||
import net.minecraft.server.v1_9_R1.WorldLoaderServer;
|
|
||||||
import net.minecraft.server.v1_9_R1.WorldManager;
|
|
||||||
import net.minecraft.server.v1_9_R1.WorldServer;
|
|
||||||
import net.minecraft.server.v1_9_R1.WorldSettings;
|
|
||||||
import net.minecraft.server.v1_9_R1.WorldSettings.EnumGamemode;
|
|
||||||
import net.minecraft.server.v1_9_R1.WorldType;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
|
|
||||||
import org.bukkit.event.world.WorldInitEvent;
|
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class v1_9_R1 extends InternalsProvider {
|
|
||||||
|
|
||||||
MinecraftServer console;
|
|
||||||
CraftServer server = ((CraftServer) Bukkit.getServer());
|
|
||||||
Map<String, World> worlds;
|
|
||||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
|
||||||
File worldContainer = Bukkit.getWorldContainer();
|
|
||||||
Logger logger = Bukkit.getLogger();
|
|
||||||
|
|
||||||
v1_9_R1() {
|
|
||||||
try {
|
|
||||||
Field fConsole = CraftServer.class.getDeclaredField("console");
|
|
||||||
fConsole.setAccessible(true);
|
|
||||||
console = (MinecraftServer) fConsole.get(server);
|
|
||||||
|
|
||||||
Field fWorlds = CraftServer.class.getDeclaredField("worlds");
|
|
||||||
fWorlds.setAccessible(true);
|
|
||||||
worlds = (Map<String, World>) fWorlds.get(server);
|
|
||||||
|
|
||||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
World createWorld(WorldCreator creator) {
|
|
||||||
String name = creator.name();
|
|
||||||
ChunkGenerator generator = creator.generator();
|
|
||||||
File folder = new File(worldContainer, name);
|
|
||||||
World world = Bukkit.getWorld(name);
|
|
||||||
WorldType type = WorldType.getType(creator.type().getName());
|
|
||||||
boolean generateStructures = creator.generateStructures();
|
|
||||||
|
|
||||||
if (world != null) {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((folder.exists()) && (!folder.isDirectory())) {
|
|
||||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (generator == null) {
|
|
||||||
generator = server.getGenerator(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Convertable converter = new WorldLoaderServer(worldContainer, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
if (converter.isConvertable(name)) {
|
|
||||||
logger.info("Converting world '" + name + "'");
|
|
||||||
converter.convert(name, new IProgressUpdate() {
|
|
||||||
private long b = System.currentTimeMillis();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(String s) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(int i) {
|
|
||||||
if (System.currentTimeMillis() - this.b >= 1000L) {
|
|
||||||
this.b = System.currentTimeMillis();
|
|
||||||
MinecraftServer.LOGGER.info("Converting... " + i + "%");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void c(String s) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worlds.size();
|
|
||||||
boolean used = false;
|
|
||||||
do {
|
|
||||||
for (WorldServer server : console.worlds) {
|
|
||||||
used = server.dimension == dimension;
|
|
||||||
if (used) {
|
|
||||||
dimension++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (used);
|
|
||||||
boolean hardcore = false;
|
|
||||||
|
|
||||||
IDataManager sdm = new ServerNBTManager(worldContainer, name, true, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
WorldData worlddata = sdm.getWorldData();
|
|
||||||
WorldSettings worldSettings = null;
|
|
||||||
if (worlddata == null) {
|
|
||||||
worldSettings = new WorldSettings(creator.seed(), EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type);
|
|
||||||
worldSettings.setGeneratorSettings(creator.generatorSettings());
|
|
||||||
worlddata = new WorldData(worldSettings, name);
|
|
||||||
}
|
|
||||||
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
|
||||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, worlddata, dimension, console.methodProfiler, creator.environment(), generator).b();
|
|
||||||
|
|
||||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worldSettings != null) {
|
|
||||||
internal.a(worldSettings);
|
|
||||||
}
|
|
||||||
internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle();
|
|
||||||
|
|
||||||
internal.tracker = new EntityTracker(internal);
|
|
||||||
internal.addIWorldAccess(new WorldManager(console, internal));
|
|
||||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
|
||||||
internal.setSpawnFlags(true, true);
|
|
||||||
console.worlds.add(internal);
|
|
||||||
|
|
||||||
if (generator != null) {
|
|
||||||
internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld()));
|
|
||||||
}
|
|
||||||
|
|
||||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
|
||||||
logger.info("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
|
||||||
|
|
||||||
if (internal.getWorld().getKeepSpawnInMemory()) {
|
|
||||||
short short1 = 196;
|
|
||||||
long i = System.currentTimeMillis();
|
|
||||||
for (int j = -short1; j <= short1; j += 16) {
|
|
||||||
for (int k = -short1; k <= short1; k += 16) {
|
|
||||||
long l = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (l < i) {
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l > i + 1000L) {
|
|
||||||
int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
|
|
||||||
int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;
|
|
||||||
|
|
||||||
logger.info("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockPosition chunkcoordinates = internal.getSpawn();
|
|
||||||
try {
|
|
||||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
|
|
||||||
return internal.getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_9_R2</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-craftbukkit_1_9_R2</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 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 io.github.dre2n.dungeonsxl.util.worldloader;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import net.minecraft.server.v1_9_R2.BlockPosition;
|
|
||||||
import net.minecraft.server.v1_9_R2.Convertable;
|
|
||||||
import net.minecraft.server.v1_9_R2.EntityTracker;
|
|
||||||
import net.minecraft.server.v1_9_R2.EnumDifficulty;
|
|
||||||
import net.minecraft.server.v1_9_R2.IDataManager;
|
|
||||||
import net.minecraft.server.v1_9_R2.IProgressUpdate;
|
|
||||||
import net.minecraft.server.v1_9_R2.MinecraftServer;
|
|
||||||
import net.minecraft.server.v1_9_R2.ServerNBTManager;
|
|
||||||
import net.minecraft.server.v1_9_R2.WorldData;
|
|
||||||
import net.minecraft.server.v1_9_R2.WorldLoaderServer;
|
|
||||||
import net.minecraft.server.v1_9_R2.WorldManager;
|
|
||||||
import net.minecraft.server.v1_9_R2.WorldServer;
|
|
||||||
import net.minecraft.server.v1_9_R2.WorldSettings;
|
|
||||||
import net.minecraft.server.v1_9_R2.WorldSettings.EnumGamemode;
|
|
||||||
import net.minecraft.server.v1_9_R2.WorldType;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.craftbukkit.v1_9_R2.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
|
|
||||||
import org.bukkit.event.world.WorldInitEvent;
|
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Daniel Saukel
|
|
||||||
*/
|
|
||||||
public class v1_9_R2 extends InternalsProvider {
|
|
||||||
|
|
||||||
MinecraftServer console;
|
|
||||||
CraftServer server = ((CraftServer) Bukkit.getServer());
|
|
||||||
Map<String, World> worlds;
|
|
||||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
|
||||||
File worldContainer = Bukkit.getWorldContainer();
|
|
||||||
Logger logger = Bukkit.getLogger();
|
|
||||||
|
|
||||||
v1_9_R2() {
|
|
||||||
try {
|
|
||||||
Field fConsole = CraftServer.class.getDeclaredField("console");
|
|
||||||
fConsole.setAccessible(true);
|
|
||||||
console = (MinecraftServer) fConsole.get(server);
|
|
||||||
|
|
||||||
Field fWorlds = CraftServer.class.getDeclaredField("worlds");
|
|
||||||
fWorlds.setAccessible(true);
|
|
||||||
worlds = (Map<String, World>) fWorlds.get(server);
|
|
||||||
|
|
||||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
World createWorld(WorldCreator creator) {
|
|
||||||
String name = creator.name();
|
|
||||||
ChunkGenerator generator = creator.generator();
|
|
||||||
File folder = new File(worldContainer, name);
|
|
||||||
World world = Bukkit.getWorld(name);
|
|
||||||
WorldType type = WorldType.getType(creator.type().getName());
|
|
||||||
boolean generateStructures = creator.generateStructures();
|
|
||||||
|
|
||||||
if (world != null) {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((folder.exists()) && (!folder.isDirectory())) {
|
|
||||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (generator == null) {
|
|
||||||
generator = server.getGenerator(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Convertable converter = new WorldLoaderServer(worldContainer, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
if (converter.isConvertable(name)) {
|
|
||||||
logger.info("Converting world '" + name + "'");
|
|
||||||
converter.convert(name, new IProgressUpdate() {
|
|
||||||
private long b = System.currentTimeMillis();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(String s) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(int i) {
|
|
||||||
if (System.currentTimeMillis() - this.b >= 1000L) {
|
|
||||||
this.b = System.currentTimeMillis();
|
|
||||||
MinecraftServer.LOGGER.info("Converting... " + i + "%");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void c(String s) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worlds.size();
|
|
||||||
boolean used = false;
|
|
||||||
do {
|
|
||||||
for (WorldServer server : console.worlds) {
|
|
||||||
used = server.dimension == dimension;
|
|
||||||
if (used) {
|
|
||||||
dimension++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (used);
|
|
||||||
boolean hardcore = false;
|
|
||||||
|
|
||||||
IDataManager sdm = new ServerNBTManager(worldContainer, name, true, server.getHandle().getServer().getDataConverterManager());
|
|
||||||
WorldData worlddata = sdm.getWorldData();
|
|
||||||
WorldSettings worldSettings = null;
|
|
||||||
if (worlddata == null) {
|
|
||||||
worldSettings = new WorldSettings(creator.seed(), EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type);
|
|
||||||
worldSettings.setGeneratorSettings(creator.generatorSettings());
|
|
||||||
worlddata = new WorldData(worldSettings, name);
|
|
||||||
}
|
|
||||||
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
|
||||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, worlddata, dimension, console.methodProfiler, creator.environment(), generator).b();
|
|
||||||
|
|
||||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worldSettings != null) {
|
|
||||||
internal.a(worldSettings);
|
|
||||||
}
|
|
||||||
internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle();
|
|
||||||
|
|
||||||
internal.tracker = new EntityTracker(internal);
|
|
||||||
internal.addIWorldAccess(new WorldManager(console, internal));
|
|
||||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
|
||||||
internal.setSpawnFlags(true, true);
|
|
||||||
console.worlds.add(internal);
|
|
||||||
|
|
||||||
if (generator != null) {
|
|
||||||
internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld()));
|
|
||||||
}
|
|
||||||
|
|
||||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
|
||||||
logger.info("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
|
||||||
|
|
||||||
if (internal.getWorld().getKeepSpawnInMemory()) {
|
|
||||||
short short1 = 196;
|
|
||||||
long i = System.currentTimeMillis();
|
|
||||||
for (int j = -short1; j <= short1; j += 16) {
|
|
||||||
for (int k = -short1; k <= short1; k += 16) {
|
|
||||||
long l = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (l < i) {
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l > i + 1000L) {
|
|
||||||
int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
|
|
||||||
int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;
|
|
||||||
|
|
||||||
logger.info("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
|
|
||||||
i = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockPosition chunkcoordinates = internal.getSpawn();
|
|
||||||
try {
|
|
||||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
|
|
||||||
return internal.getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
98
pom.xml
98
pom.xml
@ -2,47 +2,87 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>io.github.dre2n</groupId>
|
<groupId>io.github.dre2n</groupId>
|
||||||
<artifactId>dungeonsxl</artifactId>
|
<artifactId>dungeonsxl</artifactId>
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
<version>0.16-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>DungeonsXL</name>
|
<name>DungeonsXL</name>
|
||||||
<url>https://dre2n.github.io</url>
|
<url>https://dre2n.github.io</url>
|
||||||
<description>Create custom dungeons and adventure maps with ease!</description>
|
<description>Create custom dungeons and adventure maps with ease!</description>
|
||||||
<properties>
|
<properties>
|
||||||
<buildNo></buildNo>
|
<buildNo></buildNo>
|
||||||
<skipTests>true</skipTests>
|
|
||||||
</properties>
|
</properties>
|
||||||
<modules>
|
<build>
|
||||||
<module>shade</module>
|
<finalName>dungeonsxl-${project.version}${buildNo}</finalName>
|
||||||
<module>core</module>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
<module>abstract</module>
|
<resources>
|
||||||
<module>rpapi-patch_1_11_R1</module>
|
<resource>
|
||||||
<module>craftbukkit_1_11_R1</module>
|
<targetPath>.</targetPath>
|
||||||
<module>craftbukkit_1_10_R1</module>
|
<filtering>true</filtering>
|
||||||
<module>craftbukkit_1_9_R2</module>
|
<directory>src/main/resources/</directory>
|
||||||
<module>craftbukkit_1_9_R1</module>
|
<includes>
|
||||||
</modules>
|
<include>plugin.yml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.5.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.7</source>
|
||||||
|
<target>1.7</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>2.4.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>io.github.dre2n:caliburn</include>
|
||||||
|
<include>io.github.dre2n:commons</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>io.github.dre2n.commons</pattern>
|
||||||
|
<shadedPattern>io.github.dre2n.dungeonsxl.util.commons</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
<version>1.12-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<artifactId>VaultAPI</artifactId>
|
||||||
<version>1.5</version>
|
<version>1.6</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.dre2n</groupId>
|
<groupId>io.github.dre2n</groupId>
|
||||||
<artifactId>commons</artifactId>
|
<artifactId>commons</artifactId>
|
||||||
<version>1.0.6</version>
|
<version>3.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.dre2n</groupId>
|
<groupId>io.github.dre2n</groupId>
|
||||||
<artifactId>caliburn</artifactId>
|
<artifactId>caliburn</artifactId>
|
||||||
<version>0.2.4</version>
|
<version>0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.dre2n</groupId>
|
<groupId>io.github.dre2n</groupId>
|
||||||
@ -60,37 +100,17 @@
|
|||||||
<artifactId>holographicdisplaysapi</artifactId>
|
<artifactId>holographicdisplaysapi</artifactId>
|
||||||
<version>2.1.7</version>
|
<version>2.1.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!--<dependency>
|
||||||
<groupId>pl.betoncraft.betonquest</groupId>
|
<groupId>pl.betoncraft.betonquest</groupId>
|
||||||
<artifactId>BetonQuest</artifactId>
|
<artifactId>BetonQuest</artifactId>
|
||||||
<version>1.8.5</version>
|
<version>1.8.5</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.black_ixx</groupId>
|
<groupId>org.black_ixx</groupId>
|
||||||
<artifactId>BossShop</artifactId>
|
<artifactId>BossShop</artifactId>
|
||||||
<version>2.6.9</version>
|
<version>2.6.9</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--<dependency>
|
|
||||||
<groupId>org.inventivetalent.resourcepackapi</groupId>
|
|
||||||
<artifactId>v1_11_R1</artifactId>
|
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.inventivetalent.resourcepackapi</groupId>
|
|
||||||
<artifactId>v1_10_R1</artifactId>
|
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.inventivetalent.resourcepackapi</groupId>
|
|
||||||
<artifactId>v1_9_R2</artifactId>
|
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.inventivetalent.resourcepackapi</groupId>
|
|
||||||
<artifactId>v1_9_R1</artifactId>
|
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-rpapi-patch_1_11_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-rpapi-patch_1_11_R1</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,243 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 inventivetalent. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
|
||||||
* permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
|
||||||
* authors and contributors and should not be interpreted as representing official policies,
|
|
||||||
* either expressed or implied, of anybody else.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.github.dre2n.dungeonsxl.util.reflectionhelper.minecraft;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.inventivetalent.reflection.resolver.ConstructorResolver;
|
|
||||||
import org.inventivetalent.reflection.resolver.FieldResolver;
|
|
||||||
import org.inventivetalent.reflection.resolver.MethodResolver;
|
|
||||||
import org.inventivetalent.reflection.resolver.minecraft.NMSClassResolver;
|
|
||||||
import org.inventivetalent.reflection.resolver.minecraft.OBCClassResolver;
|
|
||||||
import org.inventivetalent.reflection.util.AccessUtil;
|
|
||||||
import sun.reflect.ConstructorAccessor;
|
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper class to access minecraft/bukkit specific objects
|
|
||||||
*/
|
|
||||||
public class Minecraft {
|
|
||||||
static final Pattern NUMERIC_VERSION_PATTERN = Pattern.compile("v([0-9])_([0-9])*_R([0-9])");
|
|
||||||
|
|
||||||
public static final Version VERSION;
|
|
||||||
|
|
||||||
private static NMSClassResolver nmsClassResolver = new NMSClassResolver();
|
|
||||||
private static OBCClassResolver obcClassResolver = new OBCClassResolver();
|
|
||||||
private static Class<?> NmsEntity;
|
|
||||||
private static Class<?> CraftEntity;
|
|
||||||
|
|
||||||
static {
|
|
||||||
VERSION = Version.getVersion();
|
|
||||||
System.out.println("[ReflectionHelper] Version is " + VERSION);
|
|
||||||
|
|
||||||
try {
|
|
||||||
NmsEntity = nmsClassResolver.resolve("Entity");
|
|
||||||
CraftEntity = obcClassResolver.resolve("entity.CraftEntity");
|
|
||||||
} catch (ReflectiveOperationException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the current NMS/OBC version (format <code><version>.</code>
|
|
||||||
*/
|
|
||||||
public static String getVersion() {
|
|
||||||
return VERSION.name() + ".";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object getHandle(Object object) throws ReflectiveOperationException {
|
|
||||||
Method method;
|
|
||||||
try {
|
|
||||||
method = AccessUtil.setAccessible(object.getClass().getDeclaredMethod("getHandle"));
|
|
||||||
} catch (ReflectiveOperationException e) {
|
|
||||||
method = AccessUtil.setAccessible(CraftEntity.getDeclaredMethod("getHandle"));
|
|
||||||
}
|
|
||||||
return method.invoke(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Entity getBukkitEntity(Object object) throws ReflectiveOperationException {
|
|
||||||
Method method;
|
|
||||||
try {
|
|
||||||
method = AccessUtil.setAccessible(NmsEntity.getDeclaredMethod("getBukkitEntity"));
|
|
||||||
} catch (ReflectiveOperationException e) {
|
|
||||||
method = AccessUtil.setAccessible(CraftEntity.getDeclaredMethod("getHandle"));
|
|
||||||
}
|
|
||||||
return (Entity) method.invoke(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object getHandleSilent(Object object) {
|
|
||||||
try {
|
|
||||||
return getHandle(object);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Version {
|
|
||||||
UNKNOWN(-1) {
|
|
||||||
@Override
|
|
||||||
public boolean matchesPackageName(String packageName) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
v1_7_R1(10701),
|
|
||||||
v1_7_R2(10702),
|
|
||||||
v1_7_R3(10703),
|
|
||||||
v1_7_R4(10704),
|
|
||||||
|
|
||||||
v1_8_R1(10801),
|
|
||||||
v1_8_R2(10802),
|
|
||||||
v1_8_R3(10803),
|
|
||||||
//Does this even exists?
|
|
||||||
v1_8_R4(10804),
|
|
||||||
|
|
||||||
v1_9_R1(10901),
|
|
||||||
v1_9_R2(10902),
|
|
||||||
|
|
||||||
v1_10_R1(11001),
|
|
||||||
|
|
||||||
v1_11_R1(11101);
|
|
||||||
|
|
||||||
private int version;
|
|
||||||
|
|
||||||
Version(int version) {
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the version-number
|
|
||||||
*/
|
|
||||||
public int version() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param version the version to check
|
|
||||||
* @return <code>true</code> if this version is older than the specified version
|
|
||||||
*/
|
|
||||||
public boolean olderThan(Version version) {
|
|
||||||
return version() < version.version();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param version the version to check
|
|
||||||
* @return <code>true</code> if this version is newer than the specified version
|
|
||||||
*/
|
|
||||||
public boolean newerThan(Version version) {
|
|
||||||
return version() >= version.version();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param oldVersion The older version to check
|
|
||||||
* @param newVersion The newer version to check
|
|
||||||
* @return <code>true</code> if this version is newer than the oldVersion and older that the newVersion
|
|
||||||
*/
|
|
||||||
public boolean inRange(Version oldVersion, Version newVersion) {
|
|
||||||
return newerThan(oldVersion) && olderThan(newVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matchesPackageName(String packageName) {
|
|
||||||
return packageName.toLowerCase().contains(name().toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Version getVersion() {
|
|
||||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
|
||||||
String versionPackage = name.substring(name.lastIndexOf('.') + 1) + ".";
|
|
||||||
for (Version version : values()) {
|
|
||||||
if (version.matchesPackageName(versionPackage)) { return version; }
|
|
||||||
}
|
|
||||||
System.err.println("[ReflectionHelper] Failed to find version enum for '" + name + "'/'" + versionPackage + "'");
|
|
||||||
|
|
||||||
System.out.println("[ReflectionHelper] Generating dynamic constant...");
|
|
||||||
Matcher matcher = NUMERIC_VERSION_PATTERN.matcher(versionPackage);
|
|
||||||
while (matcher.find()) {
|
|
||||||
if (matcher.groupCount() < 3) { continue; }
|
|
||||||
|
|
||||||
String majorString = matcher.group(1);
|
|
||||||
String minorString = matcher.group(2);
|
|
||||||
if (minorString.length() == 1) { minorString = "0" + minorString; }
|
|
||||||
String patchString = matcher.group(3);
|
|
||||||
if (patchString.length() == 1) { patchString = "0" + patchString; }
|
|
||||||
|
|
||||||
String numVersionString = majorString + minorString + patchString;
|
|
||||||
int numVersion = Integer.parseInt(numVersionString);
|
|
||||||
String packge = versionPackage.substring(0, versionPackage.length() - 1);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Add enum value
|
|
||||||
Field valuesField = new FieldResolver(Version.class).resolve("$VALUES");
|
|
||||||
Version[] oldValues = (Version[]) valuesField.get(null);
|
|
||||||
Version[] newValues = new Version[oldValues.length + 1];
|
|
||||||
System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
|
|
||||||
Version dynamicVersion = (Version) newEnumInstance(Version.class, new Class[] {
|
|
||||||
String.class,
|
|
||||||
int.class,
|
|
||||||
int.class }, new Object[] {
|
|
||||||
packge,
|
|
||||||
newValues.length - 1,
|
|
||||||
numVersion });
|
|
||||||
newValues[newValues.length - 1] = dynamicVersion;
|
|
||||||
valuesField.set(null, newValues);
|
|
||||||
|
|
||||||
System.out.println("[ReflectionHelper] Injected dynamic version " + packge + " (#" + numVersion + ").");
|
|
||||||
System.out.println("[ReflectionHelper] Please inform inventivetalent about the outdated version, as this is not guaranteed to work.");
|
|
||||||
return dynamicVersion;
|
|
||||||
} catch (ReflectiveOperationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return name() + " (" + version() + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object newEnumInstance(Class clazz, Class[] types, Object[] values) throws ReflectiveOperationException {
|
|
||||||
Constructor constructor = new ConstructorResolver(clazz).resolve(types);
|
|
||||||
Field accessorField = new FieldResolver(Constructor.class).resolve("constructorAccessor");
|
|
||||||
ConstructorAccessor constructorAccessor = (ConstructorAccessor) accessorField.get(constructor);
|
|
||||||
if (constructorAccessor == null) {
|
|
||||||
new MethodResolver(Constructor.class).resolve("acquireConstructorAccessor").invoke(constructor);
|
|
||||||
constructorAccessor = (ConstructorAccessor) accessorField.get(constructor);
|
|
||||||
}
|
|
||||||
return constructorAccessor.newInstance(values);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,162 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 inventivetalent. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
|
||||||
* permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
|
||||||
* authors and contributors and should not be interpreted as representing official policies,
|
|
||||||
* either expressed or implied, of anybody else.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.github.dre2n.dungeonsxl.util.resourcepackapi.packet;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.channel.Channel;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
|
||||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
|
||||||
import net.minecraft.server.v1_11_R1.NetworkManager;
|
|
||||||
import net.minecraft.server.v1_11_R1.Packet;
|
|
||||||
import net.minecraft.server.v1_11_R1.PacketPlayInResourcePackStatus;
|
|
||||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.inventivetalent.rpapi.IPacketPlayResourcePackStatus;
|
|
||||||
import org.inventivetalent.rpapi.RPApiPlugin;
|
|
||||||
import org.inventivetalent.rpapi.Status;
|
|
||||||
|
|
||||||
public class PacketPlayResourcePackStatus_v1_11_R1 implements IPacketPlayResourcePackStatus
|
|
||||||
{
|
|
||||||
private Status status;
|
|
||||||
private Player p;
|
|
||||||
private static Field channelField;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Status getStatus() {
|
|
||||||
/*SL:55*/return this.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHash() {
|
|
||||||
/*SL:60*/return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPacketReceive(final Object v2, final Player v3) {
|
|
||||||
/*SL:65*/if (!(v2 instanceof Packet)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/*SL:66*/this.p = v3;
|
|
||||||
try {
|
|
||||||
final Field a1 = /*EL:69*/PacketPlayInResourcePackStatus.class.getDeclaredField("status");
|
|
||||||
/*SL:70*/a1.setAccessible(true);
|
|
||||||
/*SL:72*/this.status = Status.byID(((PacketPlayInResourcePackStatus.EnumResourcePackStatus)a1.get(v2)).ordinal());
|
|
||||||
}
|
|
||||||
catch (Exception a2) {
|
|
||||||
/*SL:74*/a2.printStackTrace();
|
|
||||||
}
|
|
||||||
/*SL:77*/if (this.getStatus() != null && v3 != null) {
|
|
||||||
/*SL:78*/RPApiPlugin.onResourcePackResult(this.getStatus(), v3, this.getHash());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inject() throws NoSuchFieldException, IllegalAccessException {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addChannelForPlayer(final Player v0) {
|
|
||||||
/*SL:90*/if (PacketPlayResourcePackStatus_v1_11_R1.channelField == null) {
|
|
||||||
try {
|
|
||||||
PacketPlayResourcePackStatus_v1_11_R1.channelField = /*EL:92*/NetworkManager.class.getDeclaredField("channel");
|
|
||||||
}
|
|
||||||
catch (NoSuchFieldException | SecurityException a1) {
|
|
||||||
/*SL:94*/a1.printStackTrace();
|
|
||||||
}
|
|
||||||
PacketPlayResourcePackStatus_v1_11_R1.channelField.setAccessible(/*EL:96*/true);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
final EntityPlayer v = /*EL:99*/((CraftPlayer)v0).getHandle();
|
|
||||||
final Channel v2 = (Channel)PacketPlayResourcePackStatus_v1_11_R1.channelField.get(/*EL:100*/v.playerConnection.networkManager);
|
|
||||||
/*SL:101*/new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
/*SL:106*//*EL:109*/v2.pipeline().addBefore("packet_handler", "RPApi", (io.netty.channel.ChannelHandler)new ChannelHandler(v0));
|
|
||||||
}
|
|
||||||
catch (Exception ex) {}
|
|
||||||
}
|
|
||||||
}, "RPApi channel adder").start();
|
|
||||||
}
|
|
||||||
catch (Exception v3) {
|
|
||||||
/*SL:112*/v3.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeChannelForPlayer(final Player v0) {
|
|
||||||
/*SL:118*/if (PacketPlayResourcePackStatus_v1_11_R1.channelField == null) {
|
|
||||||
try {
|
|
||||||
PacketPlayResourcePackStatus_v1_11_R1.channelField = /*EL:120*/NetworkManager.class.getDeclaredField("channel");
|
|
||||||
}
|
|
||||||
catch (NoSuchFieldException | SecurityException a1) {
|
|
||||||
/*SL:122*/a1.printStackTrace();
|
|
||||||
}
|
|
||||||
PacketPlayResourcePackStatus_v1_11_R1.channelField.setAccessible(/*EL:124*/true);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
final EntityPlayer v = /*EL:127*/((CraftPlayer)v0).getHandle();
|
|
||||||
final Channel v2 = (Channel)PacketPlayResourcePackStatus_v1_11_R1.channelField.get(/*EL:128*/v.playerConnection.networkManager);
|
|
||||||
/*SL:129*/new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
/*SL:134*//*EL:137*/v2.pipeline().remove("RPApi");
|
|
||||||
}
|
|
||||||
catch (Exception ex) {}
|
|
||||||
}
|
|
||||||
}, "RPApi channel remover").start();
|
|
||||||
}
|
|
||||||
catch (Exception v3) {
|
|
||||||
/*SL:140*/v3.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ChannelHandler extends ByteToMessageDecoder
|
|
||||||
{
|
|
||||||
private Player p;
|
|
||||||
|
|
||||||
public ChannelHandler(final Player a2) {
|
|
||||||
this.p = a2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void channelRead(final ChannelHandlerContext a1, final Object a2) throws Exception {
|
|
||||||
/*SL:154*/if (PacketPlayInResourcePackStatus.class.isAssignableFrom(a2.getClass())) {
|
|
||||||
/*SL:155*/PacketPlayResourcePackStatus_v1_11_R1.this.onPacketReceive(a2, this.p);
|
|
||||||
}
|
|
||||||
/*SL:157*/super.channelRead(a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void decode(final ChannelHandlerContext a1, final ByteBuf a2, final List<Object> a3) throws Exception {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
111
shade/pom.xml
111
shade/pom.xml
@ -1,111 +0,0 @@
|
|||||||
<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>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-shade</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>dungeonsxl-shade</name>
|
|
||||||
<parent>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl</artifactId>
|
|
||||||
<version>0.15.7-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<build>
|
|
||||||
<finalName>dungeonsxl-${project.version}${buildNo}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>2.4.3</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<relocations>
|
|
||||||
<relocation>
|
|
||||||
<pattern>io.github.dre2n.commons</pattern>
|
|
||||||
<shadedPattern>io.github.dre2n.dungeonsxl.util.commons</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
<relocation>
|
|
||||||
<pattern>org.inventivetalent.rpapi</pattern>
|
|
||||||
<shadedPattern>io.github.dre2n.dungeonsxl.util.resourcepackapi</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
<relocation>
|
|
||||||
<pattern>org.inventivetalent.reflection</pattern>
|
|
||||||
<shadedPattern>io.github.dre2n.dungeonsxl.util.reflectionhelper</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
<relocation>
|
|
||||||
<pattern>de.inventivegames.rpapi</pattern>
|
|
||||||
<shadedPattern>io.github.dre2n.dungeonsxl.util.resourcepackapi</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
</relocations>
|
|
||||||
<artifactSet>
|
|
||||||
<includes>
|
|
||||||
<include>io.github.dre2n:commons</include>
|
|
||||||
<include>io.github.dre2n:caliburn</include>
|
|
||||||
<include>io.github.dre2n:dungeonsxl-*</include>
|
|
||||||
<include>org.inventivetalent:reflection</include>
|
|
||||||
<include>org.inventivetalent.resourcepackapi:*</include>
|
|
||||||
</includes>
|
|
||||||
</artifactSet>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-abstract</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-core</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-rpapi-patch_1_11_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_11_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_10_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_9_R2</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.dre2n</groupId>
|
|
||||||
<artifactId>dungeonsxl-craftbukkit_1_9_R1</artifactId>
|
|
||||||
<version>${parent.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -19,33 +19,33 @@ package io.github.dre2n.dungeonsxl;
|
|||||||
import io.github.dre2n.caliburn.CaliburnAPI;
|
import io.github.dre2n.caliburn.CaliburnAPI;
|
||||||
import io.github.dre2n.commons.compatibility.Internals;
|
import io.github.dre2n.commons.compatibility.Internals;
|
||||||
import io.github.dre2n.commons.config.MessageConfig;
|
import io.github.dre2n.commons.config.MessageConfig;
|
||||||
import io.github.dre2n.commons.javaplugin.BRPlugin;
|
import io.github.dre2n.commons.javaplugin.DREPlugin;
|
||||||
import io.github.dre2n.commons.javaplugin.BRPluginSettings;
|
import io.github.dre2n.commons.javaplugin.DREPluginSettings;
|
||||||
import io.github.dre2n.dungeonsxl.announcer.Announcers;
|
import io.github.dre2n.dungeonsxl.announcer.AnnouncerCache;
|
||||||
import io.github.dre2n.dungeonsxl.command.DCommands;
|
import io.github.dre2n.dungeonsxl.command.DCommandCache;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.config.GlobalData;
|
import io.github.dre2n.dungeonsxl.config.GlobalData;
|
||||||
import io.github.dre2n.dungeonsxl.config.MainConfig;
|
import io.github.dre2n.dungeonsxl.config.MainConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeons;
|
import io.github.dre2n.dungeonsxl.dungeon.DungeonCache;
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.game.GameTypes;
|
import io.github.dre2n.dungeonsxl.game.GameTypeCache;
|
||||||
import io.github.dre2n.dungeonsxl.global.GlobalProtections;
|
import io.github.dre2n.dungeonsxl.global.GlobalProtectionCache;
|
||||||
import io.github.dre2n.dungeonsxl.loottable.DLootTables;
|
import io.github.dre2n.dungeonsxl.loottable.DLootTableCache;
|
||||||
import io.github.dre2n.dungeonsxl.mob.DMobTypes;
|
import io.github.dre2n.dungeonsxl.mob.DMobTypeCache;
|
||||||
import io.github.dre2n.dungeonsxl.mob.ExternalMobProviders;
|
import io.github.dre2n.dungeonsxl.mob.ExternalMobProviderCache;
|
||||||
import io.github.dre2n.dungeonsxl.player.DClasses;
|
import io.github.dre2n.dungeonsxl.player.DClasses;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayers;
|
import io.github.dre2n.dungeonsxl.player.DPlayerCache;
|
||||||
import io.github.dre2n.dungeonsxl.requirement.RequirementTypes;
|
import io.github.dre2n.dungeonsxl.requirement.RequirementTypeCache;
|
||||||
import io.github.dre2n.dungeonsxl.reward.DLootInventory;
|
import io.github.dre2n.dungeonsxl.reward.DLootInventory;
|
||||||
import io.github.dre2n.dungeonsxl.reward.RewardTypes;
|
import io.github.dre2n.dungeonsxl.reward.RewardTypeCache;
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSignTypes;
|
import io.github.dre2n.dungeonsxl.sign.DSignTypeCache;
|
||||||
import io.github.dre2n.dungeonsxl.sign.SignScripts;
|
import io.github.dre2n.dungeonsxl.sign.SignScripts;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.TriggerTypes;
|
import io.github.dre2n.dungeonsxl.trigger.TriggerTypeCache;
|
||||||
import io.github.dre2n.dungeonsxl.util.NoReload;
|
import io.github.dre2n.dungeonsxl.util.NoReload;
|
||||||
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
import io.github.dre2n.dungeonsxl.world.DWorldCache;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@ -57,7 +57,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
*
|
*
|
||||||
* @author Frank Baumann, Tobias Schmitz, Daniel Saukel
|
* @author Frank Baumann, Tobias Schmitz, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class DungeonsXL extends BRPlugin {
|
public class DungeonsXL extends DREPlugin {
|
||||||
|
|
||||||
private static DungeonsXL instance;
|
private static DungeonsXL instance;
|
||||||
|
|
||||||
@ -78,22 +78,22 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
private MainConfig mainConfig;
|
private MainConfig mainConfig;
|
||||||
private MessageConfig messageConfig;
|
private MessageConfig messageConfig;
|
||||||
|
|
||||||
private DCommands dCommands;
|
private DCommandCache dCommands;
|
||||||
private DSignTypes dSigns;
|
private DSignTypeCache dSigns;
|
||||||
private GameTypes gameTypes;
|
private GameTypeCache gameTypes;
|
||||||
private RequirementTypes requirementTypes;
|
private RequirementTypeCache requirementTypes;
|
||||||
private RewardTypes rewardTypes;
|
private RewardTypeCache rewardTypes;
|
||||||
private TriggerTypes triggers;
|
private TriggerTypeCache triggers;
|
||||||
private Dungeons dungeons;
|
private DungeonCache dungeons;
|
||||||
private GlobalProtections protections;
|
private GlobalProtectionCache protections;
|
||||||
private ExternalMobProviders dMobProviders;
|
private ExternalMobProviderCache dMobProviders;
|
||||||
private DPlayers dPlayers;
|
private DPlayerCache dPlayers;
|
||||||
private Announcers announcers;
|
private AnnouncerCache announcers;
|
||||||
private DClasses dClasses;
|
private DClasses dClasses;
|
||||||
private DLootTables dLootTables;
|
private DLootTableCache dLootTables;
|
||||||
private DMobTypes dMobTypes;
|
private DMobTypeCache dMobTypes;
|
||||||
private SignScripts signScripts;
|
private SignScripts signScripts;
|
||||||
private DWorlds dWorlds;
|
private DWorldCache dWorlds;
|
||||||
|
|
||||||
private CopyOnWriteArrayList<DLootInventory> dLootInventories = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<DLootInventory> dLootInventories = new CopyOnWriteArrayList<>();
|
||||||
private CopyOnWriteArrayList<Game> games = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<Game> games = new CopyOnWriteArrayList<>();
|
||||||
@ -114,7 +114,7 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
* ##########################
|
* ##########################
|
||||||
*/
|
*/
|
||||||
|
|
||||||
settings = new BRPluginSettings(true, true, true, true, true, 9488, Internals.andHigher(Internals.v1_7_R3));
|
settings = new DREPluginSettings(true, true, true, true, true, 9488, Internals.andHigher(Internals.v1_7_R3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -244,7 +244,7 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
loadDLootTables(LOOT_TABLES);
|
loadDLootTables(LOOT_TABLES);
|
||||||
loadDMobTypes(MOBS);
|
loadDMobTypes(MOBS);
|
||||||
loadSignScripts(SIGNS);
|
loadSignScripts(SIGNS);
|
||||||
loadDCommands();
|
loadDCommandCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save and load
|
// Save and load
|
||||||
@ -279,8 +279,8 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
/**
|
/**
|
||||||
* @return the loaded instance of GlobalData
|
* @return the loaded instance of GlobalData
|
||||||
*/
|
*/
|
||||||
public static GlobalData getGlobalData() {
|
public GlobalData getGlobalData() {
|
||||||
return instance.globalData;
|
return globalData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,8 +293,8 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
/**
|
/**
|
||||||
* @return the loaded instance of MainConfig
|
* @return the loaded instance of MainConfig
|
||||||
*/
|
*/
|
||||||
public static MainConfig getMainConfig() {
|
public MainConfig getMainConfig() {
|
||||||
return instance.mainConfig;
|
return mainConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -307,178 +307,178 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
/**
|
/**
|
||||||
* @return the loaded instance of MessageConfig
|
* @return the loaded instance of MessageConfig
|
||||||
*/
|
*/
|
||||||
public static MessageConfig getMessageConfig() {
|
public MessageConfig getMessageConfig() {
|
||||||
return instance.messageConfig;
|
return messageConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of MessageConfig
|
* load / reload a new instance of MessageConfig
|
||||||
*/
|
*/
|
||||||
public void loadMessageConfig(File file) {
|
public void loadMessageConfig(File file) {
|
||||||
messageConfig = new MessageConfig(DMessages.class, file);
|
messageConfig = new MessageConfig(DMessage.class, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of DCommands
|
* @return the loaded instance of DCommandCache
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DCommands getCommands() {
|
public DCommandCache getCommandCache() {
|
||||||
return dCommands;
|
return dCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of DCommands
|
* load / reload a new instance of DCommandCache
|
||||||
*/
|
*/
|
||||||
public void loadDCommands() {
|
public void loadDCommandCache() {
|
||||||
dCommands = new DCommands(this);
|
dCommands = new DCommandCache(this);
|
||||||
dCommands.register(this);
|
dCommands.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the dSigns
|
* @return the dSigns
|
||||||
*/
|
*/
|
||||||
public static DSignTypes getDSigns() {
|
public DSignTypeCache getDSigns() {
|
||||||
return instance.dSigns;
|
return dSigns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of DSignTypes
|
* load / reload a new instance of DSignTypes
|
||||||
*/
|
*/
|
||||||
public void loadDSigns() {
|
public void loadDSigns() {
|
||||||
dSigns = new DSignTypes();
|
dSigns = new DSignTypeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the game types
|
* @return the game types
|
||||||
*/
|
*/
|
||||||
public static GameTypes getGameTypes() {
|
public GameTypeCache getGameTypes() {
|
||||||
return instance.gameTypes;
|
return gameTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of GameTypes
|
* load / reload a new instance of GameTypes
|
||||||
*/
|
*/
|
||||||
public void loadGameTypes() {
|
public void loadGameTypes() {
|
||||||
gameTypes = new GameTypes();
|
gameTypes = new GameTypeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the requirement types
|
* @return the requirement types
|
||||||
*/
|
*/
|
||||||
public static RequirementTypes getRequirementTypes() {
|
public RequirementTypeCache getRequirementTypes() {
|
||||||
return instance.requirementTypes;
|
return requirementTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of RequirementTypes
|
* load / reload a new instance of RequirementTypes
|
||||||
*/
|
*/
|
||||||
public void loadRequirementTypes() {
|
public void loadRequirementTypes() {
|
||||||
requirementTypes = new RequirementTypes();
|
requirementTypes = new RequirementTypeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the reward types
|
* @return the reward types
|
||||||
*/
|
*/
|
||||||
public static RewardTypes getRewardTypes() {
|
public RewardTypeCache getRewardTypes() {
|
||||||
return instance.rewardTypes;
|
return rewardTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of RewardTypes
|
* load / reload a new instance of RewardTypes
|
||||||
*/
|
*/
|
||||||
public void loadRewardTypes() {
|
public void loadRewardTypes() {
|
||||||
rewardTypes = new RewardTypes();
|
rewardTypes = new RewardTypeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the triggers
|
* @return the triggers
|
||||||
*/
|
*/
|
||||||
public static TriggerTypes getTriggers() {
|
public TriggerTypeCache getTriggers() {
|
||||||
return instance.triggers;
|
return triggers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of TriggerTypes
|
* load / reload a new instance of TriggerTypes
|
||||||
*/
|
*/
|
||||||
public void loadTriggers() {
|
public void loadTriggers() {
|
||||||
triggers = new TriggerTypes();
|
triggers = new TriggerTypeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of Dungeons
|
* @return the loaded instance of Dungeons
|
||||||
*/
|
*/
|
||||||
public static Dungeons getDungeons() {
|
public DungeonCache getDungeons() {
|
||||||
return instance.dungeons;
|
return dungeons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of Dungeons
|
* load / reload a new instance of Dungeons
|
||||||
*/
|
*/
|
||||||
public void loadDungeons(File file) {
|
public void loadDungeons(File file) {
|
||||||
dungeons = new Dungeons(file);
|
dungeons = new DungeonCache(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of GlobalProtections
|
* @return the loaded instance of GlobalProtections
|
||||||
*/
|
*/
|
||||||
public static GlobalProtections getGlobalProtections() {
|
public GlobalProtectionCache getGlobalProtections() {
|
||||||
return instance.protections;
|
return protections;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of GlobalProtections
|
* load / reload a new instance of GlobalProtections
|
||||||
*/
|
*/
|
||||||
public void loadGlobalProtections() {
|
public void loadGlobalProtections() {
|
||||||
protections = new GlobalProtections();
|
protections = new GlobalProtectionCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of ExternalMobProviders
|
* @return the loaded instance of ExternalMobProviders
|
||||||
*/
|
*/
|
||||||
public static ExternalMobProviders getExternalMobProviders() {
|
public ExternalMobProviderCache getExternalMobProviders() {
|
||||||
return instance.dMobProviders;
|
return dMobProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of ExternalMobProviders
|
* load / reload a new instance of ExternalMobProviders
|
||||||
*/
|
*/
|
||||||
public void loadExternalMobProviders() {
|
public void loadExternalMobProviders() {
|
||||||
dMobProviders = new ExternalMobProviders();
|
dMobProviders = new ExternalMobProviderCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of DPlayers
|
* @return the loaded instance of DPlayers
|
||||||
*/
|
*/
|
||||||
public static DPlayers getDPlayers() {
|
public DPlayerCache getDPlayers() {
|
||||||
return instance.dPlayers;
|
return dPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of DPlayers
|
* load / reload a new instance of DPlayers
|
||||||
*/
|
*/
|
||||||
public void loadDPlayers() {
|
public void loadDPlayers() {
|
||||||
dPlayers = new DPlayers();
|
dPlayers = new DPlayerCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of Announcers
|
* @return the loaded instance of Announcers
|
||||||
*/
|
*/
|
||||||
public static Announcers getAnnouncers() {
|
public AnnouncerCache getAnnouncers() {
|
||||||
return instance.announcers;
|
return announcers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of Announcers
|
* load / reload a new instance of Announcers
|
||||||
*/
|
*/
|
||||||
public void loadAnnouncers(File file) {
|
public void loadAnnouncers(File file) {
|
||||||
announcers = new Announcers(file);
|
announcers = new AnnouncerCache(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of DClasses
|
* @return the loaded instance of DClasses
|
||||||
*/
|
*/
|
||||||
public static DClasses getDClasses() {
|
public DClasses getDClasses() {
|
||||||
return instance.dClasses;
|
return dClasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -491,36 +491,36 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
/**
|
/**
|
||||||
* @return the loaded instance of DLootTables
|
* @return the loaded instance of DLootTables
|
||||||
*/
|
*/
|
||||||
public static DLootTables getDLootTables() {
|
public DLootTableCache getDLootTables() {
|
||||||
return instance.dLootTables;
|
return dLootTables;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of DLootTables
|
* load / reload a new instance of DLootTables
|
||||||
*/
|
*/
|
||||||
public void loadDLootTables(File file) {
|
public void loadDLootTables(File file) {
|
||||||
dLootTables = new DLootTables(file);
|
dLootTables = new DLootTableCache(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of DMobTypes
|
* @return the loaded instance of DMobTypes
|
||||||
*/
|
*/
|
||||||
public static DMobTypes getDMobTypes() {
|
public DMobTypeCache getDMobTypes() {
|
||||||
return instance.dMobTypes;
|
return dMobTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of DMobTypes
|
* load / reload a new instance of DMobTypes
|
||||||
*/
|
*/
|
||||||
public void loadDMobTypes(File file) {
|
public void loadDMobTypes(File file) {
|
||||||
dMobTypes = new DMobTypes(file);
|
dMobTypes = new DMobTypeCache(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of SignScripts
|
* @return the loaded instance of SignScripts
|
||||||
*/
|
*/
|
||||||
public static SignScripts getSignScripts() {
|
public SignScripts getSignScripts() {
|
||||||
return instance.signScripts;
|
return signScripts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -533,36 +533,36 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
/**
|
/**
|
||||||
* @return the loaded instance of DWorlds
|
* @return the loaded instance of DWorlds
|
||||||
*/
|
*/
|
||||||
public static DWorlds getDWorlds() {
|
public DWorldCache getDWorlds() {
|
||||||
return instance.dWorlds;
|
return dWorlds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of DWorlds
|
* load / reload a new instance of DWorlds
|
||||||
*/
|
*/
|
||||||
public void loadDWorlds(File folder) {
|
public void loadDWorlds(File folder) {
|
||||||
dWorlds = new DWorlds(MAPS);
|
dWorlds = new DWorldCache(MAPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the dLootInventories
|
* @return the dLootInventories
|
||||||
*/
|
*/
|
||||||
public static List<DLootInventory> getDLootInventories() {
|
public List<DLootInventory> getDLootInventories() {
|
||||||
return instance.dLootInventories;
|
return dLootInventories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the games
|
* @return the games
|
||||||
*/
|
*/
|
||||||
public static List<Game> getGames() {
|
public List<Game> getGames() {
|
||||||
return instance.games;
|
return games;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the dGroups
|
* @return the dGroups
|
||||||
*/
|
*/
|
||||||
public static List<DGroup> getDGroups() {
|
public List<DGroup> getDGroups() {
|
||||||
return instance.dGroups;
|
return dGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,15 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.announcer;
|
package io.github.dre2n.dungeonsxl.announcer;
|
||||||
|
|
||||||
|
import io.github.dre2n.commons.chat.DefaultFontInfo;
|
||||||
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
||||||
import io.github.dre2n.commons.util.guiutil.GUIUtil;
|
|
||||||
import io.github.dre2n.commons.util.messageutil.DefaultFontInfo;
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
|
import io.github.dre2n.dungeonsxl.util.GUIUtil;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -96,7 +96,7 @@ public class Announcer {
|
|||||||
if (multiFloor) {
|
if (multiFloor) {
|
||||||
dungeonName = identifier;
|
dungeonName = identifier;
|
||||||
|
|
||||||
Dungeon dungeon = DungeonsXL.getDungeons().getByName(identifier);
|
Dungeon dungeon = DungeonsXL.getInstance().getDungeons().getByName(identifier);
|
||||||
if (dungeon != null) {
|
if (dungeon != null) {
|
||||||
mapName = dungeon.getConfig().getStartFloor().getName();
|
mapName = dungeon.getConfig().getStartFloor().getName();
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ public class Announcer {
|
|||||||
if (multiFloor) {
|
if (multiFloor) {
|
||||||
dungeonName = identifier;
|
dungeonName = identifier;
|
||||||
|
|
||||||
Dungeon dungeon = DungeonsXL.getDungeons().getByName(identifier);
|
Dungeon dungeon = DungeonsXL.getInstance().getDungeons().getByName(identifier);
|
||||||
if (dungeon != null) {
|
if (dungeon != null) {
|
||||||
mapName = dungeon.getConfig().getStartFloor().getName();
|
mapName = dungeon.getConfig().getStartFloor().getName();
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ public class Announcer {
|
|||||||
if (CompatibilityHandler.getInstance().isSpigot()) {
|
if (CompatibilityHandler.getInstance().isSpigot()) {
|
||||||
ClickEvent onClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl join " + name);
|
ClickEvent onClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl join " + name);
|
||||||
|
|
||||||
BaseComponent[] message = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', DMessages.ANNOUNCER_CLICK.getMessage()));
|
BaseComponent[] message = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', DMessage.ANNOUNCER_CLICK.getMessage()));
|
||||||
for (BaseComponent slice : message) {
|
for (BaseComponent slice : message) {
|
||||||
slice.setClickEvent(onClick);
|
slice.setClickEvent(onClick);
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ public class Announcer {
|
|||||||
player.spigot().sendMessage(toSend.toArray(new BaseComponent[]{}));
|
player.spigot().sendMessage(toSend.toArray(new BaseComponent[]{}));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendCenteredMessage(player, DMessages.ANNOUNCER_CMD.getMessage(getName().toUpperCase()));
|
MessageUtil.sendCenteredMessage(player, DMessage.ANNOUNCER_CMD.getMessage(getName().toUpperCase()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ public class Announcer {
|
|||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
|
||||||
DGroup dGroup = dGroups.get(groupCount);
|
DGroup dGroup = dGroups.get(groupCount);
|
||||||
if (!DungeonsXL.getDGroups().contains(dGroup)) {
|
if (!DungeonsXL.getInstance().getDGroups().contains(dGroup)) {
|
||||||
dGroups.set(groupCount, null);
|
dGroups.set(groupCount, null);
|
||||||
|
|
||||||
} else if (dGroup != null) {
|
} else if (dGroup != null) {
|
||||||
@ -436,7 +436,7 @@ public class Announcer {
|
|||||||
|
|
||||||
boolean full = playerCount >= maxPlayersPerGroup;
|
boolean full = playerCount >= maxPlayersPerGroup;
|
||||||
|
|
||||||
ItemStack button = new ItemStack(Material.WOOL, playerCount, DungeonsXL.getMainConfig().getGroupColorPriority().get(groupCount).getWoolData());
|
ItemStack button = new ItemStack(Material.WOOL, playerCount, DungeonsXL.getInstance().getMainConfig().getGroupColorPriority().get(groupCount).getWoolData());
|
||||||
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 + "]");
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.announcer;
|
package io.github.dre2n.dungeonsxl.announcer;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.FileUtil;
|
import io.github.dre2n.commons.misc.FileUtil;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -30,7 +30,7 @@ import org.bukkit.scheduler.BukkitTask;
|
|||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class Announcers {
|
public class AnnouncerCache {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
|
|
||||||
@ -38,13 +38,13 @@ public class Announcers {
|
|||||||
|
|
||||||
private List<Announcer> announcers = new ArrayList<>();
|
private List<Announcer> announcers = new ArrayList<>();
|
||||||
|
|
||||||
public Announcers(File file) {
|
public AnnouncerCache(File file) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
for (File script : FileUtil.getFilesForFolder(file)) {
|
for (File script : FileUtil.getFilesForFolder(file)) {
|
||||||
announcers.add(new Announcer(script));
|
announcers.add(new Announcer(script));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
startAnnouncerTask(DungeonsXL.getMainConfig().getAnnouncmentInterval());
|
startAnnouncerTask(DungeonsXL.getInstance().getMainConfig().getAnnouncmentInterval());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.announcer;
|
package io.github.dre2n.dungeonsxl.announcer;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.guiutil.ButtonClickEvent;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -30,17 +30,15 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class AnnouncerListener implements Listener {
|
public class AnnouncerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onButtonClick(ButtonClickEvent event) {
|
public void onButtonClick(InventoryClickEvent event) {
|
||||||
Player player = event.getPlayer();
|
if (!(event.getWhoClicked() instanceof Player)) {
|
||||||
|
|
||||||
Inventory gui = event.getGUI();
|
|
||||||
if (!DungeonsXL.getInstance().getGUIs().contains(gui)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
|
Inventory gui = event.getInventory();
|
||||||
ItemStack button = gui.getItem(event.getSlot());
|
ItemStack button = gui.getItem(event.getSlot());
|
||||||
Announcer announcer = DungeonsXL.getAnnouncers().getByGUI(gui);
|
Announcer announcer = DungeonsXL.getInstance().getAnnouncers().getByGUI(gui);
|
||||||
|
|
||||||
if (announcer != null) {
|
if (announcer != null) {
|
||||||
announcer.clickGroupButton(player, button);
|
announcer.clickGroupButton(player, button);
|
||||||
}
|
}
|
@ -71,7 +71,7 @@ public class AnnouncerStartGameTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (game == null) {
|
if (game == null) {
|
||||||
game = new Game(dGroup, DungeonsXL.getDWorlds().getResourceByName(announcer.getMapName()));
|
game = new Game(dGroup, DungeonsXL.getInstance().getDWorlds().getResourceByName(announcer.getMapName()));
|
||||||
} else {
|
} else {
|
||||||
game.getDGroups().add(dGroup);
|
game.getDGroups().add(dGroup);
|
||||||
}
|
}
|
@ -32,7 +32,7 @@ public class AnnouncerTask extends BukkitRunnable {
|
|||||||
private List<Announcer> announcers;
|
private List<Announcer> announcers;
|
||||||
private int index;
|
private int index;
|
||||||
|
|
||||||
public AnnouncerTask(Announcers announcers) {
|
public AnnouncerTask(AnnouncerCache announcers) {
|
||||||
this.announcers = announcers.getAnnouncers();
|
this.announcers = announcers.getAnnouncers();
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ public class AnnouncerTask extends BukkitRunnable {
|
|||||||
Announcer announcer = announcers.get(index);
|
Announcer announcer = announcers.get(index);
|
||||||
List<String> worlds = announcer.getWorlds();
|
List<String> worlds = announcer.getWorlds();
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
DGlobalPlayer dPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
if (!(dPlayer instanceof DInstancePlayer) && dPlayer.isAnnouncerEnabled()) {
|
if (!(dPlayer instanceof DInstancePlayer) && dPlayer.isAnnouncerEnabled()) {
|
||||||
if (worlds.isEmpty() || worlds.contains(player.getWorld().getName())) {
|
if (worlds.isEmpty() || worlds.contains(player.getWorld().getName())) {
|
||||||
announcer.send(player);
|
announcer.send(player);
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -28,13 +28,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class BreakCommand extends BRCommand {
|
public class BreakCommand extends DRECommand {
|
||||||
|
|
||||||
public BreakCommand() {
|
public BreakCommand() {
|
||||||
setCommand("break");
|
setCommand("break");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_BREAK.getMessage());
|
setHelp(DMessage.HELP_CMD_BREAK.getMessage());
|
||||||
setPermission(DPermissions.BREAK.getNode());
|
setPermission(DPermissions.BREAK.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -42,15 +42,15 @@ public class BreakCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dGlobalPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dGlobalPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
if (dGlobalPlayer.isInBreakMode()) {
|
if (dGlobalPlayer.isInBreakMode()) {
|
||||||
dGlobalPlayer.setInBreakMode(false);
|
dGlobalPlayer.setInBreakMode(false);
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_BREAK_PROTECTED_MODE.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_BREAK_PROTECTED_MODE.getMessage());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dGlobalPlayer.setInBreakMode(true);
|
dGlobalPlayer.setInBreakMode(true);
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_BREAK_BREAK_MODE.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_BREAK_BREAK_MODE.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
@ -29,13 +29,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class ChatCommand extends BRCommand {
|
public class ChatCommand extends DRECommand {
|
||||||
|
|
||||||
public ChatCommand() {
|
public ChatCommand() {
|
||||||
setCommand("chat");
|
setCommand("chat");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_CHAT.getMessage());
|
setHelp(DMessage.HELP_CMD_CHAT.getMessage());
|
||||||
setPermission(DPermissions.CHAT.getNode());
|
setPermission(DPermissions.CHAT.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -43,15 +43,15 @@ public class ChatCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
if (DGroup.getByPlayer(player) == null) {
|
if (DGroup.getByPlayer(player) == null) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dPlayer.setInGroupChat(!dPlayer.isInGroupChat());
|
dPlayer.setInGroupChat(!dPlayer.isInGroupChat());
|
||||||
MessageUtil.sendMessage(player, (dPlayer.isInGroupChat() ? DMessages.CMD_CHAT_DUNGEON_CHAT : DMessages.CMD_CHAT_NORMAL_CHAT).getMessage());
|
MessageUtil.sendMessage(player, (dPlayer.isInGroupChat() ? DMessage.CMD_CHAT_DUNGEON_CHAT : DMessage.CMD_CHAT_NORMAL_CHAT).getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -28,13 +28,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class ChatSpyCommand extends BRCommand {
|
public class ChatSpyCommand extends DRECommand {
|
||||||
|
|
||||||
public ChatSpyCommand() {
|
public ChatSpyCommand() {
|
||||||
setCommand("chatSpy");
|
setCommand("chatSpy");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_CHATSPY.getMessage());
|
setHelp(DMessage.HELP_CMD_CHATSPY.getMessage());
|
||||||
setPermission(DPermissions.CHAT_SPY.getNode());
|
setPermission(DPermissions.CHAT_SPY.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -42,10 +42,10 @@ public class ChatSpyCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
dPlayer.setInChatSpyMode(!dPlayer.isInChatSpyMode());
|
dPlayer.setInChatSpyMode(!dPlayer.isInChatSpyMode());
|
||||||
MessageUtil.sendMessage(player, (dPlayer.isInChatSpyMode() ? DMessages.CMD_CHATSPY_START : DMessages.CMD_CHATSPY_STOPPED).getMessage());
|
MessageUtil.sendMessage(player, (dPlayer.isInChatSpyMode() ? DMessage.CMD_CHATSPY_START : DMessage.CMD_CHATSPY_STOPPED).getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
@ -33,7 +33,7 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class CreateCommand extends BRCommand {
|
public class CreateCommand extends DRECommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class CreateCommand extends BRCommand {
|
|||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setCommand("create");
|
setCommand("create");
|
||||||
setHelp(DMessages.HELP_CMD_CREATE.getMessage());
|
setHelp(DMessage.HELP_CMD_CREATE.getMessage());
|
||||||
setPermission(DPermissions.CREATE.getNode());
|
setPermission(DPermissions.CREATE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -52,49 +52,49 @@ public class CreateCommand extends BRCommand {
|
|||||||
String name = args[1];
|
String name = args[1];
|
||||||
|
|
||||||
if (new File(DungeonsXL.MAPS, name).exists()) {
|
if (new File(DungeonsXL.MAPS, name).exists()) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NAME_IN_USE.getMessage(name));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NAME_IN_USE.getMessage(name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.length() > 15) {
|
if (name.length() > 15) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NAME_TO_LONG.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NAME_TO_LONG.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender instanceof ConsoleCommandSender) {
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
// Msg create
|
// Msg create
|
||||||
MessageUtil.log(plugin, DMessages.LOG_NEW_MAP.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_NEW_MAP.getMessage());
|
||||||
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_GENERATE_NEW_WORLD.getMessage());
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
DResourceWorld resource = new DResourceWorld(DungeonsXL.getDWorlds(), name);
|
DResourceWorld resource = new DResourceWorld(DungeonsXL.getInstance().getDWorlds(), name);
|
||||||
DungeonsXL.getDWorlds().addResource(resource);
|
DungeonsXL.getInstance().getDWorlds().addResource(resource);
|
||||||
DEditWorld editWorld = resource.generate();
|
DEditWorld editWorld = resource.generate();
|
||||||
editWorld.save();
|
editWorld.save();
|
||||||
editWorld.delete();
|
editWorld.delete();
|
||||||
|
|
||||||
// MSG Done
|
// MSG Done
|
||||||
MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
||||||
|
|
||||||
} else if (sender instanceof Player) {
|
} else if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (DGamePlayer.getByPlayer(player) != null) {
|
if (DGamePlayer.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Msg create
|
// Msg create
|
||||||
MessageUtil.log(plugin, DMessages.LOG_NEW_MAP.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_NEW_MAP.getMessage());
|
||||||
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_GENERATE_NEW_WORLD.getMessage());
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
DResourceWorld resource = new DResourceWorld(DungeonsXL.getDWorlds(), name);
|
DResourceWorld resource = new DResourceWorld(DungeonsXL.getInstance().getDWorlds(), name);
|
||||||
DungeonsXL.getDWorlds().addResource(resource);
|
DungeonsXL.getInstance().getDWorlds().addResource(resource);
|
||||||
DEditWorld editWorld = resource.generate();
|
DEditWorld editWorld = resource.generate();
|
||||||
|
|
||||||
// MSG Done
|
// MSG Done
|
||||||
MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
||||||
|
|
||||||
// Tp Player
|
// Tp Player
|
||||||
DEditPlayer.create(player, editWorld);
|
DEditPlayer.create(player, editWorld);
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommands;
|
import io.github.dre2n.commons.command.DRECommandCache;
|
||||||
import io.github.dre2n.commons.javaplugin.BRPlugin;
|
import io.github.dre2n.commons.javaplugin.DREPlugin;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +25,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class DCommands extends BRCommands {
|
public class DCommandCache extends DRECommandCache {
|
||||||
|
|
||||||
public static BreakCommand BREAK = new BreakCommand();
|
public static BreakCommand BREAK = new BreakCommand();
|
||||||
public static ChatCommand CHAT = new ChatCommand();
|
public static ChatCommand CHAT = new ChatCommand();
|
||||||
@ -58,7 +58,7 @@ public class DCommands extends BRCommands {
|
|||||||
public static TestCommand TEST = new TestCommand();
|
public static TestCommand TEST = new TestCommand();
|
||||||
public static UninviteCommand UNINVITE = new UninviteCommand();
|
public static UninviteCommand UNINVITE = new UninviteCommand();
|
||||||
|
|
||||||
public DCommands(BRPlugin plugin) {
|
public DCommandCache(DREPlugin plugin) {
|
||||||
super("dungeonsxl", plugin,
|
super("dungeonsxl", plugin,
|
||||||
BREAK,
|
BREAK,
|
||||||
CREATE,
|
CREATE,
|
||||||
@ -90,7 +90,7 @@ public class DCommands extends BRCommands {
|
|||||||
UNINVITE,
|
UNINVITE,
|
||||||
new DeletePortalCommand()
|
new DeletePortalCommand()
|
||||||
);
|
);
|
||||||
if (DungeonsXL.getMainConfig().isChatEnabled()) {
|
if (DungeonsXL.getInstance().getMainConfig().isChatEnabled()) {
|
||||||
addCommand(CHAT);
|
addCommand(CHAT);
|
||||||
addCommand(CHAT_SPY);
|
addCommand(CHAT_SPY);
|
||||||
}
|
}
|
@ -16,33 +16,32 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
||||||
import io.github.dre2n.commons.util.FileUtil;
|
import io.github.dre2n.commons.misc.FileUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
import io.github.dre2n.dungeonsxl.world.DWorldCache;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class DeleteCommand extends BRCommand {
|
public class DeleteCommand extends DRECommand {
|
||||||
|
|
||||||
public DeleteCommand() {
|
public DeleteCommand() {
|
||||||
setCommand("delete");
|
setCommand("delete");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessages.HELP_CMD_DELETE.getMessage());
|
setHelp(DMessage.HELP_CMD_DELETE.getMessage());
|
||||||
setPermission(DPermissions.DELETE.getNode());
|
setPermission(DPermissions.DELETE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -50,24 +49,24 @@ public class DeleteCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
DWorlds dWorlds = DungeonsXL.getDWorlds();
|
DWorldCache dWorlds = DungeonsXL.getInstance().getDWorlds();
|
||||||
|
|
||||||
DResourceWorld resource = dWorlds.getResourceByName(args[1]);
|
DResourceWorld resource = dWorlds.getResourceByName(args[1]);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_MAP.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_MAP.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 2 && CompatibilityHandler.getInstance().isSpigot() && sender instanceof Player) {
|
if (args.length == 2 && CompatibilityHandler.getInstance().isSpigot() && sender instanceof Player) {
|
||||||
ClickEvent onClickConfirm = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl delete " + args[1] + " true");
|
ClickEvent onClickConfirm = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl delete " + args[1] + " true");
|
||||||
TextComponent confirm = new TextComponent(DMessages.MISC_YES.getMessage());
|
TextComponent confirm = new TextComponent(DMessage.MISC_YES.getMessage());
|
||||||
confirm.setClickEvent(onClickConfirm);
|
confirm.setClickEvent(onClickConfirm);
|
||||||
|
|
||||||
ClickEvent onClickDeny = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl delete " + args[1] + " false");
|
ClickEvent onClickDeny = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl delete " + args[1] + " false");
|
||||||
TextComponent deny = new TextComponent(DMessages.MISC_NO.getMessage());
|
TextComponent deny = new TextComponent(DMessage.MISC_NO.getMessage());
|
||||||
deny.setClickEvent(onClickDeny);
|
deny.setClickEvent(onClickDeny);
|
||||||
|
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_DELETE_BACKUPS.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_DELETE_BACKUPS.getMessage());
|
||||||
((Player) sender).spigot().sendMessage(confirm, new TextComponent(" "), deny);
|
((Player) sender).spigot().sendMessage(confirm, new TextComponent(" "), deny);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -89,7 +88,7 @@ public class DeleteCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_DELETE_SUCCESS.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.CMD_DELETE_SUCCESS.getMessage(args[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
|
|||||||
* @deprecated Use BreakCommand instead.
|
* @deprecated Use BreakCommand instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class DeletePortalCommand extends BRCommand {
|
public class DeletePortalCommand extends DRECommand {
|
||||||
|
|
||||||
public DeletePortalCommand() {
|
public DeletePortalCommand() {
|
||||||
setCommand("deleteportal");
|
setCommand("deleteportal");
|
||||||
@ -48,10 +48,10 @@ public class DeletePortalCommand extends BRCommand {
|
|||||||
|
|
||||||
if (dPortal != null) {
|
if (dPortal != null) {
|
||||||
dPortal.delete();
|
dPortal.delete();
|
||||||
MessageUtil.sendMessage(player, DMessages.PLAYER_PROTECTED_BLOCK_DELETED.getMessage());
|
MessageUtil.sendMessage(player, DMessage.PLAYER_PROTECTED_BLOCK_DELETED.getMessage());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NO_PROTECTED_BLOCK.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NO_PROTECTED_BLOCK.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
@ -27,22 +27,22 @@ import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
import io.github.dre2n.dungeonsxl.world.DWorldCache;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
|
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class EditCommand extends BRCommand {
|
public class EditCommand extends DRECommand {
|
||||||
|
|
||||||
DWorlds worlds = DungeonsXL.getDWorlds();
|
DWorldCache worlds = DungeonsXL.getInstance().getDWorlds();
|
||||||
|
|
||||||
public EditCommand() {
|
public EditCommand() {
|
||||||
setCommand("edit");
|
setCommand("edit");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_EDIT.getMessage());
|
setHelp(DMessage.HELP_CMD_EDIT.getMessage());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,32 +52,32 @@ public class EditCommand extends BRCommand {
|
|||||||
String mapName = args[1];
|
String mapName = args[1];
|
||||||
|
|
||||||
if (!worlds.exists(mapName)) {
|
if (!worlds.exists(mapName)) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(mapName));
|
MessageUtil.sendMessage(player, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(mapName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DResourceWorld resource = worlds.getResourceByName(mapName);
|
DResourceWorld resource = worlds.getResourceByName(mapName);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_MAP.getMessage(mapName));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_MAP.getMessage(mapName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resource.isInvitedPlayer(player) && !DPermissions.hasPermission(player, DPermissions.EDIT)) {
|
if (!resource.isInvitedPlayer(player) && !DPermissions.hasPermission(player, DPermissions.EDIT)) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NO_PERMISSIONS.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NO_PERMISSIONS.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEditWorld editWorld = resource.instantiateAsEditWorld();
|
DEditWorld editWorld = resource.instantiateAsEditWorld();
|
||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
DGlobalPlayer dPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
if (dPlayer instanceof DInstancePlayer) {
|
if (dPlayer instanceof DInstancePlayer) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup != null) {
|
if (dGroup != null) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_GROUP.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
@ -30,13 +30,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class EnterCommand extends BRCommand {
|
public class EnterCommand extends DRECommand {
|
||||||
|
|
||||||
public EnterCommand() {
|
public EnterCommand() {
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setCommand("enter");
|
setCommand("enter");
|
||||||
setHelp(DMessages.HELP_CMD_ENTER.getMessage());
|
setHelp(DMessage.HELP_CMD_ENTER.getMessage());
|
||||||
setPermission(DPermissions.ENTER.getNode());
|
setPermission(DPermissions.ENTER.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -57,18 +57,18 @@ public class EnterCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage(targetName));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_GROUP.getMessage(targetName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game game = Game.getByDGroup(target);
|
Game game = Game.getByDGroup(target);
|
||||||
if (game == null) {
|
if (game == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_GAME.getMessage(targetName));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_IN_GAME.getMessage(targetName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game.getByDGroup(joining) != null) {
|
if (Game.getByDGroup(joining) != null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_GAME.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_LEAVE_GAME.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ public class EnterCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (joining.getCaptain() != captain && !DPermissions.hasPermission(sender, DPermissions.BYPASS)) {
|
if (joining.getCaptain() != captain && !DPermissions.hasPermission(sender, DPermissions.BYPASS)) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_CAPTAIN.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_CAPTAIN.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
joining.setGameWorld(game.getWorld());
|
joining.setGameWorld(game.getWorld());
|
||||||
game.addDGroup(joining);
|
game.addDGroup(joining);
|
||||||
joining.sendMessage(DMessages.CMD_ENTER_SUCCESS.getMessage(joining.getName(), target.getName()));
|
joining.sendMessage(DMessage.CMD_ENTER_SUCCESS.getMessage(joining.getName(), target.getName()));
|
||||||
|
|
||||||
for (Player player : joining.getPlayers()) {
|
for (Player player : joining.getPlayers()) {
|
||||||
DGamePlayer.create(player, game.getWorld(), game.getType());
|
DGamePlayer.create(player, game.getWorld(), game.getType());
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
@ -30,13 +30,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Milan Albrecht, Daniel Saukel
|
* @author Milan Albrecht, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class EscapeCommand extends BRCommand {
|
public class EscapeCommand extends DRECommand {
|
||||||
|
|
||||||
public EscapeCommand() {
|
public EscapeCommand() {
|
||||||
setCommand("escape");
|
setCommand("escape");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_ESCAPE.getMessage());
|
setHelp(DMessage.HELP_CMD_ESCAPE.getMessage());
|
||||||
setPermission(DPermissions.ESCAPE.getNode());
|
setPermission(DPermissions.ESCAPE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ public class EscapeCommand extends BRCommand {
|
|||||||
DEditPlayer dPlayer = DEditPlayer.getByPlayer(player);
|
DEditPlayer dPlayer = DEditPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (DGamePlayer.getByPlayer(player) != null) {
|
if (DGamePlayer.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_DUNGEON.getMessage());
|
||||||
|
|
||||||
} else if (dPlayer != null) {
|
} else if (dPlayer != null) {
|
||||||
dPlayer.escape();
|
dPlayer.escape();
|
||||||
@ -65,10 +65,10 @@ public class EscapeCommand extends BRCommand {
|
|||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
if (dGroup != null) {
|
if (dGroup != null) {
|
||||||
dGroup.removePlayer(player);
|
dGroup.removePlayer(player);
|
||||||
MessageUtil.sendMessage(player, DMessages.CMD_LEAVE_SUCCESS.getMessage());
|
MessageUtil.sendMessage(player, DMessage.CMD_LEAVE_SUCCESS.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NOT_IN_DUNGEON.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
@ -29,13 +29,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class GameCommand extends BRCommand {
|
public class GameCommand extends DRECommand {
|
||||||
|
|
||||||
public GameCommand() {
|
public GameCommand() {
|
||||||
setCommand("game");
|
setCommand("game");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_GAME.getMessage());
|
setHelp(DMessage.HELP_CMD_GAME.getMessage());
|
||||||
setPermission(DPermissions.GAME.getNode());
|
setPermission(DPermissions.GAME.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -45,19 +45,19 @@ public class GameCommand extends BRCommand {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DGameWorld gameWorld = dGroup.getGameWorld();
|
DGameWorld gameWorld = dGroup.getGameWorld();
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_GAME.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_GAME.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game game = gameWorld.getGame();
|
Game game = gameWorld.getGame();
|
||||||
if (game == null) {
|
if (game == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_GAME.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_GAME.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupDisbandEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupDisbandEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
||||||
@ -33,13 +33,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class GroupCommand extends BRCommand {
|
public class GroupCommand extends DRECommand {
|
||||||
|
|
||||||
public GroupCommand() {
|
public GroupCommand() {
|
||||||
setCommand("group");
|
setCommand("group");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessages.HELP_CMD_GROUP.getMessage());
|
setHelp(DMessage.HELP_CMD_GROUP.getMessage());
|
||||||
setPermission(DPermissions.GROUP.getNode());
|
setPermission(DPermissions.GROUP.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -113,12 +113,12 @@ public class GroupCommand extends BRCommand {
|
|||||||
|
|
||||||
public void createGroup() {
|
public void createGroup() {
|
||||||
if (DGroup.getByPlayer(player) != null) {
|
if (DGroup.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_LEAVE_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DGroup.getByName(args[2]) != null) {
|
if (DGroup.getByName(args[2]) != null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NAME_IN_USE.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NAME_IN_USE.getMessage(args[2]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,18 +131,18 @@ public class GroupCommand extends BRCommand {
|
|||||||
dGroup = null;
|
dGroup = null;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.GROUP_CREATED.getMessage(sender.getName(), args[2]));
|
MessageUtil.sendMessage(sender, DMessage.GROUP_CREATED.getMessage(sender.getName(), args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disbandGroup(DGroup dGroup) {
|
public void disbandGroup(DGroup dGroup) {
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup.isPlaying()) {
|
if (dGroup.isPlaying()) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_LEAVE_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,14 +151,14 @@ public class GroupCommand extends BRCommand {
|
|||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
dGroup.delete();
|
dGroup.delete();
|
||||||
MessageUtil.sendMessage(sender, DMessages.GROUP_DISBANDED.getMessage(sender.getName(), dGroup.getName()));
|
MessageUtil.sendMessage(sender, DMessage.GROUP_DISBANDED.getMessage(sender.getName(), dGroup.getName()));
|
||||||
dGroup = null;
|
dGroup = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invitePlayer(DGroup dGroup) {
|
public void invitePlayer(DGroup dGroup) {
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,13 +168,13 @@ public class GroupCommand extends BRCommand {
|
|||||||
dGroup.addInvitedPlayer(toInvite, false);
|
dGroup.addInvitedPlayer(toInvite, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uninvitePlayer(DGroup dGroup) {
|
public void uninvitePlayer(DGroup dGroup) {
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,27 +187,27 @@ public class GroupCommand extends BRCommand {
|
|||||||
dGroup.removeInvitedPlayer(toUninvite, false);
|
dGroup.removeInvitedPlayer(toUninvite, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_GROUP.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_IN_GROUP.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void joinGroup(DGroup dGroup) {
|
public void joinGroup(DGroup dGroup) {
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_GROUP.getMessage(args[2]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DGroup.getByPlayer(player) != null) {
|
if (DGroup.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_LEAVE_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dGroup.getInvitedPlayers().contains(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
if (!dGroup.getInvitedPlayers().contains(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_INVITED.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_INVITED.getMessage(args[2]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ public class GroupCommand extends BRCommand {
|
|||||||
|
|
||||||
public void kickPlayer(DGroup dGroup) {
|
public void kickPlayer(DGroup dGroup) {
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Player toKick = Bukkit.getPlayer(args[2]);
|
Player toKick = Bukkit.getPlayer(args[2]);
|
||||||
@ -228,25 +228,25 @@ public class GroupCommand extends BRCommand {
|
|||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (dGroup.getPlayers().contains(toKick)) {
|
if (dGroup.getPlayers().contains(toKick)) {
|
||||||
dGroup.removePlayer(toKick);
|
dGroup.removePlayer(toKick);
|
||||||
MessageUtil.sendMessage(sender, DMessages.GROUP_KICKED_PLAYER.getMessage(sender.getName(), args[2], dGroup.getName()));
|
MessageUtil.sendMessage(sender, DMessage.GROUP_KICKED_PLAYER.getMessage(sender.getName(), args[2], dGroup.getName()));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_GROUP.getMessage(args[2], dGroup.getName()));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_IN_GROUP.getMessage(args[2], dGroup.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showGroup(DGroup dGroup) {
|
public void showGroup(DGroup dGroup) {
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_GROUP.getMessage(args[2]));
|
||||||
|
|
||||||
} else if (args.length == 2) {
|
} else if (args.length == 2) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -270,16 +270,16 @@ public class GroupCommand extends BRCommand {
|
|||||||
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 - " + DMessages.HELP_CMD_GROUP_CREATE.getMessage());
|
MessageUtil.sendMessage(sender, "&bcreate" + "&7 - " + DMessage.HELP_CMD_GROUP_CREATE.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&bdisband" + "&7 - " + DMessages.HELP_CMD_GROUP_DISBAND.getMessage());
|
MessageUtil.sendMessage(sender, "&bdisband" + "&7 - " + DMessage.HELP_CMD_GROUP_DISBAND.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&binvite" + "&7 - " + DMessages.HELP_CMD_GROUP_INVITE.getMessage());
|
MessageUtil.sendMessage(sender, "&binvite" + "&7 - " + DMessage.HELP_CMD_GROUP_INVITE.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&buninvite" + "&7 - " + DMessages.HELP_CMD_GROUP_UNINVITE.getMessage());
|
MessageUtil.sendMessage(sender, "&buninvite" + "&7 - " + DMessage.HELP_CMD_GROUP_UNINVITE.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&bjoin" + "&7 - " + DMessages.HELP_CMD_GROUP_JOIN.getMessage());
|
MessageUtil.sendMessage(sender, "&bjoin" + "&7 - " + DMessage.HELP_CMD_GROUP_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 - " + DMessages.HELP_CMD_GROUP_KICK.getMessage());
|
MessageUtil.sendMessage(sender, "&bkick" + "&7 - " + DMessage.HELP_CMD_GROUP_KICK.getMessage());
|
||||||
MessageUtil.sendMessage(sender, "&bshow" + "&7 - " + DMessages.HELP_CMD_GROUP_SHOW.getMessage());
|
MessageUtil.sendMessage(sender, "&bshow" + "&7 - " + DMessage.HELP_CMD_GROUP_SHOW.getMessage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.misc.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -29,7 +29,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class HelpCommand extends BRCommand {
|
public class HelpCommand extends DRECommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class HelpCommand extends BRCommand {
|
|||||||
setCommand("help");
|
setCommand("help");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_HELP.getMessage());
|
setHelp(DMessage.HELP_CMD_HELP.getMessage());
|
||||||
setPermission(DPermissions.HELP.getNode());
|
setPermission(DPermissions.HELP.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -45,8 +45,8 @@ public class HelpCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Set<BRCommand> dCommandList = plugin.getCommands().getCommands();
|
Set<DRECommand> dCommandList = plugin.getCommandCache().getCommands();
|
||||||
ArrayList<BRCommand> toSend = new ArrayList<>();
|
ArrayList<DRECommand> toSend = new ArrayList<>();
|
||||||
|
|
||||||
int page = 1;
|
int page = 1;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
@ -55,7 +55,7 @@ public class HelpCommand extends BRCommand {
|
|||||||
int send = 0;
|
int send = 0;
|
||||||
int max = 0;
|
int max = 0;
|
||||||
int min = 0;
|
int min = 0;
|
||||||
for (BRCommand dCommand : dCommandList) {
|
for (DRECommand dCommand : dCommandList) {
|
||||||
send++;
|
send++;
|
||||||
if (send >= page * 5 - 4 && send <= page * 5) {
|
if (send >= page * 5 - 4 && send <= page * 5) {
|
||||||
min = page * 5 - 4;
|
min = page * 5 - 4;
|
||||||
@ -67,7 +67,7 @@ public class HelpCommand extends BRCommand {
|
|||||||
MessageUtil.sendPluginTag(sender, plugin);
|
MessageUtil.sendPluginTag(sender, plugin);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + min + "-" + max + " &4/&6 " + send + " &4|&6 " + page + " &4&l]");
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + min + "-" + max + " &4/&6 " + send + " &4|&6 " + page + " &4&l]");
|
||||||
|
|
||||||
for (BRCommand dCommand : toSend) {
|
for (DRECommand dCommand : toSend) {
|
||||||
MessageUtil.sendMessage(sender, "&b" + dCommand.getCommand() + "&7 - " + dCommand.getHelp());
|
MessageUtil.sendMessage(sender, "&b" + dCommand.getCommand() + "&7 - " + dCommand.getHelp());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.FileUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.misc.FileUtil;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -32,7 +32,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class ImportCommand extends BRCommand {
|
public class ImportCommand extends DRECommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class ImportCommand extends BRCommand {
|
|||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setCommand("import");
|
setCommand("import");
|
||||||
setHelp(DMessages.HELP_CMD_IMPORT.getMessage());
|
setHelp(DMessage.HELP_CMD_IMPORT.getMessage());
|
||||||
setPermission(DPermissions.IMPORT.getNode());
|
setPermission(DPermissions.IMPORT.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -52,12 +52,12 @@ public class ImportCommand extends BRCommand {
|
|||||||
final File source = new File(Bukkit.getWorldContainer(), args[1]);
|
final File source = new File(Bukkit.getWorldContainer(), args[1]);
|
||||||
|
|
||||||
if (!source.exists()) {
|
if (!source.exists()) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_MAP.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_MAP.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.exists()) {
|
if (target.exists()) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NAME_IN_USE.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NAME_IN_USE.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,10 +66,10 @@ public class ImportCommand extends BRCommand {
|
|||||||
world.save();
|
world.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtil.log(plugin, DMessages.LOG_NEW_MAP.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_NEW_MAP.getMessage());
|
||||||
MessageUtil.log(plugin, DMessages.LOG_IMPORT_WORLD.getMessage());
|
MessageUtil.log(plugin, DMessage.LOG_IMPORT_WORLD.getMessage());
|
||||||
|
|
||||||
if (!DungeonsXL.getMainConfig().areTweaksEnabled()) {
|
if (!DungeonsXL.getInstance().getMainConfig().areTweaksEnabled()) {
|
||||||
FileUtil.copyDirectory(source, target, new String[]{"playerdata", "stats"});
|
FileUtil.copyDirectory(source, target, new String[]{"playerdata", "stats"});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -81,8 +81,8 @@ public class ImportCommand extends BRCommand {
|
|||||||
}.runTaskAsynchronously(plugin);
|
}.runTaskAsynchronously(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
DungeonsXL.getDWorlds().addResource(new DResourceWorld(DungeonsXL.getDWorlds(), args[1]));
|
DungeonsXL.getInstance().getDWorlds().addResource(new DResourceWorld(DungeonsXL.getInstance().getDWorlds(), args[1]));
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_IMPORT_SUCCESS.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.CMD_IMPORT_SUCCESS.getMessage(args[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -29,13 +29,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class InviteCommand extends BRCommand {
|
public class InviteCommand extends DRECommand {
|
||||||
|
|
||||||
public InviteCommand() {
|
public InviteCommand() {
|
||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setCommand("invite");
|
setCommand("invite");
|
||||||
setHelp(DMessages.HELP_CMD_INVITE.getMessage());
|
setHelp(DMessage.HELP_CMD_INVITE.getMessage());
|
||||||
setPermission(DPermissions.INVITE.getNode());
|
setPermission(DPermissions.INVITE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -43,20 +43,20 @@ public class InviteCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
DResourceWorld resource = DungeonsXL.getDWorlds().getResourceByName(args[2]);
|
DResourceWorld resource = DungeonsXL.getInstance().getDWorlds().getResourceByName(args[2]);
|
||||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
||||||
|
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
resource.addInvitedPlayer(player);
|
resource.addInvitedPlayer(player);
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_INVITE_SUCCESS.getMessage(args[1], args[2]));
|
MessageUtil.sendMessage(sender, DMessage.CMD_INVITE_SUCCESS.getMessage(args[1], args[2]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.announcer.Announcer;
|
import io.github.dre2n.dungeonsxl.announcer.Announcer;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
@ -30,26 +30,26 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class JoinCommand extends BRCommand {
|
public class JoinCommand extends DRECommand {
|
||||||
|
|
||||||
public JoinCommand() {
|
public JoinCommand() {
|
||||||
setCommand("join");
|
setCommand("join");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_JOIN.getMessage());
|
setHelp(DMessage.HELP_CMD_JOIN.getMessage());
|
||||||
setPermission(DPermissions.JOIN.getNode());
|
setPermission(DPermissions.JOIN.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
DGlobalPlayer player = DungeonsXL.getDPlayers().getByPlayer((Player) sender);
|
DGlobalPlayer player = DungeonsXL.getInstance().getDPlayers().getByPlayer((Player) sender);
|
||||||
if (player instanceof DInstancePlayer) {
|
if (player instanceof DInstancePlayer) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_GAME.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_LEAVE_GAME.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Announcer announcer = DungeonsXL.getAnnouncers().getByName(args[1]);
|
Announcer announcer = DungeonsXL.getInstance().getAnnouncers().getByName(args[1]);
|
||||||
if (announcer != null) {
|
if (announcer != null) {
|
||||||
announcer.showGUI((Player) sender);
|
announcer.showGUI((Player) sender);
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import static io.github.dre2n.dungeonsxl.command.DCommands.LEAVE;
|
import static io.github.dre2n.dungeonsxl.command.DCommandCache.LEAVE;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -28,13 +28,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class KickCommand extends BRCommand {
|
public class KickCommand extends DRECommand {
|
||||||
|
|
||||||
public KickCommand() {
|
public KickCommand() {
|
||||||
setCommand("kick");
|
setCommand("kick");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_KICK.getMessage());
|
setHelp(DMessage.HELP_CMD_KICK.getMessage());
|
||||||
setPermission(DPermissions.KICK.getNode());
|
setPermission(DPermissions.KICK.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -46,10 +46,10 @@ public class KickCommand extends BRCommand {
|
|||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
LEAVE.onExecute(new String[]{LEAVE.getCommand()}, player);
|
LEAVE.onExecute(new String[]{LEAVE.getCommand()}, player);
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_KICK_SUCCESS.getMessage(player.getName()));
|
MessageUtil.sendMessage(sender, DMessage.CMD_KICK_SUCCESS.getMessage(player.getName()));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerLeaveDGroupEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerLeaveDGroupEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.instance.game.DGamePlayerEscapeEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.instance.game.DGamePlayerEscapeEvent;
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
@ -36,13 +36,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class LeaveCommand extends BRCommand {
|
public class LeaveCommand extends DRECommand {
|
||||||
|
|
||||||
public LeaveCommand() {
|
public LeaveCommand() {
|
||||||
setCommand("leave");
|
setCommand("leave");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_LEAVE.getMessage());
|
setHelp(DMessage.HELP_CMD_LEAVE.getMessage());
|
||||||
setPermission(DPermissions.LEAVE.getNode());
|
setPermission(DPermissions.LEAVE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -50,18 +50,18 @@ public class LeaveCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
Game game = Game.getByPlayer(player);
|
Game game = Game.getByPlayer(player);
|
||||||
|
|
||||||
if (game != null && game.isTutorial()) {
|
if (game != null && game.isTutorial()) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NO_LEAVE_IN_TUTORIAL.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NO_LEAVE_IN_TUTORIAL.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
|
|
||||||
if (dGroup == null && !(dPlayer instanceof DEditPlayer)) {
|
if (dGroup == null && !(dPlayer instanceof DEditPlayer)) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public class LeaveCommand extends BRCommand {
|
|||||||
dGroup.removePlayer(player);
|
dGroup.removePlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtil.sendMessage(player, DMessages.CMD_LEAVE_SUCCESS.getMessage());
|
MessageUtil.sendMessage(player, DMessage.CMD_LEAVE_SUCCESS.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,18 +16,18 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.misc.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DungeonConfig;
|
import io.github.dre2n.dungeonsxl.dungeon.DungeonConfig;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
import io.github.dre2n.dungeonsxl.world.DWorldCache;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -36,16 +36,16 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class ListCommand extends BRCommand {
|
public class ListCommand extends DRECommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
DWorlds worlds = DungeonsXL.getDWorlds();
|
DWorldCache worlds = DungeonsXL.getInstance().getDWorlds();
|
||||||
|
|
||||||
public ListCommand() {
|
public ListCommand() {
|
||||||
setCommand("list");
|
setCommand("list");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(3);
|
setMaxArgs(3);
|
||||||
setHelp(DMessages.HELP_CMD_LIST.getMessage());
|
setHelp(DMessage.HELP_CMD_LIST.getMessage());
|
||||||
setPermission(DPermissions.LIST.getNode());
|
setPermission(DPermissions.LIST.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -54,12 +54,12 @@ public class ListCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
ArrayList<String> dungeonList = new ArrayList<>();
|
ArrayList<String> dungeonList = new ArrayList<>();
|
||||||
for (Dungeon dungeon : DungeonsXL.getDungeons().getDungeons()) {
|
for (Dungeon dungeon : DungeonsXL.getInstance().getDungeons().getDungeons()) {
|
||||||
dungeonList.add(dungeon.getName());
|
dungeonList.add(dungeon.getName());
|
||||||
}
|
}
|
||||||
ArrayList<String> mapList = new ArrayList<>();
|
ArrayList<String> mapList = new ArrayList<>();
|
||||||
for (File file : DungeonsXL.MAPS.listFiles()) {
|
for (File file : DungeonsXL.MAPS.listFiles()) {
|
||||||
if (!file.equals(DWorlds.RAW)) {
|
if (!file.equals(DWorldCache.RAW)) {
|
||||||
mapList.add(file.getName());
|
mapList.add(file.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public class ListCommand extends BRCommand {
|
|||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
if (args[1].equalsIgnoreCase("dungeons") || args[1].equalsIgnoreCase("d")) {
|
if (args[1].equalsIgnoreCase("dungeons") || args[1].equalsIgnoreCase("d")) {
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
Dungeon dungeon = DungeonsXL.getDungeons().getByName(args[2]);
|
Dungeon dungeon = DungeonsXL.getInstance().getDungeons().getByName(args[2]);
|
||||||
if (dungeon != null) {
|
if (dungeon != null) {
|
||||||
MessageUtil.sendPluginTag(sender, plugin);
|
MessageUtil.sendPluginTag(sender, plugin);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + dungeon.getName() + " &4&l]");
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + dungeon.getName() + " &4&l]");
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
@ -29,13 +29,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class LivesCommand extends BRCommand {
|
public class LivesCommand extends DRECommand {
|
||||||
|
|
||||||
public LivesCommand() {
|
public LivesCommand() {
|
||||||
setCommand("lives");
|
setCommand("lives");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_LIVES.getMessage());
|
setHelp(DMessage.HELP_CMD_LIVES.getMessage());
|
||||||
setPermission(DPermissions.LIVES.getNode());
|
setPermission(DPermissions.LIVES.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -54,24 +54,24 @@ public class LivesCommand extends BRCommand {
|
|||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_CONSOLE_COMMAND.getMessage(getCommand()));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_CONSOLE_COMMAND.getMessage(getCommand()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
|
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
|
||||||
if (dPlayer == null && args.length == 1) {
|
if (dPlayer == null && args.length == 1) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DGroup dGroup = dPlayer != null ? dPlayer.getDGroup() : DGroup.getByName(args[1]);
|
DGroup dGroup = dPlayer != null ? dPlayer.getDGroup() : DGroup.getByName(args[1]);
|
||||||
if (dPlayer != null) {
|
if (dPlayer != null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_LIVES_PLAYER.getMessage(dPlayer.getName(), String.valueOf(dPlayer.getLives() == -1 ? "UNLIMITED" : dPlayer.getLives())));
|
MessageUtil.sendMessage(sender, DMessage.CMD_LIVES_PLAYER.getMessage(dPlayer.getName(), String.valueOf(dPlayer.getLives() == -1 ? "UNLIMITED" : dPlayer.getLives())));
|
||||||
|
|
||||||
} else if (dGroup != null) {
|
} else if (dGroup != null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_LIVES_GROUP.getMessage(dGroup.getName(), String.valueOf(dGroup.getLives() == -1 ? "UNLIMITED" : dPlayer.getLives())));
|
MessageUtil.sendMessage(sender, DMessage.CMD_LIVES_GROUP.getMessage(dGroup.getName(), String.valueOf(dGroup.getLives() == -1 ? "UNLIMITED" : dPlayer.getLives())));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,13 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import static io.github.dre2n.commons.chat.FatLetter.*;
|
||||||
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
||||||
import io.github.dre2n.commons.compatibility.Internals;
|
import io.github.dre2n.commons.compatibility.Internals;
|
||||||
import static io.github.dre2n.commons.util.messageutil.FatLetters.*;
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -31,11 +31,11 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class MainCommand extends BRCommand {
|
public class MainCommand extends DRECommand {
|
||||||
|
|
||||||
public MainCommand() {
|
public MainCommand() {
|
||||||
setCommand("main");
|
setCommand("main");
|
||||||
setHelp(DMessages.HELP_CMD_MAIN.getMessage());
|
setHelp(DMessage.HELP_CMD_MAIN.getMessage());
|
||||||
setPermission(DPermissions.MAIN.getNode());
|
setPermission(DPermissions.MAIN.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -47,8 +47,8 @@ public class MainCommand extends BRCommand {
|
|||||||
|
|
||||||
int maps = DungeonsXL.MAPS.listFiles().length;
|
int maps = DungeonsXL.MAPS.listFiles().length;
|
||||||
int dungeons = DungeonsXL.DUNGEONS.listFiles().length;
|
int dungeons = DungeonsXL.DUNGEONS.listFiles().length;
|
||||||
int loaded = DungeonsXL.getDWorlds().getEditWorlds().size() + DungeonsXL.getDWorlds().getGameWorlds().size();
|
int loaded = DungeonsXL.getInstance().getDWorlds().getEditWorlds().size() + DungeonsXL.getInstance().getDWorlds().getGameWorlds().size();
|
||||||
int players = DungeonsXL.getDPlayers().getDGamePlayers().size();
|
int players = DungeonsXL.getInstance().getDPlayers().getDGamePlayers().size();
|
||||||
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
||||||
String vault = "";
|
String vault = "";
|
||||||
if (plugins.getPlugin("Vault") != null) {
|
if (plugins.getPlugin("Vault") != null) {
|
||||||
@ -64,10 +64,10 @@ public class MainCommand extends BRCommand {
|
|||||||
MessageUtil.sendCenteredMessage(sender, "&4" + D[2] + "&f" + X[2] + L[2]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + D[2] + "&f" + X[2] + L[2]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4" + D[3] + "&f" + X[3] + L[3]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + D[3] + "&f" + X[3] + L[3]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4" + D[4] + "&f" + X[4] + L[4]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + D[4] + "&f" + X[4] + L[4]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&b&l###### " + DMessages.CMD_MAIN_WELCOME.getMessage() + "&7 v" + DungeonsXL.getInstance().getDescription().getVersion() + " &b&l######");
|
MessageUtil.sendCenteredMessage(sender, "&b&l###### " + DMessage.CMD_MAIN_WELCOME.getMessage() + "&7 v" + DungeonsXL.getInstance().getDescription().getVersion() + " &b&l######");
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessages.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, DMessages.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, DMessages.CMD_MAIN_HELP.getMessage());
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_HELP.getMessage());
|
||||||
MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2017 Frank Baumann & contributors; lcsd. under GPLv3.");
|
MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2017 Frank Baumann & contributors; lcsd. under GPLv3.");
|
||||||
}
|
}
|
||||||
|
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.WorldConfig;
|
import io.github.dre2n.dungeonsxl.world.WorldConfig;
|
||||||
@ -29,13 +29,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class MsgCommand extends BRCommand {
|
public class MsgCommand extends DRECommand {
|
||||||
|
|
||||||
public MsgCommand() {
|
public MsgCommand() {
|
||||||
setMinArgs(-1);
|
setMinArgs(-1);
|
||||||
setMaxArgs(-1);
|
setMaxArgs(-1);
|
||||||
setCommand("msg");
|
setCommand("msg");
|
||||||
setHelp(DMessages.HELP_CMD_MSG.getMessage());
|
setHelp(DMessage.HELP_CMD_MSG.getMessage());
|
||||||
setPermission(DPermissions.MESSAGE.getNode());
|
setPermission(DPermissions.MESSAGE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ public class MsgCommand extends BRCommand {
|
|||||||
DEditWorld editWorld = DEditWorld.getByWorld(player.getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(player.getWorld());
|
||||||
|
|
||||||
if (editWorld == null) {
|
if (editWorld == null) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NOT_IN_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ public class MsgCommand extends BRCommand {
|
|||||||
MessageUtil.sendMessage(player, ChatColor.WHITE + msg);
|
MessageUtil.sendMessage(player, ChatColor.WHITE + msg);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_MSG_ID_NOT_EXIST.getMessage(String.valueOf(id)));
|
MessageUtil.sendMessage(player, DMessage.ERROR_MSG_ID_NOT_EXIST.getMessage(String.valueOf(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -86,22 +86,22 @@ public class MsgCommand extends BRCommand {
|
|||||||
msg = splitMsg[1];
|
msg = splitMsg[1];
|
||||||
String old = config.getMessage(id);
|
String old = config.getMessage(id);
|
||||||
if (old == null) {
|
if (old == null) {
|
||||||
MessageUtil.sendMessage(player, DMessages.CMD_MSG_ADDED.getMessage(String.valueOf(id)));
|
MessageUtil.sendMessage(player, DMessage.CMD_MSG_ADDED.getMessage(String.valueOf(id)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, DMessages.CMD_MSG_UPDATED.getMessage(String.valueOf(id)));
|
MessageUtil.sendMessage(player, DMessage.CMD_MSG_UPDATED.getMessage(String.valueOf(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
config.setMessage(id, msg);
|
config.setMessage(id, msg);
|
||||||
config.save();
|
config.save();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_MSG_FORMAT.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_MSG_FORMAT.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_MSG_NO_INT.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_MSG_NO_INT.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
@ -36,13 +36,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class PlayCommand extends BRCommand {
|
public class PlayCommand extends DRECommand {
|
||||||
|
|
||||||
public PlayCommand() {
|
public PlayCommand() {
|
||||||
setCommand("play");
|
setCommand("play");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_PLAY.getMessage());
|
setHelp(DMessage.HELP_CMD_PLAY.getMessage());
|
||||||
setPermission(DPermissions.PLAY.getNode());
|
setPermission(DPermissions.PLAY.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(false);
|
setConsoleCommand(false);
|
||||||
@ -51,38 +51,38 @@ public class PlayCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
if (dPlayer instanceof DInstancePlayer) {
|
if (dPlayer instanceof DInstancePlayer) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dungeon dungeon = DungeonsXL.getDungeons().getByName(args[1]);
|
Dungeon dungeon = DungeonsXL.getInstance().getDungeons().getByName(args[1]);
|
||||||
if (dungeon == null) {
|
if (dungeon == null) {
|
||||||
DResourceWorld resource = DungeonsXL.getDWorlds().getResourceByName(args[1]);
|
DResourceWorld resource = DungeonsXL.getInstance().getDWorlds().getResourceByName(args[1]);
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
dungeon = new Dungeon(resource);
|
dungeon = new Dungeon(resource);
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[1]));
|
MessageUtil.sendMessage(player, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
if (dGroup != null && dGroup.isPlaying()) {
|
if (dGroup != null && dGroup.isPlaying()) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_GROUP.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
} else if (dGroup == null) {
|
} else if (dGroup == null) {
|
||||||
dGroup = new DGroup(player, dungeon);
|
dGroup = new DGroup(player, dungeon);
|
||||||
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
DungeonsXL.getDGroups().remove(dGroup);
|
DungeonsXL.getInstance().getDGroups().remove(dGroup);
|
||||||
dGroup = null;
|
dGroup = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dGroup.getCaptain().equals(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
if (!dGroup.getCaptain().equals(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NOT_CAPTAIN.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NOT_CAPTAIN.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dGroup.setDungeon(dungeon);
|
dGroup.setDungeon(dungeon);
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||||
@ -32,13 +32,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class PortalCommand extends BRCommand {
|
public class PortalCommand extends DRECommand {
|
||||||
|
|
||||||
public PortalCommand() {
|
public PortalCommand() {
|
||||||
setCommand("portal");
|
setCommand("portal");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_PORTAL.getMessage());
|
setHelp(DMessage.HELP_CMD_PORTAL.getMessage());
|
||||||
setPermission(DPermissions.PORTAL.getNode());
|
setPermission(DPermissions.PORTAL.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -46,10 +46,10 @@ public class PortalCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dGlobalPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dGlobalPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
if (dGlobalPlayer instanceof DGamePlayer) {
|
if (dGlobalPlayer instanceof DGamePlayer) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,19 +66,19 @@ public class PortalCommand extends BRCommand {
|
|||||||
DPortal dPortal = dGlobalPlayer.getPortal();
|
DPortal dPortal = dGlobalPlayer.getPortal();
|
||||||
|
|
||||||
if (dPortal == null) {
|
if (dPortal == null) {
|
||||||
dPortal = new DPortal(DungeonsXL.getGlobalProtections().generateId(DPortal.class, player.getWorld()), player.getWorld(), material, false);
|
dPortal = new DPortal(DungeonsXL.getInstance().getGlobalProtections().generateId(DPortal.class, player.getWorld()), player.getWorld(), material, false);
|
||||||
dGlobalPlayer.setCreatingPortal(dPortal);
|
dGlobalPlayer.setCreatingPortal(dPortal);
|
||||||
dPortal.setWorld(player.getWorld());
|
dPortal.setWorld(player.getWorld());
|
||||||
dGlobalPlayer.setCachedItem(player.getItemInHand());
|
dGlobalPlayer.setCachedItem(player.getItemInHand());
|
||||||
player.getInventory().setItemInHand(new ItemStack(Material.WOOD_SWORD));
|
player.getInventory().setItemInHand(new ItemStack(Material.WOOD_SWORD));
|
||||||
MessageUtil.sendMessage(player, DMessages.PLAYER_PORTAL_INTRODUCTION.getMessage());
|
MessageUtil.sendMessage(player, DMessage.PLAYER_PORTAL_INTRODUCTION.getMessage());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dPortal.delete();
|
dPortal.delete();
|
||||||
dGlobalPlayer.setCreatingPortal(null);
|
dGlobalPlayer.setCreatingPortal(null);
|
||||||
player.setItemInHand(dGlobalPlayer.getCachedItem());
|
player.setItemInHand(dGlobalPlayer.getCachedItem());
|
||||||
dGlobalPlayer.setCachedItem(null);
|
dGlobalPlayer.setCachedItem(null);
|
||||||
MessageUtil.sendMessage(player, DMessages.PLAYER_PORTAL_ABORT.getMessage());
|
MessageUtil.sendMessage(player, DMessage.PLAYER_PORTAL_ABORT.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,13 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.DefaultFontInfo;
|
||||||
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
||||||
import io.github.dre2n.commons.compatibility.Internals;
|
import io.github.dre2n.commons.compatibility.Internals;
|
||||||
import io.github.dre2n.commons.util.messageutil.DefaultFontInfo;
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.event.DataReloadEvent;
|
import io.github.dre2n.dungeonsxl.event.DataReloadEvent;
|
||||||
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
@ -37,7 +37,7 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class ReloadCommand extends BRCommand {
|
public class ReloadCommand extends DRECommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class ReloadCommand extends BRCommand {
|
|||||||
setCommand("reload");
|
setCommand("reload");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_RELOAD.getMessage());
|
setHelp(DMessage.HELP_CMD_RELOAD.getMessage());
|
||||||
setPermission(DPermissions.RELOAD.getNode());
|
setPermission(DPermissions.RELOAD.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -53,11 +53,11 @@ public class ReloadCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
List<DInstancePlayer> dPlayers = DungeonsXL.getDPlayers().getDInstancePlayers();
|
List<DInstancePlayer> dPlayers = DungeonsXL.getInstance().getDPlayers().getDInstancePlayers();
|
||||||
if (!dPlayers.isEmpty() && args.length == 1 && CompatibilityHandler.getInstance().isSpigot() && sender instanceof Player) {
|
if (!dPlayers.isEmpty() && args.length == 1 && CompatibilityHandler.getInstance().isSpigot() && sender instanceof Player) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_RELOAD_PLAYERS.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.CMD_RELOAD_PLAYERS.getMessage());
|
||||||
ClickEvent onClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl reload -force");
|
ClickEvent onClick = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dungeonsxl reload -force");
|
||||||
String message = DefaultFontInfo.center(DMessages.MISC_OKAY.getMessage());
|
String message = DefaultFontInfo.center(DMessage.MISC_OKAY.getMessage());
|
||||||
TextComponent text = new TextComponent(message);
|
TextComponent text = new TextComponent(message);
|
||||||
text.setClickEvent(onClick);
|
text.setClickEvent(onClick);
|
||||||
((Player) sender).spigot().sendMessage(text);
|
((Player) sender).spigot().sendMessage(text);
|
||||||
@ -78,8 +78,8 @@ public class ReloadCommand extends BRCommand {
|
|||||||
|
|
||||||
int maps = DungeonsXL.MAPS.listFiles().length;
|
int maps = DungeonsXL.MAPS.listFiles().length;
|
||||||
int dungeons = DungeonsXL.DUNGEONS.listFiles().length;
|
int dungeons = DungeonsXL.DUNGEONS.listFiles().length;
|
||||||
int loaded = DungeonsXL.getDWorlds().getEditWorlds().size() + DungeonsXL.getDWorlds().getGameWorlds().size();
|
int loaded = DungeonsXL.getInstance().getDWorlds().getEditWorlds().size() + DungeonsXL.getInstance().getDWorlds().getGameWorlds().size();
|
||||||
int players = DungeonsXL.getDPlayers().getDGamePlayers().size();
|
int players = DungeonsXL.getInstance().getDPlayers().getDGamePlayers().size();
|
||||||
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
||||||
String vault = "";
|
String vault = "";
|
||||||
if (plugins.getPlugin("Vault") != null) {
|
if (plugins.getPlugin("Vault") != null) {
|
||||||
@ -95,9 +95,9 @@ public class ReloadCommand extends BRCommand {
|
|||||||
plugin.loadData();
|
plugin.loadData();
|
||||||
|
|
||||||
MessageUtil.sendPluginTag(sender, plugin);
|
MessageUtil.sendPluginTag(sender, plugin);
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessages.CMD_RELOAD_DONE.getMessage());
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_RELOAD_DONE.getMessage());
|
||||||
MessageUtil.sendCenteredMessage(sender, DMessages.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, DMessages.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, mythicMobs));
|
MessageUtil.sendCenteredMessage(sender, DMessage.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, mythicMobs));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DungeonConfig;
|
import io.github.dre2n.dungeonsxl.dungeon.DungeonConfig;
|
||||||
import io.github.dre2n.dungeonsxl.global.GameSign;
|
import io.github.dre2n.dungeonsxl.global.GameSign;
|
||||||
@ -36,13 +36,13 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class RenameCommand extends BRCommand {
|
public class RenameCommand extends DRECommand {
|
||||||
|
|
||||||
public RenameCommand() {
|
public RenameCommand() {
|
||||||
setCommand("rename");
|
setCommand("rename");
|
||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessages.HELP_CMD_RENAME.getMessage());
|
setHelp(DMessage.HELP_CMD_RENAME.getMessage());
|
||||||
setPermission(DPermissions.RENAME.getNode());
|
setPermission(DPermissions.RENAME.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -50,9 +50,9 @@ public class RenameCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
DResourceWorld resource = DungeonsXL.getDWorlds().getResourceByName(args[1]);
|
DResourceWorld resource = DungeonsXL.getInstance().getDWorlds().getResourceByName(args[1]);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_MAP.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_MAP.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class RenameCommand extends BRCommand {
|
|||||||
resource.getFolder().renameTo(new File(DungeonsXL.MAPS, args[2]));
|
resource.getFolder().renameTo(new File(DungeonsXL.MAPS, args[2]));
|
||||||
resource.getSignData().updateFile(resource);
|
resource.getSignData().updateFile(resource);
|
||||||
|
|
||||||
for (Dungeon dungeon : DungeonsXL.getDungeons().getDungeons()) {
|
for (Dungeon dungeon : DungeonsXL.getInstance().getDungeons().getDungeons()) {
|
||||||
DungeonConfig dConfig = dungeon.getConfig();
|
DungeonConfig dConfig = dungeon.getConfig();
|
||||||
FileConfiguration config = dConfig.getConfig();
|
FileConfiguration config = dConfig.getConfig();
|
||||||
File file = dConfig.getFile();
|
File file = dConfig.getFile();
|
||||||
@ -90,7 +90,7 @@ public class RenameCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for (GlobalProtection protection : DungeonsXL.getGlobalProtections().getProtections()) {
|
for (GlobalProtection protection : DungeonsXL.getInstance().getGlobalProtections().getProtections()) {
|
||||||
if (protection instanceof GroupSign) {
|
if (protection instanceof GroupSign) {
|
||||||
Dungeon dungeon = ((GroupSign) protection).getDungeon();
|
Dungeon dungeon = ((GroupSign) protection).getDungeon();
|
||||||
if (dungeon.getName().equals(args[1])) {
|
if (dungeon.getName().equals(args[1])) {
|
||||||
@ -108,10 +108,10 @@ public class RenameCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
DungeonsXL.getGlobalProtections().saveAll();
|
DungeonsXL.getInstance().getGlobalProtections().saveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_RENAME_SUCCESS.getMessage(args[1], args[2]));
|
MessageUtil.sendMessage(sender, DMessage.CMD_RENAME_SUCCESS.getMessage(args[1], args[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,25 +16,24 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.inventivetalent.rpapi.ResourcePackAPI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class ResourcePackCommand extends BRCommand {
|
public class ResourcePackCommand extends DRECommand {
|
||||||
|
|
||||||
public ResourcePackCommand() {
|
public ResourcePackCommand() {
|
||||||
setCommand("resourcepack");
|
setCommand("resourcepack");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(DMessages.HELP_CMD_RESOURCE_PACK.getMessage());
|
setHelp(DMessage.HELP_CMD_RESOURCE_PACK.getMessage());
|
||||||
setPermission(DPermissions.RESOURCE_PACK.getNode());
|
setPermission(DPermissions.RESOURCE_PACK.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -45,17 +44,17 @@ public class ResourcePackCommand extends BRCommand {
|
|||||||
|
|
||||||
if (args[1].equalsIgnoreCase("reset")) {
|
if (args[1].equalsIgnoreCase("reset")) {
|
||||||
// Placeholder to reset to default
|
// Placeholder to reset to default
|
||||||
ResourcePackAPI.setResourcepack(player, "http://google.com");
|
player.setResourcePack("http://google.com");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = (String) DungeonsXL.getMainConfig().getResourcePacks().get(args[1]);
|
String url = (String) DungeonsXL.getInstance().getMainConfig().getResourcePacks().get(args[1]);
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_RESOURCE_PACK.getMessage(args[1]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_RESOURCE_PACK.getMessage(args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourcePackAPI.setResourcepack(player, url);
|
player.setResourcePack(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.reward.DLootInventory;
|
import io.github.dre2n.dungeonsxl.reward.DLootInventory;
|
||||||
@ -31,13 +31,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class RewardsCommand extends BRCommand {
|
public class RewardsCommand extends DRECommand {
|
||||||
|
|
||||||
public RewardsCommand() {
|
public RewardsCommand() {
|
||||||
setCommand("rewards");
|
setCommand("rewards");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_REWARDS.getMessage());
|
setHelp(DMessage.HELP_CMD_REWARDS.getMessage());
|
||||||
setPermission(DPermissions.REWARDS.getNode());
|
setPermission(DPermissions.REWARDS.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -45,10 +45,10 @@ public class RewardsCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dGlobalPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dGlobalPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
if (!dGlobalPlayer.hasRewardItemsLeft()) {
|
if (!dGlobalPlayer.hasRewardItemsLeft()) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NO_REWARDS_LEFT.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NO_REWARDS_LEFT.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.config.MainConfig;
|
import io.github.dre2n.dungeonsxl.config.MainConfig;
|
||||||
import io.github.dre2n.dungeonsxl.config.MainConfig.BackupMode;
|
import io.github.dre2n.dungeonsxl.config.MainConfig.BackupMode;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
@ -30,15 +30,15 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class SaveCommand extends BRCommand {
|
public class SaveCommand extends DRECommand {
|
||||||
|
|
||||||
MainConfig mainConfig = DungeonsXL.getMainConfig();
|
MainConfig mainConfig = DungeonsXL.getInstance().getMainConfig();
|
||||||
|
|
||||||
public SaveCommand() {
|
public SaveCommand() {
|
||||||
setCommand("save");
|
setCommand("save");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_SAVE.getMessage());
|
setHelp(DMessage.HELP_CMD_SAVE.getMessage());
|
||||||
setPermission(DPermissions.SAVE.getNode());
|
setPermission(DPermissions.SAVE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -54,10 +54,10 @@ public class SaveCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editWorld.save();
|
editWorld.save();
|
||||||
MessageUtil.sendMessage(player, DMessages.CMD_SAVE_SUCCESS.getMessage());
|
MessageUtil.sendMessage(player, DMessage.CMD_SAVE_SUCCESS.getMessage());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessage.ERROR_NOT_IN_DUNGEON.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -31,7 +31,7 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class StatusCommand extends BRCommand {
|
public class StatusCommand extends DRECommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
CompatibilityHandler compat = CompatibilityHandler.getInstance();
|
CompatibilityHandler compat = CompatibilityHandler.getInstance();
|
||||||
@ -44,7 +44,7 @@ public class StatusCommand extends BRCommand {
|
|||||||
setCommand("status");
|
setCommand("status");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_STATUS.getMessage());
|
setHelp(DMessage.HELP_CMD_STATUS.getMessage());
|
||||||
setPermission(DPermissions.STATUS.getNode());
|
setPermission(DPermissions.STATUS.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -117,7 +117,7 @@ public class StatusCommand extends BRCommand {
|
|||||||
|
|
||||||
String vaultVersionCorrect = getSymbol(vaultVersion.startsWith("1.5"));
|
String vaultVersionCorrect = getSymbol(vaultVersion.startsWith("1.5"));
|
||||||
String permissionPluginCorrect = getSymbol(plugin.getPermissionProvider() != null && plugin.getPermissionProvider().hasGroupSupport());
|
String permissionPluginCorrect = getSymbol(plugin.getPermissionProvider() != null && plugin.getPermissionProvider().hasGroupSupport());
|
||||||
String economyPluginCorrect = getSymbol(!DungeonsXL.getMainConfig().isEconomyEnabled() || plugin.getEconomyProvider() != null);
|
String economyPluginCorrect = getSymbol(!DungeonsXL.getInstance().getMainConfig().isEconomyEnabled() || plugin.getEconomyProvider() != null);
|
||||||
String commandsxlVersionCorrect = getSymbol(commandsxlVersion.startsWith("2.1"));
|
String commandsxlVersionCorrect = getSymbol(commandsxlVersion.startsWith("2.1"));
|
||||||
String itemsxlVersionCorrect = getSymbol(itemsxlVersion.startsWith("0.2"));
|
String itemsxlVersionCorrect = getSymbol(itemsxlVersion.startsWith("0.2"));
|
||||||
String citizensVersionCorrect = getSymbol(citizensVersion.startsWith("2.0"));
|
String citizensVersionCorrect = getSymbol(citizensVersion.startsWith("2.0"));
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.game.GameTypeDefault;
|
import io.github.dre2n.dungeonsxl.game.GameTypeDefault;
|
||||||
@ -36,13 +36,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class TestCommand extends BRCommand {
|
public class TestCommand extends DRECommand {
|
||||||
|
|
||||||
public TestCommand() {
|
public TestCommand() {
|
||||||
setCommand("test");
|
setCommand("test");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(DMessages.HELP_CMD_TEST.getMessage());
|
setHelp(DMessage.HELP_CMD_TEST.getMessage());
|
||||||
setPermission(DPermissions.TEST.getNode());
|
setPermission(DPermissions.TEST.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(false);
|
setConsoleCommand(false);
|
||||||
@ -51,29 +51,29 @@ public class TestCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DGlobalPlayer dPlayer = DungeonsXL.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = DungeonsXL.getInstance().getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
if (!(dPlayer instanceof DEditPlayer)) {
|
if (!(dPlayer instanceof DEditPlayer)) {
|
||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dGroup.getCaptain().equals(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
if (!dGroup.getCaptain().equals(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_CAPTAIN.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_CAPTAIN.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DGameWorld gameWorld = dGroup.getGameWorld();
|
DGameWorld gameWorld = dGroup.getGameWorld();
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NOT_IN_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game game = gameWorld.getGame();
|
Game game = gameWorld.getGame();
|
||||||
if (game != null && game.hasStarted()) {
|
if (game != null && game.hasStarted()) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
|
MessageUtil.sendMessage(sender, DMessage.ERROR_LEAVE_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.commons.command.BRCommand;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.command.DRECommand;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -29,13 +29,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class UninviteCommand extends BRCommand {
|
public class UninviteCommand extends DRECommand {
|
||||||
|
|
||||||
public UninviteCommand() {
|
public UninviteCommand() {
|
||||||
setCommand("uninvite");
|
setCommand("uninvite");
|
||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(DMessages.HELP_CMD_UNINVITE.getMessage());
|
setHelp(DMessage.HELP_CMD_UNINVITE.getMessage());
|
||||||
setPermission(DPermissions.UNINVITE.getNode());
|
setPermission(DPermissions.UNINVITE.getNode());
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -43,15 +43,15 @@ public class UninviteCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
DResourceWorld resource = DungeonsXL.getDWorlds().getResourceByName(args[2]);
|
DResourceWorld resource = DungeonsXL.getInstance().getDWorlds().getResourceByName(args[2]);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessage.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
||||||
if (resource.removeInvitedPlayer(player)) {
|
if (resource.removeInvitedPlayer(player)) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_UNINVITE_SUCCESS.getMessage(args[1], args[2]));
|
MessageUtil.sendMessage(sender, DMessage.CMD_UNINVITE_SUCCESS.getMessage(args[1], args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.config;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
import io.github.dre2n.commons.config.Messages;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.config.Message;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -29,7 +29,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public enum DMessages implements Messages {
|
public enum DMessage implements Message {
|
||||||
|
|
||||||
ANNOUNCER_CMD("Announcer_Cmd", "&4&l=> &6USE &4/DXL JOIN &v1 &6TO JOIN &4&l<="),
|
ANNOUNCER_CMD("Announcer_Cmd", "&4&l=> &6USE &4/DXL JOIN &v1 &6TO JOIN &4&l<="),
|
||||||
ANNOUNCER_CLICK("Announcer_Click", "&4&l=> &6CLICK HERE TO JOIN &4&l<="),
|
ANNOUNCER_CLICK("Announcer_Click", "&4&l=> &6CLICK HERE TO JOIN &4&l<="),
|
||||||
@ -228,7 +228,7 @@ public enum DMessages implements Messages {
|
|||||||
private String identifier;
|
private String identifier;
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
DMessages(String identifier, String message) {
|
DMessage(String identifier, String message) {
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ public enum DMessages implements Messages {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage(String... args) {
|
public String getMessage(String... args) {
|
||||||
return DungeonsXL.getMessageConfig().getMessage(this, args);
|
return DungeonsXL.getInstance().getMessageConfig().getMessage(this, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -267,8 +267,8 @@ public enum DMessages implements Messages {
|
|||||||
* @param identifer
|
* @param identifer
|
||||||
* the identifer to set
|
* the identifer to set
|
||||||
*/
|
*/
|
||||||
public static Messages getByIdentifier(String identifier) {
|
public static Message getByIdentifier(String identifier) {
|
||||||
for (Messages message : values()) {
|
for (Message message : values()) {
|
||||||
if (message.getIdentifier().equals(identifier)) {
|
if (message.getIdentifier().equals(identifier)) {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ public enum DMessages implements Messages {
|
|||||||
*/
|
*/
|
||||||
public static FileConfiguration toConfig() {
|
public static FileConfiguration toConfig() {
|
||||||
FileConfiguration config = new YamlConfiguration();
|
FileConfiguration config = new YamlConfiguration();
|
||||||
for (DMessages message : values()) {
|
for (DMessage message : values()) {
|
||||||
config.set(message.getIdentifier(), message.message);
|
config.set(message.getIdentifier(), message.message);
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.config;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
import io.github.dre2n.commons.config.BRConfig;
|
import io.github.dre2n.commons.config.DREConfig;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,7 +24,7 @@ import java.io.File;
|
|||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class GlobalData extends BRConfig {
|
public class GlobalData extends DREConfig {
|
||||||
|
|
||||||
public static final int CONFIG_VERSION = 2;
|
public static final int CONFIG_VERSION = 2;
|
||||||
|
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.config;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
||||||
import io.github.dre2n.commons.compatibility.Internals;
|
import io.github.dre2n.commons.compatibility.Internals;
|
||||||
import io.github.dre2n.commons.config.BRConfig;
|
import io.github.dre2n.commons.config.DREConfig;
|
||||||
import io.github.dre2n.commons.util.EnumUtil;
|
import io.github.dre2n.commons.misc.EnumUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.DColor;
|
import io.github.dre2n.dungeonsxl.util.DColor;
|
||||||
import static io.github.dre2n.dungeonsxl.util.DColor.*;
|
import static io.github.dre2n.dungeonsxl.util.DColor.*;
|
||||||
import io.github.dre2n.dungeonsxl.world.WorldConfig;
|
import io.github.dre2n.dungeonsxl.world.WorldConfig;
|
||||||
@ -38,7 +38,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
*
|
*
|
||||||
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
|
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class MainConfig extends BRConfig {
|
public class MainConfig extends DREConfig {
|
||||||
|
|
||||||
public enum BackupMode {
|
public enum BackupMode {
|
||||||
ON_DISABLE,
|
ON_DISABLE,
|
||||||
@ -660,7 +660,7 @@ public class MainConfig extends BRConfig {
|
|||||||
tweaksEnabled = config.getBoolean("tweaksEnabled");
|
tweaksEnabled = config.getBoolean("tweaksEnabled");
|
||||||
} else {
|
} else {
|
||||||
tweaksEnabled = false;
|
tweaksEnabled = false;
|
||||||
MessageUtil.log(DMessages.LOG_DISABLED_TWEAKS.getMessage());
|
MessageUtil.log(DMessage.LOG_DISABLED_TWEAKS.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +114,7 @@ public class Dungeon {
|
|||||||
* @return false if there are setup errors
|
* @return false if there are setup errors
|
||||||
*/
|
*/
|
||||||
public boolean isSetupCorrect() {
|
public boolean isSetupCorrect() {
|
||||||
for (DResourceWorld resource : DungeonsXL.getDWorlds().getResources()) {
|
for (DResourceWorld resource : DungeonsXL.getInstance().getDWorlds().getResources()) {
|
||||||
if (resource.getName().equals(name)) {
|
if (resource.getName().equals(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.dungeon;
|
package io.github.dre2n.dungeonsxl.dungeon;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.chat.MessageUtil;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -27,11 +27,11 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class Dungeons {
|
public class DungeonCache {
|
||||||
|
|
||||||
private List<Dungeon> dungeons = new ArrayList<>();
|
private List<Dungeon> dungeons = new ArrayList<>();
|
||||||
|
|
||||||
public Dungeons(File folder) {
|
public DungeonCache(File folder) {
|
||||||
if (!folder.exists()) {
|
if (!folder.exists()) {
|
||||||
folder.mkdir();
|
folder.mkdir();
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public class Dungeons {
|
|||||||
dungeons.add(dungeon);
|
dungeons.add(dungeon);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.log(DMessages.LOG_ERROR_DUNGEON_SETUP.getMessage(file.getName()));
|
MessageUtil.log(DMessage.LOG_ERROR_DUNGEON_SETUP.getMessage(file.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.dungeon;
|
package io.github.dre2n.dungeonsxl.dungeon;
|
||||||
|
|
||||||
import io.github.dre2n.commons.config.BRConfig;
|
import io.github.dre2n.commons.config.DREConfig;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
import io.github.dre2n.dungeonsxl.world.DWorldCache;
|
||||||
import io.github.dre2n.dungeonsxl.world.WorldConfig;
|
import io.github.dre2n.dungeonsxl.world.WorldConfig;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -30,9 +30,9 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class DungeonConfig extends BRConfig {
|
public class DungeonConfig extends DREConfig {
|
||||||
|
|
||||||
DWorlds worlds = DungeonsXL.getDWorlds();
|
DWorldCache worlds = DungeonsXL.getInstance().getDWorlds();
|
||||||
|
|
||||||
public static final int CONFIG_VERSION = 1;
|
public static final int CONFIG_VERSION = 1;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user