mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-01-26 18:11:41 +01:00
Advanced groups
This commit is contained in:
parent
db96fb4014
commit
69e1230690
@ -24,7 +24,7 @@ public class ChatCommand extends DCommand {
|
|||||||
DPlayer dplayer = DPlayer.getByPlayer(player);
|
DPlayer dplayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (dplayer == null) {
|
if (dplayer == null) {
|
||||||
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_IN_GROUP));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_JOIN_GROUP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ public class DCommands {
|
|||||||
dCommands.add(new CreateCommand());
|
dCommands.add(new CreateCommand());
|
||||||
dCommands.add(new EditCommand());
|
dCommands.add(new EditCommand());
|
||||||
dCommands.add(new EscapeCommand());
|
dCommands.add(new EscapeCommand());
|
||||||
|
dCommands.add(new GroupCommand());
|
||||||
dCommands.add(new InviteCommand());
|
dCommands.add(new InviteCommand());
|
||||||
dCommands.add(new LeaveCommand());
|
dCommands.add(new LeaveCommand());
|
||||||
dCommands.add(new ListCommand());
|
dCommands.add(new ListCommand());
|
||||||
|
247
src/io/github/dre2n/dungeonsxl/command/GroupCommand.java
Normal file
247
src/io/github/dre2n/dungeonsxl/command/GroupCommand.java
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupDisbandEvent;
|
||||||
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class GroupCommand extends DCommand {
|
||||||
|
|
||||||
|
public GroupCommand() {
|
||||||
|
setCommand("group");
|
||||||
|
setMinArgs(0);
|
||||||
|
setMaxArgs(2);
|
||||||
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_GROUP));
|
||||||
|
setPermission("dxl.group");
|
||||||
|
setPlayerCommand(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommandSender sender;
|
||||||
|
private Player player;
|
||||||
|
private String[] args;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
|
this.sender = sender;
|
||||||
|
this.player = (Player) sender;
|
||||||
|
this.args = args;
|
||||||
|
|
||||||
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
|
|
||||||
|
if (args.length == 2) {
|
||||||
|
|
||||||
|
if (args[1].equalsIgnoreCase("disband")) {
|
||||||
|
disbandGroup(dGroup);
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("show")) {
|
||||||
|
showGroup(dGroup);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (args.length >= 3) {
|
||||||
|
|
||||||
|
if (args[1].equalsIgnoreCase("kick")) {
|
||||||
|
kickPlayer(dGroup);
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("invite")) {
|
||||||
|
invitePlayer(dGroup);
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("uninvite")) {
|
||||||
|
uninvitePlayer(dGroup);
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("help")) {
|
||||||
|
showHelp(args[2]);
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("create")) {
|
||||||
|
createGroup();
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("disband") && sender.hasPermission("dxl.group.admin")) {
|
||||||
|
disbandGroup(DGroup.getByName(args[2]));
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("join")) {
|
||||||
|
joinGroup(DGroup.getByName(args[2]));
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (args[1].equalsIgnoreCase("show") && sender.hasPermission("dxl.group.admin")) {
|
||||||
|
showGroup(DGroup.getByName(args[2]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showHelp("1");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createGroup() {
|
||||||
|
if (DGroup.getByPlayer(player) == null && DGroup.getByName(args[2]) == null) {
|
||||||
|
DGroup dGroup = new DGroup(args[2], player);
|
||||||
|
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
plugin.getDGroups().remove(dGroup);
|
||||||
|
dGroup = null;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.GROUP_CREATED, sender.getName(), args[2]));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disbandGroup(DGroup dGroup) {
|
||||||
|
if (dGroup != null) {
|
||||||
|
DGroupDisbandEvent event = new DGroupDisbandEvent(dGroup, player, DGroupDisbandEvent.Cause.COMMAND);
|
||||||
|
|
||||||
|
if ( !event.isCancelled()) {
|
||||||
|
plugin.getDGroups().remove(dGroup);
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.GROUP_DISBANDED, sender.getName(), dGroup.getName()));
|
||||||
|
dGroup = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_SUCH_GROUP));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void invitePlayer(DGroup dGroup) {
|
||||||
|
if (dGroup == null) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_JOIN_GROUP));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player toInvite = plugin.getServer().getPlayer(args[2]);
|
||||||
|
|
||||||
|
if (toInvite != null) {
|
||||||
|
dGroup.addInvitedPlayer(toInvite, false);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_SUCH_PLAYER, args[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uninvitePlayer(DGroup dGroup) {
|
||||||
|
if (dGroup == null) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_JOIN_GROUP));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dGroup.clearOfflineInvitedPlayers();
|
||||||
|
|
||||||
|
Player toUninvite = plugin.getServer().getPlayer(args[2]);
|
||||||
|
|
||||||
|
if (toUninvite != null) {
|
||||||
|
if (dGroup.getInvitedPlayers().contains(toUninvite)) {
|
||||||
|
dGroup.removeInvitedPlayer(toUninvite, false);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NOT_IN_GROUP, args[2]));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_SUCH_PLAYER, args[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void joinGroup(DGroup dGroup) {
|
||||||
|
if (dGroup == null) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_SUCH_GROUP, args[2]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DGroup anyDGroup : plugin.getDGroups()) {
|
||||||
|
if (anyDGroup.getPlayers().contains(player)) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !dGroup.getInvitedPlayers().contains(player) && !player.hasPermission("dxl.bypass")) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NOT_INVITED, args[2]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dGroup.addPlayer(player);
|
||||||
|
dGroup.removeInvitedPlayer(player, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void kickPlayer(DGroup dGroup) {
|
||||||
|
if (dGroup == null) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_JOIN_GROUP));
|
||||||
|
}
|
||||||
|
|
||||||
|
Player toKick = plugin.getServer().getPlayer(args[2]);
|
||||||
|
if (toKick != null) {
|
||||||
|
DPlayerKickEvent event = new DPlayerKickEvent(DPlayer.getByPlayer(toKick.getPlayer()), DPlayerKickEvent.Cause.COMMAND);
|
||||||
|
|
||||||
|
if ( !event.isCancelled()) {
|
||||||
|
if (dGroup.getPlayers().contains(toKick)) {
|
||||||
|
dGroup.removePlayer(toKick);
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.GROUP_KICKED_PLAYER, sender.getName(), args[2], dGroup.getName()));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NOT_IN_GROUP, args[2], dGroup.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_SUCH_PLAYER, args[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showGroup(DGroup dGroup) {
|
||||||
|
if (dGroup == null) {
|
||||||
|
if (args.length == 3) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_SUCH_GROUP, args[2]));
|
||||||
|
|
||||||
|
} else if (args.length == 2) {
|
||||||
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_JOIN_GROUP));
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + dGroup.getName() + " &4&l]");
|
||||||
|
MessageUtil.sendMessage(sender, "&bCaptain: &e" + dGroup.getCaptain().getName());
|
||||||
|
String players = "&e";
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
players += (player == dGroup.getPlayers().get(0) ? "" : "&b, &e") + player.getName();
|
||||||
|
}
|
||||||
|
MessageUtil.sendMessage(sender, "&bPlayers: &e" + players);
|
||||||
|
MessageUtil.sendMessage(sender, "&bDungeon: &e" + (dGroup.getDungeonName() == null ? "N/A" : dGroup.getDungeonName()));
|
||||||
|
MessageUtil.sendMessage(sender, "&bMap: &e" + (dGroup.getMapName() == null ? "N/A" : dGroup.getMapName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showHelp(String page) {
|
||||||
|
MessageUtil.sendPluginTag(sender, plugin);
|
||||||
|
switch (page) {
|
||||||
|
default:
|
||||||
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &61-5 &4/ &67 &4| &61 &4&l]");
|
||||||
|
MessageUtil.sendMessage(sender, "&bcreate" + "&7 - " + messageConfig.getMessage(Messages.HELP_CMD_GROUP_CREATE));
|
||||||
|
MessageUtil.sendMessage(sender, "&bdisband" + "&7 - " + messageConfig.getMessage(Messages.HELP_CMD_GROUP_DISBAND));
|
||||||
|
MessageUtil.sendMessage(sender, "&binvite" + "&7 - " + messageConfig.getMessage(Messages.HELP_CMD_GROUP_INVITE));
|
||||||
|
MessageUtil.sendMessage(sender, "&buninvite" + "&7 - " + messageConfig.getMessage(Messages.HELP_CMD_GROUP_UNINVITE));
|
||||||
|
MessageUtil.sendMessage(sender, "&bjoin" + "&7 - " + messageConfig.getMessage(Messages.HELP_CMD_GROUP_JOIN));
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &66-10 &4/ &67 &4| &62 &4&l]");
|
||||||
|
MessageUtil.sendMessage(sender, "&bkick" + "&7 - " + messageConfig.getMessage(Messages.HELP_CMD_GROUP_KICK));
|
||||||
|
MessageUtil.sendMessage(sender, "&bshow" + "&7 - " + messageConfig.getMessage(Messages.HELP_CMD_GROUP_SHOW));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
@ -29,9 +30,9 @@ public class PlayCommand extends DCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
DPlayer dplayer = DPlayer.getByPlayer(player);
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (dplayer != null) {
|
if (dPlayer != null) {
|
||||||
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -86,16 +87,43 @@ public class PlayCommand extends DCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DGroup.getByPlayer(player) != null) {
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DGroup dGroup = new DGroup(player, identifier, multiFloor);
|
if (dGroup != null) {
|
||||||
|
if ( !dGroup.getCaptain().equals(player) && !player.hasPermission("dxl.bypass")) {
|
||||||
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_CAPTAIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dGroup.getMapName() == null) {
|
||||||
|
if ( !multiFloor) {
|
||||||
|
dGroup.setMapName(identifier);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dGroup.setDungeonName(identifier);
|
||||||
|
Dungeon dungeon = plugin.getDungeons().getDungeon(identifier);
|
||||||
|
|
||||||
|
if (dungeon != null) {
|
||||||
|
DungeonConfig config = dungeon.getConfig();
|
||||||
|
|
||||||
|
if (config != null) {
|
||||||
|
dGroup.setMapName(config.getStartFloor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dGroup = new DGroup(player, identifier, multiFloor);
|
||||||
|
}
|
||||||
|
|
||||||
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
plugin.getDGroups().remove(dGroup);
|
||||||
dGroup = null;
|
dGroup = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,10 +142,14 @@ public class PlayCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup.getGameWorld().getLocLobby() == null) {
|
if (dGroup.getGameWorld().getLocLobby() == null) {
|
||||||
new DPlayer(player, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getWorld().getSpawnLocation(), false);
|
for (Player groupPlayer : dGroup.getPlayers()) {
|
||||||
|
new DPlayer(groupPlayer, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getWorld().getSpawnLocation(), false);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
new DPlayer(player, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getLocLobby(), false);
|
for (Player groupPlayer : dGroup.getPlayers()) {
|
||||||
|
new DPlayer(groupPlayer, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getLocLobby(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
@ -62,16 +63,43 @@ public class TestCommand extends DCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DGroup.getByPlayer(player) != null) {
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DGroup dGroup = new DGroup(player, identifier, multiFloor);
|
if (dGroup != null) {
|
||||||
|
if ( !dGroup.getCaptain().equals(player) && !player.hasPermission("dxl.bypass")) {
|
||||||
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_CAPTAIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dGroup.getMapName() == null) {
|
||||||
|
if ( !multiFloor) {
|
||||||
|
dGroup.setMapName(identifier);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dGroup.setDungeonName(identifier);
|
||||||
|
Dungeon dungeon = plugin.getDungeons().getDungeon(identifier);
|
||||||
|
|
||||||
|
if (dungeon != null) {
|
||||||
|
DungeonConfig config = dungeon.getConfig();
|
||||||
|
|
||||||
|
if (config != null) {
|
||||||
|
dGroup.setMapName(config.getStartFloor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dGroup = new DGroup(player, identifier, multiFloor);
|
||||||
|
}
|
||||||
|
|
||||||
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
plugin.getDGroups().remove(dGroup);
|
||||||
dGroup = null;
|
dGroup = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,17 +116,16 @@ public class TestCommand extends DCommand {
|
|||||||
dGroup.remove();
|
dGroup.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPlayer newDPlayer;
|
|
||||||
|
|
||||||
if (dGroup.getGameWorld().getLocLobby() == null) {
|
if (dGroup.getGameWorld().getLocLobby() == null) {
|
||||||
newDPlayer = new DPlayer(player, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getWorld().getSpawnLocation(), false);
|
for (Player groupPlayer : dGroup.getPlayers()) {
|
||||||
|
new DPlayer(groupPlayer, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getWorld().getSpawnLocation(), false).setInTestMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
newDPlayer = new DPlayer(player, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getLocLobby(), false);
|
for (Player groupPlayer : dGroup.getPlayers()) {
|
||||||
|
new DPlayer(groupPlayer, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getLocLobby(), false).setInTestMode(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newDPlayer.setInTestMode(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,13 @@ public class MessageConfig {
|
|||||||
|
|
||||||
public enum Messages {
|
public enum Messages {
|
||||||
|
|
||||||
|
GROUP_CREATED("Group_Created", "&4&v1&6 created the group &4&v2&6!"),
|
||||||
|
GROUP_DISBANDED("Group_Disbanded", "&4&v1&6 disbanded the group &4&v2&6."),
|
||||||
|
GROUP_INVITED_PLAYER("Group_InvitedPlayer", "&4&v1&6 invited the player &4&v2&6 to the group &4&v3&6."),
|
||||||
|
GROUP_UNINVITED_PLAYER("Group_UninvitedPlayer", "&4&v1&6 took back the invitation for &4&v2&6 to the group &4&v3&6."),
|
||||||
|
GROUP_KICKED_PLAYER("Group_KickedPlayer", "&4&v1&6 kicked the player &4&v2&6 from the group &4&v3&6."),
|
||||||
|
GROUP_PLAYER_JOINED("Group_PlayerJoined", "&6Player &4&v1&6 has joined the group!"),
|
||||||
|
|
||||||
LOG_ERROR_MOB_ENCHANTMENT("Log_Error_MobEnchantment", "&4Error at loading mob.yml: Enchantment &6&v1&4 doesn't exist!"),
|
LOG_ERROR_MOB_ENCHANTMENT("Log_Error_MobEnchantment", "&4Error at loading mob.yml: Enchantment &6&v1&4 doesn't exist!"),
|
||||||
LOG_ERROR_MOBTYPE("Log_Error_MobType", "&4Error at loading mob.yml: Mob &6&v1&4 doesn't exist!"),
|
LOG_ERROR_MOBTYPE("Log_Error_MobType", "&4Error at loading mob.yml: Mob &6&v1&4 doesn't exist!"),
|
||||||
LOG_ERROR_NO_CONSOLE_COMMAND("Log_Error_NoConsoleCommand", "&6/dxl &v1&4 can not be executed as Console!"),
|
LOG_ERROR_NO_CONSOLE_COMMAND("Log_Error_NoConsoleCommand", "&6/dxl &v1&4 can not be executed as Console!"),
|
||||||
@ -23,10 +30,14 @@ public class MessageConfig {
|
|||||||
PLAYER_DEATH("Player_Death", "&6You died, lives left: &2&v1"),
|
PLAYER_DEATH("Player_Death", "&6You died, lives left: &2&v1"),
|
||||||
PLAYER_DEATH_KICK("Player_DeathKick", "&2&v1&6 died and lost his last life."),
|
PLAYER_DEATH_KICK("Player_DeathKick", "&2&v1&6 died and lost his last life."),
|
||||||
PLAYER_FINISHED_DUNGEON("Player_FinishedDungeon", "&6You successfully finished the Dungeon!"),
|
PLAYER_FINISHED_DUNGEON("Player_FinishedDungeon", "&6You successfully finished the Dungeon!"),
|
||||||
PLAYER_JOIN_GROUP("Player_JoinGroup", "&6Player &4&v1&6 has joined the Group!"),
|
PLAYER_INVITED("Player_Invited", "&4&v1&6 invited you to the group &4&v2&6."),
|
||||||
|
PLAYER_UNINVITED("Player_Uninvited", "&4&v1&6 took back your invitation to the group &4&v2&6."),
|
||||||
|
PLAYER_JOIN_GROUP("Player_JoinGroup", "&6You successfully joined the group!"),
|
||||||
|
PLAYER_KICKED("Player_Kicked", "&4You have been kicked out of the group &6&v1&4."),
|
||||||
PLAYER_LEAVE_GROUP("Player_LeaveGroup", "&6You have successfully left your group!"),
|
PLAYER_LEAVE_GROUP("Player_LeaveGroup", "&6You have successfully left your group!"),
|
||||||
PLAYER_LEFT_GROUP("Player_LeftGroup", "&6Player &4&v1&6 has left the Group!"),
|
PLAYER_LEFT_GROUP("Player_LeftGroup", "&6Player &4&v1&6 has left the Group!"),
|
||||||
PLAYER_LOOT_ADDED("Player_LootAdded", "&4&v1&6 have been added to your reward inventory!"),
|
PLAYER_LOOT_ADDED("Player_LootAdded", "&4&v1&6 have been added to your reward inventory!"),
|
||||||
|
PLAYER_NEW_CAPTAIN("Player_NewCaptain", "&6You are now the new captain of your group."),
|
||||||
PLAYER_OFFLINE("Player_Offline", "&Player &4&v1&6 went offline. In &4&v2&6 seconds he will autmatically be kicked from the Dungeon!"),
|
PLAYER_OFFLINE("Player_Offline", "&Player &4&v1&6 went offline. In &4&v2&6 seconds he will autmatically be kicked from the Dungeon!"),
|
||||||
PLAYER_OFFLINE_NEVER("Player_OfflineNever", "&Player &4&v1&6 went offline. He will &4not&6 be kicked from the Dungeon automatically!"),
|
PLAYER_OFFLINE_NEVER("Player_OfflineNever", "&Player &4&v1&6 went offline. He will &4not&6 be kicked from the Dungeon automatically!"),
|
||||||
PLAYER_PORTAL_ABORT("Player_PortalAbort", "&6Portal creation cancelled!"),
|
PLAYER_PORTAL_ABORT("Player_PortalAbort", "&6Portal creation cancelled!"),
|
||||||
@ -69,6 +80,8 @@ public class MessageConfig {
|
|||||||
ERROR_DROP("Error_Drop", "&4You cannot drop safe items"),
|
ERROR_DROP("Error_Drop", "&4You cannot drop safe items"),
|
||||||
ERROR_DUNGEON_NOT_EXIST("Error_DungeonNotExist", "&4Dungeon &6&v1&4 does not exist!"),
|
ERROR_DUNGEON_NOT_EXIST("Error_DungeonNotExist", "&4Dungeon &6&v1&4 does not exist!"),
|
||||||
ERROR_ENDERCHEST("Error_Enderchest", "&4You cannot use an enderchest while in a Dungeon!"),
|
ERROR_ENDERCHEST("Error_Enderchest", "&4You cannot use an enderchest while in a Dungeon!"),
|
||||||
|
ERROR_IN_GROUP("Error_InGroup", "&4The player &6&v1&4 is already member of a group."),
|
||||||
|
ERROR_JOIN_GROUP("Error_JoinGroup", "&4You have to join a group first!"),
|
||||||
ERROR_LEAVE_DUNGEON("Error_LeaveDungeon", "&4You have to leave your current dungeon first!"),
|
ERROR_LEAVE_DUNGEON("Error_LeaveDungeon", "&4You have to leave your current dungeon first!"),
|
||||||
ERROR_LEAVE_GROUP("Error_LeaveGroup", "&4You have to leave your group first!"),
|
ERROR_LEAVE_GROUP("Error_LeaveGroup", "&4You have to leave your group first!"),
|
||||||
ERROR_LEFT_CLICK("Error_Leftklick", "&4You have to use Left-Click on this sign!"),
|
ERROR_LEFT_CLICK("Error_Leftklick", "&4You have to use Left-Click on this sign!"),
|
||||||
@ -81,8 +94,12 @@ public class MessageConfig {
|
|||||||
ERROR_NO_PERMISSIONS("Error_NoPermissions", "&4You have no permission to do this!"),
|
ERROR_NO_PERMISSIONS("Error_NoPermissions", "&4You have no permission to do this!"),
|
||||||
ERROR_NO_PLAYER_COMMAND("Error_NoPlayerCommand", "&6/dxl &v1&4 cannot be executed as player!"),
|
ERROR_NO_PLAYER_COMMAND("Error_NoPlayerCommand", "&6/dxl &v1&4 cannot be executed as player!"),
|
||||||
ERROR_NO_PROTECTED_BLOCK("Error_NoDXLBlock", "&4This is not a block protected by DungeonsXL!"),
|
ERROR_NO_PROTECTED_BLOCK("Error_NoDXLBlock", "&4This is not a block protected by DungeonsXL!"),
|
||||||
|
ERROR_NO_SUCH_GROUP("Error_NoSuchGroup", "&4The group &6&v1&4 does not exist!"),
|
||||||
|
ERROR_NO_SUCH_PLAYER("Error_NoSuchPlayer", "&4The player &6&v1&4 does not exist!"),
|
||||||
|
ERROR_NOT_CAPTAIN("Error_NotCaptain", "&4You are not the captain of your group!"),
|
||||||
ERROR_NOT_IN_DUNGEON("Error_NotInDungeon", "&4You are not in a dungeon!"),
|
ERROR_NOT_IN_DUNGEON("Error_NotInDungeon", "&4You are not in a dungeon!"),
|
||||||
ERROR_NOT_IN_GROUP("Error_NotInGroup", "&4You have to join a group first!"),
|
ERROR_NOT_IN_GROUP("Error_NotInGroup", "&4The player &6&v1&4 is not member of the group &6&v2&v4."),
|
||||||
|
ERROR_NOT_INVITED("Error_NotInvited", "&4You are not invited to the group &6&v1&4."),
|
||||||
ERROR_NOT_SAVED("Error_NotSaved", "&4The map &6&v1&4 has not been saved to the &6DungeonsXL/maps/ &4folder yet!"),
|
ERROR_NOT_SAVED("Error_NotSaved", "&4The map &6&v1&4 has not been saved to the &6DungeonsXL/maps/ &4folder yet!"),
|
||||||
ERROR_TUTORIAL_NOT_EXIST("Error_TutorialNotExist", "&4Tutorial dungeon does not exist!"),
|
ERROR_TUTORIAL_NOT_EXIST("Error_TutorialNotExist", "&4Tutorial dungeon does not exist!"),
|
||||||
ERROR_READY("Error_Ready", "&4Choose your class first!"),
|
ERROR_READY("Error_Ready", "&4Choose your class first!"),
|
||||||
@ -95,6 +112,14 @@ public class MessageConfig {
|
|||||||
HELP_CMD_CREATE("Help_Cmd_Create", "/dxl create <name> - Creates a new dungeon"),
|
HELP_CMD_CREATE("Help_Cmd_Create", "/dxl create <name> - Creates a new dungeon"),
|
||||||
HELP_CMD_EDIT("Help_Cmd_Edit", "/dxl edit <name> - Edit an existing dungeon"),
|
HELP_CMD_EDIT("Help_Cmd_Edit", "/dxl edit <name> - Edit an existing dungeon"),
|
||||||
HELP_CMD_ESCAPE("Help_Cmd_Escape", "/dxl escape - Leaves the current dungeon, without saving!"),
|
HELP_CMD_ESCAPE("Help_Cmd_Escape", "/dxl escape - Leaves the current dungeon, without saving!"),
|
||||||
|
HELP_CMD_GROUP("Help_Cmd_Group", "/dxl group - Shows group command help"),
|
||||||
|
HELP_CMD_GROUP_CREATE("Help_Cmd_GroupCreate", "/dxl group create [group] - Creates a new group"),
|
||||||
|
HELP_CMD_GROUP_DISBAND("Help_Cmd_GroupDisband", "/dxl group disband ([group]) - Disbands a group"),
|
||||||
|
HELP_CMD_GROUP_INVITE("Help_Cmd_GroupInvite", "/dxl group invite [player]- Invites someone to your group"),
|
||||||
|
HELP_CMD_GROUP_UNINVITE("Help_Cmd_GroupUninvite", "/dxl group uninvite [player] - Takes back an invitation to your group"),
|
||||||
|
HELP_CMD_GROUP_JOIN("Help_Cmd_GroupJoin", "/dxl group join [group]- Join a group"),
|
||||||
|
HELP_CMD_GROUP_KICK("Help_Cmd_GroupKick", "/dxl group kick [player] - Kicks a player"),
|
||||||
|
HELP_CMD_GROUP_SHOW("Help_Cmd_GroupShow", "/dxl group show [group] - Shows a group"),
|
||||||
HELP_CMD_HELP("Help_Cmd_Help", "/dxl help <page> - Shows the help page"),
|
HELP_CMD_HELP("Help_Cmd_Help", "/dxl help <page> - Shows the help page"),
|
||||||
HELP_CMD_INVITE("Help_Cmd_Invite", "/dxl invite <player> <dungeon> - Invite a player to edit a dungeon"),
|
HELP_CMD_INVITE("Help_Cmd_Invite", "/dxl invite <player> <dungeon> - Invite a player to edit a dungeon"),
|
||||||
HELP_CMD_LEAVE("Help_Cmd_Leave", "/dxl leave - Leaves the current dungeon"),
|
HELP_CMD_LEAVE("Help_Cmd_Leave", "/dxl leave - Leaves the current dungeon"),
|
||||||
|
@ -12,7 +12,7 @@ public class DGroupCreateEvent extends DGroupEvent implements Cancellable {
|
|||||||
|
|
||||||
COMMAND,
|
COMMAND,
|
||||||
GROUP_SIGN,
|
GROUP_SIGN,
|
||||||
CUSTOM;
|
CUSTOM
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.event.dgroup;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
public class DGroupDisbandEvent extends DGroupEvent implements Cancellable {
|
||||||
|
|
||||||
|
public enum Cause {
|
||||||
|
|
||||||
|
COMMAND,
|
||||||
|
DUNGEON_FINISHED,
|
||||||
|
CUSTOM
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
private Player disbander;
|
||||||
|
|
||||||
|
private Cause cause;
|
||||||
|
|
||||||
|
public DGroupDisbandEvent(DGroup dGroup, Cause cause) {
|
||||||
|
super(dGroup);
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DGroupDisbandEvent(DGroup dGroup, Player disbander, Cause cause) {
|
||||||
|
super(dGroup);
|
||||||
|
this.disbander = disbander;
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the disbander
|
||||||
|
*/
|
||||||
|
public Player getDisbander() {
|
||||||
|
return disbander;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param disbander
|
||||||
|
* the disbander to set
|
||||||
|
*/
|
||||||
|
public void setDisbander(Player disbander) {
|
||||||
|
this.disbander = disbander;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the cause
|
||||||
|
*/
|
||||||
|
public Cause getCause() {
|
||||||
|
return cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param cause
|
||||||
|
* the cause to set
|
||||||
|
*/
|
||||||
|
public void setCause(Cause cause) {
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.cancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,11 +7,38 @@ import org.bukkit.event.HandlerList;
|
|||||||
|
|
||||||
public class DPlayerKickEvent extends DPlayerEvent implements Cancellable {
|
public class DPlayerKickEvent extends DPlayerEvent implements Cancellable {
|
||||||
|
|
||||||
|
public enum Cause {
|
||||||
|
|
||||||
|
COMMAND,
|
||||||
|
DEATH,
|
||||||
|
OFFLINE,
|
||||||
|
CUSTOM
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public DPlayerKickEvent(DPlayer dPlayer) {
|
private Cause cause;
|
||||||
|
|
||||||
|
public DPlayerKickEvent(DPlayer dPlayer, Cause cause) {
|
||||||
super(dPlayer);
|
super(dPlayer);
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the cause
|
||||||
|
*/
|
||||||
|
public Cause getCause() {
|
||||||
|
return cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param cause
|
||||||
|
* the cause to set
|
||||||
|
*/
|
||||||
|
public void setCause(Cause cause) {
|
||||||
|
this.cause = cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -162,7 +162,7 @@ public class DPortal {
|
|||||||
DGroup dgroup = DGroup.getByPlayer(player);
|
DGroup dgroup = DGroup.getByPlayer(player);
|
||||||
|
|
||||||
if (dgroup == null) {
|
if (dgroup == null) {
|
||||||
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_NOT_IN_GROUP));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_JOIN_GROUP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import io.github.dre2n.dungeonsxl.player.DPlayer;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -121,11 +122,13 @@ public class EntityListener implements Listener {
|
|||||||
attackedDGroup = DGroup.getByPlayer(attackedPlayer);
|
attackedDGroup = DGroup.getByPlayer(attackedPlayer);
|
||||||
|
|
||||||
if (config.isPlayerVersusPlayer()) {
|
if (config.isPlayerVersusPlayer()) {
|
||||||
|
Bukkit.broadcastMessage("pvp cancel");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attackerDGroup != null && attackedDGroup != null) {
|
if (attackerDGroup != null && attackedDGroup != null) {
|
||||||
if (config.isFriendlyFire() && attackerDGroup.equals(attackedDGroup)) {
|
if (config.isFriendlyFire() && attackerDGroup.equals(attackedDGroup)) {
|
||||||
|
Bukkit.broadcastMessage("ff cancel");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import io.github.dre2n.dungeonsxl.dungeon.game.GameChest;
|
|||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent;
|
||||||
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
||||||
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
||||||
@ -78,14 +79,18 @@ public class PlayerListener implements Listener {
|
|||||||
dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives());
|
dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives());
|
||||||
|
|
||||||
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
||||||
MessageUtil.broadcastMessage(messageConfig.getMessage(Messages.PLAYER_DEATH_KICK, player.getName()));
|
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.DEATH);
|
||||||
|
|
||||||
// TODO: This Runnable is a workaround for a bug I couldn't find, yet...
|
if ( !dPlayerKickEvent.isCancelled()) {
|
||||||
new org.bukkit.scheduler.BukkitRunnable() {
|
MessageUtil.broadcastMessage(messageConfig.getMessage(Messages.PLAYER_DEATH_KICK, player.getName()));
|
||||||
public void run() {
|
|
||||||
dPlayer.leave();
|
// TODO: This Runnable is a workaround for a bug I couldn't find, yet...
|
||||||
}
|
new org.bukkit.scheduler.BukkitRunnable() {
|
||||||
}.runTaskLater(plugin, 1L);
|
public void run() {
|
||||||
|
dPlayer.leave();
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
}
|
||||||
|
|
||||||
} else if ( !(dPlayer.getLives() == -1)) {
|
} else if ( !(dPlayer.getLives() == -1)) {
|
||||||
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_DEATH, String.valueOf(dPlayer.getLives())));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_DEATH, String.valueOf(dPlayer.getLives())));
|
||||||
|
@ -14,7 +14,7 @@ import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -23,7 +23,9 @@ public class DGroup {
|
|||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private CopyOnWriteArrayList<Player> players = new CopyOnWriteArrayList<Player>();
|
private Player captain;
|
||||||
|
private List<Player> players = new ArrayList<Player>();
|
||||||
|
private List<UUID> invitedPlayers = new ArrayList<UUID>();
|
||||||
private String dungeonName;
|
private String dungeonName;
|
||||||
private String mapName;
|
private String mapName;
|
||||||
private List<String> unplayedFloors = new ArrayList<String>();
|
private List<String> unplayedFloors = new ArrayList<String>();
|
||||||
@ -32,42 +34,75 @@ public class DGroup {
|
|||||||
private int floorCount;
|
private int floorCount;
|
||||||
private List<Reward> rewards = new ArrayList<Reward>();
|
private List<Reward> rewards = new ArrayList<Reward>();
|
||||||
|
|
||||||
public DGroup(String name, Player player, String identifier, boolean multiFloor) {
|
public DGroup(String name, Player player) {
|
||||||
plugin.getDGroups().add(this);
|
plugin.getDGroups().add(this);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.players.add(player);
|
captain = player;
|
||||||
|
players.add(player);
|
||||||
|
|
||||||
Dungeon dungeon = plugin.getDungeons().getDungeon(identifier);
|
playing = false;
|
||||||
if (multiFloor && dungeon != null) {
|
floorCount = 0;
|
||||||
this.dungeonName = identifier;
|
|
||||||
this.mapName = dungeon.getConfig().getStartFloor();
|
|
||||||
this.unplayedFloors = dungeon.getConfig().getFloors();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.mapName = identifier;
|
|
||||||
}
|
|
||||||
this.playing = false;
|
|
||||||
this.floorCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DGroup(Player player, String identifier, boolean multiFloor) {
|
public DGroup(Player player, String identifier, boolean multiFloor) {
|
||||||
plugin.getDGroups().add(this);
|
plugin.getDGroups().add(this);
|
||||||
this.name = "Group_" + plugin.getDGroups().size();
|
name = "Group_" + plugin.getDGroups().size();
|
||||||
|
|
||||||
this.players.add(player);
|
captain = player;
|
||||||
|
players.add(player);
|
||||||
|
|
||||||
Dungeon dungeon = plugin.getDungeons().getDungeon(identifier);
|
Dungeon dungeon = plugin.getDungeons().getDungeon(identifier);
|
||||||
if (multiFloor && dungeon != null) {
|
if (multiFloor && dungeon != null) {
|
||||||
this.dungeonName = identifier;
|
dungeonName = identifier;
|
||||||
this.mapName = dungeon.getConfig().getStartFloor();
|
mapName = dungeon.getConfig().getStartFloor();
|
||||||
this.unplayedFloors = dungeon.getConfig().getFloors();
|
unplayedFloors = dungeon.getConfig().getFloors();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.mapName = identifier;
|
mapName = identifier;
|
||||||
}
|
}
|
||||||
this.playing = false;
|
playing = false;
|
||||||
this.floorCount = 0;
|
floorCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DGroup(String name, Player player, String identifier, boolean multiFloor) {
|
||||||
|
plugin.getDGroups().add(this);
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
captain = player;
|
||||||
|
players.add(player);
|
||||||
|
|
||||||
|
Dungeon dungeon = plugin.getDungeons().getDungeon(identifier);
|
||||||
|
if (multiFloor && dungeon != null) {
|
||||||
|
dungeonName = identifier;
|
||||||
|
mapName = dungeon.getConfig().getStartFloor();
|
||||||
|
unplayedFloors = dungeon.getConfig().getFloors();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mapName = identifier;
|
||||||
|
}
|
||||||
|
playing = false;
|
||||||
|
floorCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DGroup(String name, Player captain, List<Player> players, String identifier, boolean multiFloor) {
|
||||||
|
plugin.getDGroups().add(this);
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
this.captain = captain;
|
||||||
|
this.players = players;
|
||||||
|
|
||||||
|
Dungeon dungeon = plugin.getDungeons().getDungeon(identifier);
|
||||||
|
if (multiFloor && dungeon != null) {
|
||||||
|
dungeonName = identifier;
|
||||||
|
mapName = dungeon.getConfig().getStartFloor();
|
||||||
|
unplayedFloors = dungeon.getConfig().getFloors();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mapName = identifier;
|
||||||
|
}
|
||||||
|
playing = false;
|
||||||
|
floorCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters and setters
|
// Getters and setters
|
||||||
@ -87,10 +122,25 @@ public class DGroup {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the captain
|
||||||
|
*/
|
||||||
|
public Player getCaptain() {
|
||||||
|
return captain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param captain
|
||||||
|
* the captain to set
|
||||||
|
*/
|
||||||
|
public void setCaptain(Player captain) {
|
||||||
|
this.captain = captain;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the players
|
* @return the players
|
||||||
*/
|
*/
|
||||||
public CopyOnWriteArrayList<Player> getPlayers() {
|
public List<Player> getPlayers() {
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,13 +149,10 @@ public class DGroup {
|
|||||||
* the player to add
|
* the player to add
|
||||||
*/
|
*/
|
||||||
public void addPlayer(Player player) {
|
public void addPlayer(Player player) {
|
||||||
// Send message
|
sendMessage(plugin.getMessageConfig().getMessage(Messages.GROUP_PLAYER_JOINED, player.getName()));
|
||||||
for (Player groupPlayer : getPlayers()) {
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_JOIN_GROUP));
|
||||||
MessageUtil.sendMessage(groupPlayer, plugin.getMessageConfig().getMessage(Messages.PLAYER_JOIN_GROUP, player.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add player
|
players.add(player);
|
||||||
getPlayers().add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,13 +160,11 @@ public class DGroup {
|
|||||||
* the player to remove
|
* the player to remove
|
||||||
*/
|
*/
|
||||||
public void removePlayer(Player player) {
|
public void removePlayer(Player player) {
|
||||||
getPlayers().remove(player);
|
players.remove(player);
|
||||||
GroupSign.updatePerGroup(this);
|
GroupSign.updatePerGroup(this);
|
||||||
|
|
||||||
// Send message
|
// Send message
|
||||||
for (Player groupPlayer : getPlayers()) {
|
sendMessage(plugin.getMessageConfig().getMessage(Messages.PLAYER_LEFT_GROUP, player.getName()));
|
||||||
MessageUtil.sendMessage(groupPlayer, plugin.getMessageConfig().getMessage(Messages.PLAYER_LEFT_GROUP, player.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check group
|
// Check group
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
@ -127,6 +172,92 @@ public class DGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the players
|
||||||
|
*/
|
||||||
|
public List<Player> getInvitedPlayers() {
|
||||||
|
ArrayList<Player> players = new ArrayList<Player>();
|
||||||
|
for (UUID uuid : invitedPlayers) {
|
||||||
|
players.add(plugin.getServer().getPlayer(uuid));
|
||||||
|
}
|
||||||
|
|
||||||
|
return players;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param player
|
||||||
|
* the player to add
|
||||||
|
*/
|
||||||
|
public void addInvitedPlayer(Player player, boolean silent) {
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DGroup.getByPlayer(player) != null) {
|
||||||
|
if ( !silent) {
|
||||||
|
MessageUtil.sendMessage(captain, plugin.getMessageConfig().getMessage(Messages.ERROR_IN_GROUP, player.getName()));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !silent) {
|
||||||
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_INVITED, captain.getName(), name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send message
|
||||||
|
if ( !silent) {
|
||||||
|
sendMessage(plugin.getMessageConfig().getMessage(Messages.GROUP_INVITED_PLAYER, captain.getName(), player.getName(), name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add player
|
||||||
|
invitedPlayers.add(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param player
|
||||||
|
* the player to remove
|
||||||
|
*/
|
||||||
|
public void removeInvitedPlayer(Player player, boolean silent) {
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DGroup.getByPlayer(player) != this) {
|
||||||
|
if ( !silent) {
|
||||||
|
MessageUtil.sendMessage(captain, plugin.getMessageConfig().getMessage(Messages.ERROR_NOT_IN_GROUP, player.getName(), name));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !silent) {
|
||||||
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_UNINVITED, player.getName(), name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send message
|
||||||
|
if ( !silent) {
|
||||||
|
for (Player groupPlayer : getPlayers()) {
|
||||||
|
MessageUtil.sendMessage(groupPlayer, plugin.getMessageConfig().getMessage(Messages.GROUP_UNINVITED_PLAYER, captain.getName(), player.getName(), name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
invitedPlayers.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all invitations for players who are not online
|
||||||
|
*/
|
||||||
|
public void clearOfflineInvitedPlayers() {
|
||||||
|
ArrayList<UUID> toRemove = new ArrayList<UUID>();
|
||||||
|
|
||||||
|
for (UUID uuid : invitedPlayers) {
|
||||||
|
if (plugin.getServer().getPlayer(uuid) == null) {
|
||||||
|
toRemove.add(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
invitedPlayers.removeAll(toRemove);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the gameWorld
|
* @return the gameWorld
|
||||||
*/
|
*/
|
||||||
@ -184,7 +315,7 @@ public class DGroup {
|
|||||||
* the name to set
|
* the name to set
|
||||||
*/
|
*/
|
||||||
public void setMapName(String name) {
|
public void setMapName(String name) {
|
||||||
this.mapName = name;
|
mapName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -332,7 +463,7 @@ public class DGroup {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to all players in the group
|
* Send a message to all players in the group
|
||||||
*
|
*
|
||||||
* @param except
|
* @param except
|
||||||
* Players who do not receive the message
|
* Players who do not receive the message
|
||||||
*/
|
*/
|
||||||
@ -346,6 +477,16 @@ public class DGroup {
|
|||||||
|
|
||||||
// Statics
|
// Statics
|
||||||
|
|
||||||
|
public static DGroup getByName(String name) {
|
||||||
|
for (DGroup dGroup : plugin.getDGroups()) {
|
||||||
|
if (dGroup.getName().equals(name)) {
|
||||||
|
return dGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static DGroup getByPlayer(Player player) {
|
public static DGroup getByPlayer(Player player) {
|
||||||
for (DGroup dGroup : plugin.getDGroups()) {
|
for (DGroup dGroup : plugin.getDGroups()) {
|
||||||
if (dGroup.getPlayers().contains(player)) {
|
if (dGroup.getPlayers().contains(player)) {
|
||||||
|
@ -44,7 +44,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
public class DPlayer {
|
public class DPlayer {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
MessageConfig MessageConfig = plugin.getMessageConfig();
|
MessageConfig messageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private Player player;
|
private Player player;
|
||||||
@ -67,7 +67,7 @@ public class DPlayer {
|
|||||||
private ItemStack[] respawnArmor;
|
private ItemStack[] respawnArmor;
|
||||||
private String[] linesCopy;
|
private String[] linesCopy;
|
||||||
|
|
||||||
private Inventory treasureInv = plugin.getServer().createInventory(getPlayer(), 45, MessageConfig.getMessage(Messages.PLAYER_TREASURES));
|
private Inventory treasureInv = plugin.getServer().createInventory(getPlayer(), 45, messageConfig.getMessage(Messages.PLAYER_TREASURES));
|
||||||
|
|
||||||
private int initialLives = -1;
|
private int initialLives = -1;
|
||||||
private int lives;
|
private int lives;
|
||||||
@ -488,6 +488,7 @@ public class DPlayer {
|
|||||||
} else {
|
} else {
|
||||||
savePlayer.reset(dConfig.getKeepInventoryOnEscape());
|
savePlayer.reset(dConfig.getKeepInventoryOnEscape());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
savePlayer.reset(false);
|
savePlayer.reset(false);
|
||||||
}
|
}
|
||||||
@ -551,18 +552,18 @@ public class DPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give Secure Objects other Players
|
|
||||||
if (dGroup != null) {
|
if (dGroup != null) {
|
||||||
|
// Give Secure Objects other Players
|
||||||
if ( !dGroup.isEmpty()) {
|
if ( !dGroup.isEmpty()) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Player groupPlayer;
|
Player groupPlayer;
|
||||||
do {
|
do {
|
||||||
groupPlayer = dGroup.getPlayers().get(i);
|
groupPlayer = dGroup.getPlayers().get(i);
|
||||||
if (groupPlayer != null) {
|
if (groupPlayer != null) {
|
||||||
for (ItemStack istack : getPlayer().getInventory()) {
|
for (ItemStack itemStack : getPlayer().getInventory()) {
|
||||||
if (istack != null) {
|
if (itemStack != null) {
|
||||||
if (gameWorld.getSecureObjects().contains(istack.getType())) {
|
if (gameWorld.getSecureObjects().contains(itemStack.getType())) {
|
||||||
groupPlayer.getInventory().addItem(istack);
|
groupPlayer.getInventory().addItem(itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,7 +571,16 @@ public class DPlayer {
|
|||||||
i++;
|
i++;
|
||||||
} while (groupPlayer == null);
|
} while (groupPlayer == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dGroup.getCaptain().equals(player) && dGroup.getPlayers().size() > 0) {
|
||||||
|
// Captain here!
|
||||||
|
Player newCaptain = dGroup.getPlayers().get(0);
|
||||||
|
dGroup.setCaptain(newCaptain);
|
||||||
|
MessageUtil.sendMessage(newCaptain, messageConfig.getMessage(Messages.PLAYER_NEW_CAPTAIN));
|
||||||
|
// ...*flies away*
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +628,7 @@ public class DPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finishFloor(String specifiedFloor) {
|
public void finishFloor(String specifiedFloor) {
|
||||||
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
||||||
finished = true;
|
finished = true;
|
||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
@ -633,7 +643,7 @@ public class DPlayer {
|
|||||||
for (Player player : dGroup.getPlayers()) {
|
for (Player player : dGroup.getPlayers()) {
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
if ( !dPlayer.finished) {
|
if ( !dPlayer.finished) {
|
||||||
MessageUtil.sendMessage(this.getPlayer(), MessageConfig.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
MessageUtil.sendMessage(this.getPlayer(), messageConfig.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -691,7 +701,7 @@ public class DPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finish() {
|
public void finish() {
|
||||||
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
||||||
finished = true;
|
finished = true;
|
||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
@ -709,7 +719,7 @@ public class DPlayer {
|
|||||||
for (Player player : dGroup.getPlayers()) {
|
for (Player player : dGroup.getPlayers()) {
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
if ( !dPlayer.finished) {
|
if ( !dPlayer.finished) {
|
||||||
MessageUtil.sendMessage(this.getPlayer(), MessageConfig.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
MessageUtil.sendMessage(this.getPlayer(), messageConfig.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
||||||
hasToWait = true;
|
hasToWait = true;
|
||||||
|
|
||||||
} else if (dPlayer != this) {
|
} else if (dPlayer != this) {
|
||||||
@ -784,14 +794,14 @@ public class DPlayer {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
linesCopy = lines;
|
linesCopy = lines;
|
||||||
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_SIGN_COPIED));
|
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(Messages.PLAYER_SIGN_COPIED));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String info = "" + block.getType();
|
String info = "" + block.getType();
|
||||||
if (block.getData() != 0) {
|
if (block.getData() != 0) {
|
||||||
info = info + "," + block.getData();
|
info = info + "," + block.getData();
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_BLOCK_INFO, info));
|
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(Messages.PLAYER_BLOCK_INFO, info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -896,7 +906,7 @@ public class DPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (kick) {
|
if (kick) {
|
||||||
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(this);
|
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(this, DPlayerKickEvent.Cause.OFFLINE);
|
||||||
|
|
||||||
if ( !dPlayerKickEvent.isCancelled()) {
|
if ( !dPlayerKickEvent.isCancelled()) {
|
||||||
leave();
|
leave();
|
||||||
|
@ -6,57 +6,70 @@ import io.github.dre2n.dungeonsxl.util.VersionUtil.Internals;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlayerUtil {
|
public class PlayerUtil {
|
||||||
|
|
||||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
public static Player getOfflinePlayer(String name) {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(name);
|
||||||
|
return getOfflinePlayer(name, offlinePlayer.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Player getOfflinePlayer(UUID uuid) {
|
||||||
|
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(uuid);
|
||||||
|
return getOfflinePlayer(offlinePlayer.getName(), uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Player getOfflinePlayer(String name, UUID uuid) {
|
||||||
VersionUtil versions = DungeonsXL.getPlugin().getVersion();
|
VersionUtil versions = DungeonsXL.getPlugin().getVersion();
|
||||||
|
|
||||||
if (versions.getInternals() == Internals.v1_9_R1) {
|
if (versions.getInternals() == Internals.v1_9_R1) {
|
||||||
return v1_9_R1.getOfflinePlayer(player, uuid);
|
return v1_9_R1.getOfflinePlayer(name, uuid);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_8_R3) {
|
} else if (versions.getInternals() == Internals.v1_8_R3) {
|
||||||
return v1_8_R3.getOfflinePlayer(player, uuid);
|
return v1_8_R3.getOfflinePlayer(name, uuid);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_8_R2) {
|
} else if (versions.getInternals() == Internals.v1_8_R2) {
|
||||||
return v1_8_R2.getOfflinePlayer(player, uuid);
|
return v1_8_R2.getOfflinePlayer(name, uuid);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_8_R1) {
|
} else if (versions.getInternals() == Internals.v1_8_R1) {
|
||||||
return v1_8_R1.getOfflinePlayer(player, uuid);
|
return v1_8_R1.getOfflinePlayer(name, uuid);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_7_R4) {
|
} else if (versions.getInternals() == Internals.v1_7_R4) {
|
||||||
return v1_7_R4.getOfflinePlayer(player, uuid);
|
return v1_7_R4.getOfflinePlayer(name, uuid);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_7_R3) {
|
} else if (versions.getInternals() == Internals.v1_7_R3) {
|
||||||
return v1_7_R3.getOfflinePlayer(player, uuid);
|
return v1_7_R3.getOfflinePlayer(name, uuid);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
public static Player getOfflinePlayer(String name, UUID uuid, Location location) {
|
||||||
VersionUtil versions = DungeonsXL.getPlugin().getVersion();
|
VersionUtil versions = DungeonsXL.getPlugin().getVersion();
|
||||||
|
|
||||||
if (versions.getInternals() == Internals.v1_9_R1) {
|
if (versions.getInternals() == Internals.v1_9_R1) {
|
||||||
return v1_9_R1.getOfflinePlayer(player, uuid, location);
|
return v1_9_R1.getOfflinePlayer(name, uuid, location);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_8_R3) {
|
} else if (versions.getInternals() == Internals.v1_8_R3) {
|
||||||
return v1_8_R3.getOfflinePlayer(player, uuid, location);
|
return v1_8_R3.getOfflinePlayer(name, uuid, location);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_8_R2) {
|
} else if (versions.getInternals() == Internals.v1_8_R2) {
|
||||||
return v1_8_R2.getOfflinePlayer(player, uuid, location);
|
return v1_8_R2.getOfflinePlayer(name, uuid, location);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_8_R1) {
|
} else if (versions.getInternals() == Internals.v1_8_R1) {
|
||||||
return v1_8_R1.getOfflinePlayer(player, uuid, location);
|
return v1_8_R1.getOfflinePlayer(name, uuid, location);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_7_R4) {
|
} else if (versions.getInternals() == Internals.v1_7_R4) {
|
||||||
return v1_7_R4.getOfflinePlayer(player, uuid, location);
|
return v1_7_R4.getOfflinePlayer(name, uuid, location);
|
||||||
|
|
||||||
} else if (versions.getInternals() == Internals.v1_7_R3) {
|
} else if (versions.getInternals() == Internals.v1_7_R3) {
|
||||||
return v1_7_R3.getOfflinePlayer(player, uuid, location);
|
return v1_7_R3.getOfflinePlayer(name, uuid, location);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -16,18 +16,18 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
class v1_7_R3 {
|
class v1_7_R3 {
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid) {
|
static Player getOfflinePlayer(String name, UUID uuid) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
||||||
@ -43,18 +43,18 @@ class v1_7_R3 {
|
|||||||
return pplayer;
|
return pplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
static Player getOfflinePlayer(String name, UUID uuid, Location location) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
@ -16,18 +16,18 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
class v1_7_R4 {
|
class v1_7_R4 {
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid) {
|
static Player getOfflinePlayer(String name, UUID uuid) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
||||||
@ -43,18 +43,18 @@ class v1_7_R4 {
|
|||||||
return pplayer;
|
return pplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
static Player getOfflinePlayer(String name, UUID uuid, Location location) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
@ -17,18 +17,18 @@ import com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
class v1_8_R1 {
|
class v1_8_R1 {
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid) {
|
static Player getOfflinePlayer(String name, UUID uuid) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String filename = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = filename.substring(0, filename.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
||||||
@ -44,18 +44,18 @@ class v1_8_R1 {
|
|||||||
return pplayer;
|
return pplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
static Player getOfflinePlayer(String name, UUID uuid, Location location) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String filename = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = filename.substring(0, filename.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
@ -17,18 +17,18 @@ import com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
class v1_8_R2 {
|
class v1_8_R2 {
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid) {
|
static Player getOfflinePlayer(String name, UUID uuid) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
||||||
@ -44,18 +44,18 @@ class v1_8_R2 {
|
|||||||
return pplayer;
|
return pplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
static Player getOfflinePlayer(String name, UUID uuid, Location location) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
@ -17,18 +17,18 @@ import com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
class v1_8_R3 {
|
class v1_8_R3 {
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid) {
|
static Player getOfflinePlayer(String name, UUID uuid) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
||||||
@ -44,18 +44,18 @@ class v1_8_R3 {
|
|||||||
return pplayer;
|
return pplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
static Player getOfflinePlayer(String name, UUID uuid, Location location) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
@ -17,18 +17,18 @@ import com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
class v1_9_R1 {
|
class v1_9_R1 {
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid) {
|
static Player getOfflinePlayer(String name, UUID uuid) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
Player target = entity == null ? null : (Player) entity.getBukkitEntity();
|
||||||
@ -44,18 +44,18 @@ class v1_9_R1 {
|
|||||||
return pplayer;
|
return pplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
static Player getOfflinePlayer(String name, UUID uuid, Location location) {
|
||||||
Player pplayer = null;
|
Player pplayer = null;
|
||||||
try {
|
try {
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
File playerFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||||
|
|
||||||
for (File playerfile : playerfolder.listFiles()) {
|
for (File playerFile : playerFolder.listFiles()) {
|
||||||
String filename = playerfile.getName();
|
String fileName = playerFile.getName();
|
||||||
String playername = filename.substring(0, filename.length() - 4);
|
String playerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, playername);
|
GameProfile profile = new GameProfile(uuid, playerName);
|
||||||
|
|
||||||
if (playername.trim().equalsIgnoreCase(player)) {
|
if (playerName.trim().equalsIgnoreCase(name)) {
|
||||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
@ -22,6 +22,10 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
dxl.escape:
|
dxl.escape:
|
||||||
default: true
|
default: true
|
||||||
|
dxl.group:
|
||||||
|
default: op
|
||||||
|
dxl.group.admin:
|
||||||
|
default: op
|
||||||
dxl.help:
|
dxl.help:
|
||||||
default: true
|
default: true
|
||||||
dxl.invite:
|
dxl.invite:
|
||||||
|
Loading…
Reference in New Issue
Block a user