Now kick player on uninvite

Updatet to 1.5.2

Signed-off-by: Grafe <flingelfrank@hotmail.com>
This commit is contained in:
Grafe 2013-05-05 02:35:37 +02:00
parent 992542ec0f
commit 00785cbcd5
3 changed files with 36 additions and 40 deletions

View File

@ -1,5 +1,5 @@
name: DungeonsXL name: DungeonsXL
version: 0.8 version: 0.8.1
main: com.dre.dungeonsxl.P main: com.dre.dungeonsxl.P
authors: [Frank Baumann] authors: [Frank Baumann]
softdepend: [Vault] softdepend: [Vault]

View File

@ -118,7 +118,7 @@ public class EditWorld {
public static EditWorld get(String name) { public static EditWorld get(String name) {
for (EditWorld eworld : eworlds) { for (EditWorld eworld : eworlds) {
if (eworld.name.equalsIgnoreCase(name)) { if (eworld.dungeonname.equalsIgnoreCase(name)) {
return eworld; return eworld;
} }
} }
@ -217,54 +217,50 @@ public class EditWorld {
// Invite // Invite
public static boolean addInvitedPlayer(String eworldname, String player) { public static boolean addInvitedPlayer(String eworldname, String player) {
EditWorld eworld = EditWorld.get(eworldname);
if (eworld != null) {
eworld.invitedPlayers.add(player.toLowerCase());
} else {
if (exist(eworldname)) { if (exist(eworldname)) {
DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml")); DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml"));
config.addInvitedPlayer(player.toLowerCase()); config.addInvitedPlayer(player.toLowerCase());
config.save(); config.save();
return true; return true;
} }
}
return false; return false;
} }
public static boolean removeInvitedPlayer(String eworldname, String player) { public static boolean removeInvitedPlayer(String eworldname, String name) {
EditWorld eworld = EditWorld.get(eworldname);
if (eworld != null) {
eworld.invitedPlayers.remove(player.toLowerCase());
} else {
if (exist(eworldname)) { if (exist(eworldname)) {
DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml")); DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml"));
config.removeInvitedPlayers(player.toLowerCase()); config.removeInvitedPlayers(name.toLowerCase());
config.save(); config.save();
return true;
// Kick Player
EditWorld eworld = EditWorld.get(eworldname);
if (eworld != null) {
DPlayer player = DPlayer.get(name);
P.p.log("ASD");
if (player != null) {
P.p.log("ASD2");
if (eworld.world.getPlayers().contains(player.player)) {
P.p.log("ASDs");
player.leave();
} }
} }
}
return true;
}
return false; return false;
} }
public static boolean isInvitedPlayer(String eworldname, String player) { public static boolean isInvitedPlayer(String eworldname, String player) {
EditWorld eworld = EditWorld.get(eworldname);
if (eworld != null) {
return eworld.invitedPlayers.contains(player.toLowerCase());
} else {
if (exist(eworldname)) { if (exist(eworldname)) {
DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml")); DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml"));
return config.getInvitedPlayers().contains(player.toLowerCase()); return config.getInvitedPlayers().contains(player.toLowerCase());
} }
}
return false; return false;

View File

@ -9,9 +9,9 @@ import java.io.OutputStream;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import net.milkbowl.vault.permission.Permission; import net.milkbowl.vault.permission.Permission;
import net.minecraft.server.v1_5_R2.EntityPlayer; import net.minecraft.server.v1_5_R3.EntityPlayer;
import net.minecraft.server.v1_5_R2.MinecraftServer; import net.minecraft.server.v1_5_R3.MinecraftServer;
import net.minecraft.server.v1_5_R2.PlayerInteractManager; import net.minecraft.server.v1_5_R3.PlayerInteractManager;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -20,8 +20,8 @@ import org.bukkit.Location;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_5_R2.CraftServer; import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
import org.bukkit.craftbukkit.v1_5_R2.CraftWorld; import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;