mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-01-24 09:01:52 +01:00
Added /dxl play command
This commit is contained in:
parent
9bdab01b10
commit
2b7cf84e89
@ -122,10 +122,10 @@ public class LanguageReader {
|
||||
defaults.put("Help_Cmd_DeletePortal", "/dxl deleteportal - Deletes the portal you are looking at");
|
||||
defaults.put("Help_Cmd_Reload", "/dxl reload - Reloads the plugin");
|
||||
defaults.put("Help_Cmd_Save", "/dxl save - Saves the current dungeon");
|
||||
defaults.put("Help_Cmd_Play", "/dxl play [dungeon]");
|
||||
defaults.put("Help_Cmd_Test", "/dxl test [dungeon] - Tests a dungeon");
|
||||
defaults.put("Help_Cmd_Lives", "/dxl lives <player> - Shows the lives a player has left");
|
||||
defaults.put("Help_Cmd_Uninvite", "/dxl uninvite <player> <dungeon> - Uninvite a player to edit a dungeon");
|
||||
defaults.put("Help_Cmd_Lives", "/dxl lives <player> - show the lives a player has left");
|
||||
|
||||
}
|
||||
|
||||
private void check() {
|
||||
|
59
src/com/dre/dungeonsxl/commands/CMDPlay.java
Normal file
59
src/com/dre/dungeonsxl/commands/CMDPlay.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.dre.dungeonsxl.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.dre.dungeonsxl.DGroup;
|
||||
import com.dre.dungeonsxl.DPlayer;
|
||||
import com.dre.dungeonsxl.EditWorld;
|
||||
import com.dre.dungeonsxl.game.GameWorld;
|
||||
|
||||
public class CMDPlay extends DCommand {
|
||||
|
||||
public CMDPlay() {
|
||||
this.command = "play";
|
||||
this.args = -1;
|
||||
this.help = p.language.get("Help_Cmd_Play");
|
||||
this.permissions = "dxl.play";
|
||||
this.isPlayerCommand = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecute(String[] args, CommandSender sender) {
|
||||
Player player = (Player) sender;
|
||||
DPlayer dplayer = DPlayer.get(player);
|
||||
String dungeonname;
|
||||
|
||||
if (dplayer == null) {
|
||||
if (args.length > 1) {
|
||||
dungeonname = args[1];
|
||||
|
||||
if (EditWorld.exist(dungeonname)) {
|
||||
if (DGroup.get(player) == null) {
|
||||
DGroup dgroup = new DGroup(player, dungeonname);
|
||||
if (dgroup != null) {
|
||||
if (dgroup.getGworld() == null) {
|
||||
dgroup.setGworld(GameWorld.load(DGroup.get(player).getDungeonname()));
|
||||
}
|
||||
if (dgroup.getGworld().locLobby == null) {
|
||||
new DPlayer(player, dgroup.getGworld().world, dgroup.getGworld().world.getSpawnLocation(), false);
|
||||
} else {
|
||||
new DPlayer(player, dgroup.getGworld().world, dgroup.getGworld().locLobby, false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p.msg(player, p.language.get("Error_LeaveGroup"));
|
||||
}
|
||||
} else {
|
||||
p.msg(player, p.language.get("Error_DungeonNotExist", dungeonname));
|
||||
}
|
||||
} else {
|
||||
this.displayHelp(player);
|
||||
}
|
||||
} else {
|
||||
p.msg(player, p.language.get("Error_LeaveDungeon"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -18,14 +18,15 @@ public class DCommandRoot {
|
||||
public CMDDeletePortal cmdDeletePortal = new CMDDeletePortal();
|
||||
public CMDChat cmdChat = new CMDChat();
|
||||
public CMDChatSpy cmdChatSpy = new CMDChatSpy();
|
||||
public CMDLives cmdLives = new CMDLives();
|
||||
public CMDList cmdList = new CMDList();
|
||||
public CMDUninvite cmdUninvite = new CMDUninvite();
|
||||
public CMDInvite cmdInvite = new CMDInvite();
|
||||
public CMDMsg cmdMsg = new CMDMsg();
|
||||
public CMDPlay cmdPlay = new CMDPlay();
|
||||
public CMDTest cmdTest = new CMDTest();
|
||||
public CMDHelp cmdHelp = new CMDHelp();
|
||||
public CMDReload cmdReload = new CMDReload();
|
||||
public CMDLives cmdLives = new CMDLives();
|
||||
|
||||
// Methods
|
||||
public DCommandRoot() {
|
||||
@ -41,13 +42,14 @@ public class DCommandRoot {
|
||||
this.commands.add(cmdDeletePortal);
|
||||
this.commands.add(cmdChat);
|
||||
this.commands.add(cmdChatSpy);
|
||||
this.commands.add(cmdLives);
|
||||
this.commands.add(cmdList);
|
||||
this.commands.add(cmdUninvite);
|
||||
this.commands.add(cmdInvite);
|
||||
this.commands.add(cmdMsg);
|
||||
this.commands.add(cmdPlay);
|
||||
this.commands.add(cmdTest);
|
||||
this.commands.add(cmdHelp);
|
||||
this.commands.add(cmdReload);
|
||||
this.commands.add(cmdLives);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user