mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-12-01 06:53:26 +01:00
commit
ab139fdec9
@ -287,12 +287,14 @@ public class DConfig {
|
||||
return tmpInvitedPlayers;
|
||||
}
|
||||
|
||||
public void addInvitedPlayer(String player) {
|
||||
this.invitedPlayers.add(player);
|
||||
public void addInvitedPlayer(String uuid) {
|
||||
this.invitedPlayers.add(uuid);
|
||||
}
|
||||
|
||||
public void removeInvitedPlayers(String player) {
|
||||
this.invitedPlayers.remove(player);
|
||||
public void removeInvitedPlayers(String uuid, String name) {
|
||||
this.invitedPlayers.remove(uuid);
|
||||
// remove player from a 0.9.1 and lower file
|
||||
this.invitedPlayers.remove(name);
|
||||
}
|
||||
|
||||
public CopyOnWriteArrayList<Material> getSecureObjects() {
|
||||
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
@ -117,10 +118,10 @@ public class DGSign {
|
||||
for (yy = y; yy > y - verticalSigns; yy--) {
|
||||
for (xx = x; xx > x - maxGroups; xx--) {
|
||||
Block block = world.getBlockAt(xx, yy, zz);
|
||||
if (block.getTypeId() != 0 && block.getTypeId() != 68) {
|
||||
if (block.getType() != Material.AIR && block.getType() != Material.WALL_SIGN) {
|
||||
return null;
|
||||
}
|
||||
if (block.getRelative(0, 0, 1).getTypeId() == 0) {
|
||||
if (block.getRelative(0, 0, 1).getType() == Material.AIR) {
|
||||
return null;
|
||||
}
|
||||
changeBlocks.add(block);
|
||||
@ -133,10 +134,10 @@ public class DGSign {
|
||||
for (xx = x; xx < x + maxGroups; xx++) {
|
||||
|
||||
Block block = world.getBlockAt(xx, yy, zz);
|
||||
if (block.getTypeId() != 0 && block.getTypeId() != 68) {
|
||||
if (block.getType() != Material.AIR && block.getType() != Material.WALL_SIGN) {
|
||||
return null;
|
||||
}
|
||||
if (block.getRelative(0, 0, -1).getTypeId() == 0) {
|
||||
if (block.getRelative(0, 0, -1).getType() == Material.AIR) {
|
||||
return null;
|
||||
}
|
||||
changeBlocks.add(block);
|
||||
@ -148,10 +149,10 @@ public class DGSign {
|
||||
for (yy = y; yy > y - verticalSigns; yy--) {
|
||||
for (zz = z; zz < z + maxGroups; zz++) {
|
||||
Block block = world.getBlockAt(xx, yy, zz);
|
||||
if (block.getTypeId() != 0 && block.getTypeId() != 68) {
|
||||
if (block.getType() != Material.AIR && block.getType() != Material.WALL_SIGN) {
|
||||
return null;
|
||||
}
|
||||
if (block.getRelative(1, 0, 0).getTypeId() == 0) {
|
||||
if (block.getRelative(1, 0, 0).getType() == Material.AIR) {
|
||||
return null;
|
||||
}
|
||||
changeBlocks.add(block);
|
||||
@ -163,10 +164,10 @@ public class DGSign {
|
||||
for (yy = y; yy > y - verticalSigns; yy--) {
|
||||
for (zz = z; zz > z - maxGroups; zz--) {
|
||||
Block block = world.getBlockAt(xx, yy, zz);
|
||||
if (block.getTypeId() != 0 && block.getTypeId() != 68) {
|
||||
if (block.getType() != Material.AIR && block.getType() != Material.WALL_SIGN) {
|
||||
return null;
|
||||
}
|
||||
if (block.getRelative(-1, 0, 0).getTypeId() == 0) {
|
||||
if (block.getRelative(-1, 0, 0).getType() == Material.AIR) {
|
||||
return null;
|
||||
}
|
||||
changeBlocks.add(block);
|
||||
@ -200,7 +201,7 @@ public class DGSign {
|
||||
}
|
||||
|
||||
public static DGSign getSign(Block block) {
|
||||
if (block.getTypeId() == 68) {
|
||||
if (block.getType() == Material.WALL_SIGN) {
|
||||
int x = block.getX(), y = block.getY(), z = block.getZ();
|
||||
for (DGSign dgsign : dgsigns) {
|
||||
int sx1 = dgsign.startSign.getX(), sy1 = dgsign.startSign.getY(), sz1 = dgsign.startSign.getZ();
|
||||
|
@ -156,7 +156,7 @@ public class DPlayer {
|
||||
if (gworld.isTutorial) {
|
||||
p.permission.playerAddGroup(this.player, p.mainConfig.tutorialEndGroup);
|
||||
p.permission.playerRemoveGroup(this.player, p.mainConfig.tutorialStartGroup);
|
||||
p.getServer().dispatchCommand(p.getServer().getConsoleSender(), "pex user "+player.getName()+" group set "+p.mainConfig.tutorialEndGroup);
|
||||
p.getServer().dispatchCommand(p.getServer().getConsoleSender(), "pex user "+player.getName()+" group set "+p.mainConfig.tutorialEndGroup);//TODO: Use Vault for this!
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ public class DPlayer {
|
||||
p.msg(player, p.language.get("Player_SignCopied"));
|
||||
}
|
||||
} else {
|
||||
String info = "" + block.getTypeId();
|
||||
String info = "" + block.getType();
|
||||
if (block.getData() != 0) {
|
||||
info = info + "," + block.getData();
|
||||
}
|
||||
@ -327,7 +327,7 @@ public class DPlayer {
|
||||
/* Delete Inventory */
|
||||
this.player.getInventory().clear();
|
||||
this.player.getInventory().setArmorContents(null);
|
||||
player.getInventory().setItemInHand(new ItemStack(0));
|
||||
player.getInventory().setItemInHand(new ItemStack(Material.AIR));
|
||||
|
||||
// Remove Potion Effects
|
||||
for (PotionEffect effect : this.player.getActivePotionEffects()) {
|
||||
@ -342,19 +342,23 @@ public class DPlayer {
|
||||
for (ItemStack istack : dclass.items) {
|
||||
|
||||
// Leggings
|
||||
if (istack.getTypeId() == 300 || istack.getTypeId() == 304 || istack.getTypeId() == 308 || istack.getTypeId() == 312 || istack.getTypeId() == 316) {
|
||||
if (istack.getType() == Material.LEATHER_LEGGINGS || istack.getType() == Material.CHAINMAIL_LEGGINGS || istack.getType() == Material.IRON_LEGGINGS
|
||||
|| istack.getType() == Material.DIAMOND_LEGGINGS || istack.getType() == Material.GOLD_LEGGINGS) {
|
||||
this.player.getInventory().setLeggings(istack);
|
||||
}
|
||||
// Helmet
|
||||
else if (istack.getTypeId() == 298 || istack.getTypeId() == 302 || istack.getTypeId() == 306 || istack.getTypeId() == 310 || istack.getTypeId() == 314) {
|
||||
else if (istack.getType() == Material.LEATHER_HELMET || istack.getType() == Material.CHAINMAIL_HELMET || istack.getType() == Material.IRON_HELMET
|
||||
|| istack.getType() == Material.DIAMOND_HELMET || istack.getType() == Material.GOLD_HELMET) {
|
||||
this.player.getInventory().setHelmet(istack);
|
||||
}
|
||||
// Chestplate
|
||||
else if (istack.getTypeId() == 299 || istack.getTypeId() == 303 || istack.getTypeId() == 307 || istack.getTypeId() == 311 || istack.getTypeId() == 315) {
|
||||
else if (istack.getType() == Material.LEATHER_CHESTPLATE || istack.getType() == Material.CHAINMAIL_CHESTPLATE || istack.getType() == Material.IRON_CHESTPLATE
|
||||
|| istack.getType() == Material.DIAMOND_CHESTPLATE || istack.getType() == Material.GOLD_CHESTPLATE) {
|
||||
this.player.getInventory().setChestplate(istack);
|
||||
}
|
||||
// Boots
|
||||
else if (istack.getTypeId() == 301 || istack.getTypeId() == 305 || istack.getTypeId() == 309 || istack.getTypeId() == 313 || istack.getTypeId() == 317) {
|
||||
else if (istack.getType() == Material.LEATHER_BOOTS || istack.getType() == Material.CHAINMAIL_BOOTS || istack.getType() == Material.IRON_BOOTS
|
||||
|| istack.getType() == Material.DIAMOND_BOOTS || istack.getType() == Material.GOLD_BOOTS) {
|
||||
this.player.getInventory().setBoots(istack);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.dre.dungeonsxl;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
@ -55,10 +56,12 @@ public class DPortal {
|
||||
do {
|
||||
int zz = z1;
|
||||
do {
|
||||
int typeId = this.world.getBlockAt(xx, yy, zz).getType().getId();
|
||||
if (typeId == 0 || typeId == 8 || typeId == 9 || typeId == 10 || typeId == 11 || typeId == 6 || typeId == 30 || typeId == 31 || typeId == 32 || typeId == 34 || typeId == 37
|
||||
|| typeId == 38 || typeId == 39 || typeId == 40 || typeId == 50 || typeId == 51 || typeId == 59 || typeId == 55 || typeId == 75 || typeId == 78 || typeId == 76) {
|
||||
this.world.getBlockAt(xx, yy, zz).setTypeId(90);
|
||||
Material type = this.world.getBlockAt(xx, yy, zz).getType();
|
||||
if (type == Material.AIR || type == Material.WATER || type == Material.STATIONARY_WATER || type == Material.LAVA || type == Material.STATIONARY_LAVA || type == Material.SAPLING
|
||||
|| type == Material.WEB || type == Material.LONG_GRASS || type == Material.DEAD_BUSH || type == Material.PISTON_EXTENSION || type == Material.YELLOW_FLOWER
|
||||
|| type == Material.RED_ROSE || type == Material.BROWN_MUSHROOM || type == Material.RED_MUSHROOM || type == Material.TORCH || type == Material.FIRE
|
||||
|| type == Material.CROPS || type == Material.REDSTONE_WIRE || type == Material.REDSTONE_TORCH_OFF || type == Material.SNOW || type == Material.REDSTONE_TORCH_ON) {
|
||||
this.world.getBlockAt(xx, yy, zz).setType(Material.PORTAL);
|
||||
}
|
||||
|
||||
zz = zz + zcount;
|
||||
@ -117,10 +120,10 @@ public class DPortal {
|
||||
do {
|
||||
int zz = z1;
|
||||
do {
|
||||
int typeId = this.world.getBlockAt(xx, yy, zz).getType().getId();
|
||||
Material type = this.world.getBlockAt(xx, yy, zz).getType();
|
||||
|
||||
if (typeId == 90) {
|
||||
this.world.getBlockAt(xx, yy, zz).setTypeId(0);
|
||||
if (type == Material.PORTAL) {
|
||||
this.world.getBlockAt(xx, yy, zz).setType(Material.AIR);
|
||||
}
|
||||
|
||||
zz = zz + zcount;
|
||||
|
@ -7,6 +7,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -222,10 +223,10 @@ public class EditWorld {
|
||||
}
|
||||
|
||||
// Invite
|
||||
public static boolean addInvitedPlayer(String eworldname, String player) {
|
||||
public static boolean addInvitedPlayer(String eworldname, UUID uuid) {
|
||||
if (exist(eworldname)) {
|
||||
DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml"));
|
||||
config.addInvitedPlayer(player.toLowerCase());
|
||||
config.addInvitedPlayer(uuid.toString());
|
||||
config.save();
|
||||
return true;
|
||||
}
|
||||
@ -233,11 +234,11 @@ public class EditWorld {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean removeInvitedPlayer(String eworldname, String name) {
|
||||
public static boolean removeInvitedPlayer(String eworldname, UUID uuid, String name) {
|
||||
|
||||
if (exist(eworldname)) {
|
||||
DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml"));
|
||||
config.removeInvitedPlayers(name.toLowerCase());
|
||||
config.removeInvitedPlayers(uuid.toString(), name.toLowerCase());
|
||||
config.save();
|
||||
|
||||
// Kick Player
|
||||
@ -258,10 +259,12 @@ public class EditWorld {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isInvitedPlayer(String eworldname, String player) {
|
||||
public static boolean isInvitedPlayer(String eworldname, UUID uuid, String name) {
|
||||
if (exist(eworldname)) {
|
||||
DConfig config = new DConfig(new File(p.getDataFolder() + "/dungeons/" + eworldname, "config.yml"));
|
||||
return config.getInvitedPlayers().contains(player.toLowerCase());
|
||||
// get player from both a 0.9.1 and lower and 0.9.2 and higher file
|
||||
if (config.getInvitedPlayers().contains(name.toLowerCase()) || config.getInvitedPlayers().contains(uuid.toString()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -3,6 +3,7 @@ package com.dre.dungeonsxl;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
@ -67,7 +68,7 @@ public class LeaveSign {
|
||||
}
|
||||
|
||||
public static LeaveSign getSign(Block block) {
|
||||
if (block.getTypeId() == 68 || block.getTypeId() == 63) {
|
||||
if (block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) {
|
||||
for (LeaveSign leavesign : lsigns) {
|
||||
if (block.getWorld() == leavesign.sign.getWorld()) {
|
||||
if (block.getLocation().distance(leavesign.sign.getBlock().getLocation()) < 1) {
|
||||
|
@ -12,11 +12,6 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R3.PlayerInteractManager;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -25,8 +20,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -43,6 +36,7 @@ import com.dre.dungeonsxl.listener.EntityListener;
|
||||
import com.dre.dungeonsxl.listener.HangingListener;
|
||||
import com.dre.dungeonsxl.listener.PlayerListener;
|
||||
import com.dre.dungeonsxl.listener.WorldListener;
|
||||
import com.dre.dungeonsxl.multiversionhandler.MultiVersionHandler;
|
||||
|
||||
public class P extends JavaPlugin {
|
||||
public static P p;
|
||||
@ -118,6 +112,9 @@ public class P extends JavaPlugin {
|
||||
|
||||
// MSG
|
||||
this.log(this.getDescription().getName() + " enabled!");
|
||||
if (!(MultiVersionHandler.supported.contains(MultiVersionHandler.getInternals()))) {
|
||||
this.log("Warning: Your CraftBukkit version is deprecated. DungeonsXL does not support it.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -434,59 +431,11 @@ public class P extends JavaPlugin {
|
||||
}
|
||||
|
||||
public Player getOfflinePlayer(String player, UUID uuid) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
return MultiVersionHandler.getOfflinePlayer(player, uuid);
|
||||
}
|
||||
|
||||
public Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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.world = ((CraftWorld) location.getWorld()).getHandle();
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
// target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
return MultiVersionHandler.getOfflinePlayer(player, uuid, location);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -25,7 +25,7 @@ public class CMDEdit extends DCommand {
|
||||
DGroup dgroup = DGroup.get(player);
|
||||
DPlayer dplayer = DPlayer.get(player);
|
||||
|
||||
if (EditWorld.isInvitedPlayer(dungeonName, player.getName()) || p.permission.has(player, "dxl.edit") || player.isOp()) {
|
||||
if (EditWorld.isInvitedPlayer(dungeonName, player.getUniqueId(), player.getName()) || p.permission.has(player, "dxl.edit") || player.isOp()) {
|
||||
if (dplayer == null) {
|
||||
if (dgroup == null) {
|
||||
if (eworld != null) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.dre.dungeonsxl.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.dre.dungeonsxl.EditWorld;
|
||||
import com.dre.dungeonsxl.util.OfflinePlayerUtil;
|
||||
|
||||
public class CMDInvite extends DCommand {
|
||||
|
||||
@ -16,7 +18,7 @@ public class CMDInvite extends DCommand {
|
||||
|
||||
@Override
|
||||
public void onExecute(String[] args, CommandSender sender) {
|
||||
if (EditWorld.addInvitedPlayer(args[2], args[1])) {
|
||||
if (EditWorld.addInvitedPlayer(args[2], OfflinePlayerUtil.getUniqueIdFromName(args[1]))) {
|
||||
p.msg(sender, p.language.get("Cmd_Invite_Success", args[1], args[2]));
|
||||
} else {
|
||||
p.msg(sender, p.language.get("Error_DungeonNotExist", args[2]));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.dre.dungeonsxl.commands;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -27,7 +28,7 @@ public class CMDPortal extends DCommand {
|
||||
dportal = new DPortal(false);
|
||||
dportal.player = player;
|
||||
dportal.world = player.getWorld();
|
||||
player.getInventory().setItemInHand(new ItemStack(268));
|
||||
player.getInventory().setItemInHand(new ItemStack(Material.WOOD_SWORD));
|
||||
p.msg(player, p.language.get("Player_PortalIntroduction"));
|
||||
} else {
|
||||
DPortal.portals.remove(dportal);
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.dre.dungeonsxl.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.dre.dungeonsxl.EditWorld;
|
||||
import com.dre.dungeonsxl.util.OfflinePlayerUtil;
|
||||
|
||||
public class CMDUninvite extends DCommand {
|
||||
|
||||
@ -16,7 +18,7 @@ public class CMDUninvite extends DCommand {
|
||||
|
||||
@Override
|
||||
public void onExecute(String[] args, CommandSender sender) {
|
||||
if (EditWorld.removeInvitedPlayer(args[2], args[1])) {
|
||||
if (EditWorld.removeInvitedPlayer(args[2], OfflinePlayerUtil.getUniqueIdFromName(args[1]), args[1])) {
|
||||
p.msg(sender, p.language.get("Cmd_Uninvite_Success", args[1], args[2]));
|
||||
} else {
|
||||
p.msg(sender, p.language.get("Error_DungeonNotExist", args[2]));
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -29,7 +30,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
if (event.getBlock().getTypeId() == 90) {
|
||||
if (event.getBlock().getType() == Material.PORTAL) {
|
||||
if (DPortal.get(event.getBlock()) != null) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -41,7 +42,7 @@ public class BlockListener implements Listener {
|
||||
Block block = event.getBlock();
|
||||
|
||||
// Deny DPortal destroying
|
||||
if (block.getTypeId() == 90) {
|
||||
if (block.getType() == Material.PORTAL) {
|
||||
if (DPortal.get(event.getBlock()) != null) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -172,7 +173,7 @@ public class BlockListener implements Listener {
|
||||
public void onBlockSpread(BlockSpreadEvent event) {
|
||||
Block block = event.getBlock();
|
||||
// Block the Spread off Vines
|
||||
if (block.getTypeId() == 106) {
|
||||
if (block.getType() == Material.VINE) {
|
||||
// Check GameWorlds
|
||||
GameWorld gworld = GameWorld.get(event.getBlock().getWorld());
|
||||
if (gworld != null) {
|
||||
|
@ -2,6 +2,7 @@ package com.dre.dungeonsxl.listener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -36,7 +37,7 @@ public class EntityListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
if (GameWorld.get(event.getLocation().getWorld()) != null) {
|
||||
if (event.getEntity().getItemStack().getTypeId() == 323) {
|
||||
if (event.getEntity().getItemStack().getType() == Material.SIGN) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -189,7 +190,7 @@ public class EntityListener implements Listener {
|
||||
List<Block> blocklist = event.blockList();
|
||||
for (Block block : blocklist) {
|
||||
// Portals
|
||||
if (block.getTypeId() == 90) {
|
||||
if (block.getType() == Material.PORTAL) {
|
||||
if (DPortal.get(block) != null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -197,7 +198,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
// Signs
|
||||
if (block.getTypeId() == 68 || block.getTypeId() == 63) {
|
||||
if (block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) {
|
||||
if (DGSign.getSign(block) != null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -143,7 +143,7 @@ public class PlayerListener implements Listener {
|
||||
// Check Signs
|
||||
if (clickedBlock != null) {
|
||||
|
||||
if (clickedBlock.getTypeId() == 68 || clickedBlock.getTypeId() == 63) {
|
||||
if (clickedBlock.getType() == Material.WALL_SIGN || clickedBlock.getType() == Material.SIGN_POST) {
|
||||
// Check Group Signs
|
||||
if (DGSign.playerInteract(event.getClickedBlock(), player)) {
|
||||
event.setCancelled(true);
|
||||
@ -386,7 +386,7 @@ public class PlayerListener implements Listener {
|
||||
dplayer.respawnArmor = event.getEntity().getInventory().getArmorContents();
|
||||
// Delete all drops
|
||||
for (ItemStack istack : event.getDrops()) {
|
||||
istack.setTypeId(0);
|
||||
istack.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
package com.dre.dungeonsxl.multiversionhandler;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.dre.dungeonsxl.P;
|
||||
|
||||
public class MultiVersionHandler {
|
||||
|
||||
private static String version = P.p.getServer().getVersion();
|
||||
|
||||
public static String supported = "v1_8_R1,v1_8_R2,v1_8_R3";
|
||||
|
||||
public static String getInternals() {
|
||||
String internals = "v1_8_R3";
|
||||
if (version.contains("1.8.4") || version.contains("1.8.5") || version.contains("1.8.6") || version.contains("1.8.7")) {
|
||||
internals = "v1_8_R3";
|
||||
} else if (version.contains("1.8.3")) {
|
||||
internals = "v1_8_R2";
|
||||
} else if (version.contains("1.8") && !version.contains("1.8.")) {
|
||||
internals = "v1_8_R1";
|
||||
} else if (version.contains("1.7.10")) {
|
||||
internals = "v1_7_R4";
|
||||
} else if (version.contains("1.7.8") || version.contains("1.7.9")) {
|
||||
internals = "v1_7_R3";
|
||||
}
|
||||
return internals;
|
||||
}
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
||||
Player pplayer = null;
|
||||
if (getInternals().equals("v1_8_R3")) {
|
||||
pplayer = v1_8_R3.getOfflinePlayer(player, uuid);
|
||||
} else if (getInternals().equals("v1_8_R2")) {
|
||||
pplayer = v1_8_R2.getOfflinePlayer(player, uuid);
|
||||
} else if (getInternals().equals("v1_8_R1")) {
|
||||
pplayer = v1_8_R1.getOfflinePlayer(player, uuid);
|
||||
} else if (getInternals().equals("v1_8_R2")) {
|
||||
pplayer = v1_8_R1.getOfflinePlayer(player, uuid);
|
||||
} else if (getInternals().equals("v1_7_R4")) {
|
||||
pplayer = v1_7_R4.getOfflinePlayer(player, uuid);
|
||||
} else if (getInternals().equals("v1_7_R3")) {
|
||||
pplayer = v1_7_R3.getOfflinePlayer(player, uuid);
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
||||
Player pplayer = null;
|
||||
if (getInternals().equals("v1_8_R3")) {
|
||||
pplayer = v1_8_R3.getOfflinePlayer(player, uuid, location);
|
||||
} else if (getInternals().equals("v1_8_R2")) {
|
||||
pplayer = v1_8_R2.getOfflinePlayer(player, uuid, location);
|
||||
} else if (getInternals().equals("v1_8_R1")) {
|
||||
pplayer = v1_8_R1.getOfflinePlayer(player, uuid, location);
|
||||
} else if (getInternals().equals("v1_8_R2")) {
|
||||
pplayer = v1_8_R1.getOfflinePlayer(player, uuid, location);
|
||||
} else if (getInternals().equals("v1_7_R4")) {
|
||||
pplayer = v1_7_R4.getOfflinePlayer(player, uuid, location);
|
||||
} else if (getInternals().equals("v1_7_R3")) {
|
||||
pplayer = v1_7_R3.getOfflinePlayer(player, uuid, location);
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
}
|
75
src/com/dre/dungeonsxl/multiversionhandler/v1_7_R3.java
Normal file
75
src/com/dre/dungeonsxl/multiversionhandler/v1_7_R3.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.dre.dungeonsxl.multiversionhandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_7_R3.PlayerInteractManager;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
public class v1_7_R3 {
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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.world = ((CraftWorld) location.getWorld()).getHandle();
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
// target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
}
|
75
src/com/dre/dungeonsxl/multiversionhandler/v1_7_R4.java
Normal file
75
src/com/dre/dungeonsxl/multiversionhandler/v1_7_R4.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.dre.dungeonsxl.multiversionhandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
||||
import net.minecraft.server.v1_7_R4.PlayerInteractManager;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
public class v1_7_R4 {
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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.world = ((CraftWorld) location.getWorld()).getHandle();
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
// target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
}
|
76
src/com/dre/dungeonsxl/multiversionhandler/v1_8_R1.java
Normal file
76
src/com/dre/dungeonsxl/multiversionhandler/v1_8_R1.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.dre.dungeonsxl.multiversionhandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.server.v1_8_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R1.PlayerInteractManager;
|
||||
|
||||
public class v1_8_R1 {
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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.world = ((CraftWorld) location.getWorld()).getHandle();
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
// target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
}
|
76
src/com/dre/dungeonsxl/multiversionhandler/v1_8_R2.java
Normal file
76
src/com/dre/dungeonsxl/multiversionhandler/v1_8_R2.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.dre.dungeonsxl.multiversionhandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.server.v1_8_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R2.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R2.PlayerInteractManager;
|
||||
|
||||
public class v1_8_R2 {
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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.world = ((CraftWorld) location.getWorld()).getHandle();
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
// target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
}
|
76
src/com/dre/dungeonsxl/multiversionhandler/v1_8_R3.java
Normal file
76
src/com/dre/dungeonsxl/multiversionhandler/v1_8_R3.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.dre.dungeonsxl.multiversionhandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R3.PlayerInteractManager;
|
||||
|
||||
public class v1_8_R3 {
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
public static Player getOfflinePlayer(String player, UUID uuid, Location location) {
|
||||
Player pplayer = null;
|
||||
try {
|
||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "players");
|
||||
|
||||
for (File playerfile : playerfolder.listFiles()) {
|
||||
String filename = playerfile.getName();
|
||||
String playername = filename.substring(0, filename.length() - 4);
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, playername);
|
||||
|
||||
if (playername.trim().equalsIgnoreCase(player)) {
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
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.world = ((CraftWorld) location.getWorld()).getHandle();
|
||||
Player target = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
if (target != null) {
|
||||
// target.loadData();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return pplayer;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -31,7 +33,7 @@ public class SIGNCheckpoint extends DSign {
|
||||
|
||||
@Override
|
||||
public void onInit() {
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import com.dre.dungeonsxl.game.GameChest;
|
||||
@ -25,18 +26,18 @@ public class SIGNChest extends DSign {
|
||||
@Override
|
||||
public void onInit() {
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
if (sign.getBlock().getRelative(i, 0, 0).getTypeId() == 54) {
|
||||
if (sign.getBlock().getRelative(i, 0, 0).getType() == Material.CHEST) {
|
||||
new GameChest(sign.getBlock().getRelative(i, 0, 0), gworld);
|
||||
}
|
||||
if (sign.getBlock().getRelative(0, 0, i).getTypeId() == 54) {
|
||||
if (sign.getBlock().getRelative(0, 0, i).getType() == Material.CHEST) {
|
||||
new GameChest(sign.getBlock().getRelative(0, 0, i), gworld);
|
||||
}
|
||||
if (sign.getBlock().getRelative(0, i, 0).getTypeId() == 54) {
|
||||
if (sign.getBlock().getRelative(0, i, 0).getType() == Material.CHEST) {
|
||||
new GameChest(sign.getBlock().getRelative(0, i, 0), gworld);
|
||||
}
|
||||
}
|
||||
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import com.dre.dungeonsxl.game.GameWorld;
|
||||
|
||||
public class SIGNChunkUpdater extends DSign {
|
||||
@ -38,7 +40,7 @@ public class SIGNChunkUpdater extends DSign {
|
||||
chunk.load();
|
||||
gworld.loadedChunks.add(chunk);
|
||||
}
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
@ -47,7 +48,7 @@ public class SIGNClasses extends DSign {
|
||||
if (isContinued) {
|
||||
Block classBlock = sign.getBlock().getRelative(xx, 0, zz);
|
||||
|
||||
if (classBlock.getData() == sign.getData().getData() && classBlock.getTypeId() == 68 && (classBlock.getState() instanceof Sign)) {
|
||||
if (classBlock.getData() == sign.getData().getData() && classBlock.getType() == Material.WALL_SIGN && (classBlock.getState() instanceof Sign)) {
|
||||
Sign classSign = (Sign) classBlock.getState();
|
||||
|
||||
classSign.setLine(0, ChatColor.DARK_BLUE + "############");
|
||||
@ -66,7 +67,7 @@ public class SIGNClasses extends DSign {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -39,7 +40,7 @@ public class SIGNEnd extends DSign {
|
||||
sign.setLine(3, ChatColor.DARK_BLUE + "############");
|
||||
sign.update();
|
||||
} else {
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -39,7 +40,7 @@ public class SIGNLeave extends DSign {
|
||||
sign.setLine(3, ChatColor.DARK_BLUE + "############");
|
||||
sign.update();
|
||||
} else {
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import com.dre.dungeonsxl.game.GameWorld;
|
||||
|
||||
public class SIGNLobby extends DSign {
|
||||
@ -23,7 +25,7 @@ public class SIGNLobby extends DSign {
|
||||
@Override
|
||||
public void onInit() {
|
||||
gworld.locLobby = sign.getLocation();
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +62,7 @@ public class SIGNMob extends DSign {
|
||||
}
|
||||
}
|
||||
}
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
@ -2,8 +2,10 @@ package com.dre.dungeonsxl.signs;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.dre.dungeonsxl.game.GameWorld;
|
||||
|
||||
public class SIGNMsg extends DSign {
|
||||
@ -38,7 +40,7 @@ public class SIGNMsg extends DSign {
|
||||
String msg = gworld.config.getMsg(p.parseInt(lines[1]), true);
|
||||
if (msg != null) {
|
||||
this.msg = msg;
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import com.dre.dungeonsxl.game.GamePlaceableBlock;
|
||||
@ -24,7 +25,7 @@ public class SIGNPlace extends DSign {
|
||||
public void onInit() {
|
||||
String lines[] = sign.getLines();
|
||||
gworld.placeableBlocks.add(new GamePlaceableBlock(sign.getBlock(), lines[1], lines[2]));
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -40,7 +41,7 @@ public class SIGNReady extends DSign {
|
||||
sign.setLine(3, ChatColor.DARK_BLUE + "############");
|
||||
sign.update();
|
||||
} else {
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
@ -62,7 +63,7 @@ public class SIGNRedstone extends DSign {
|
||||
}
|
||||
|
||||
this.block = sign.getBlock();
|
||||
this.block.setTypeId(0);
|
||||
this.block.setType(Material.AIR);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
@ -98,11 +99,11 @@ public class SIGNRedstone extends DSign {
|
||||
}
|
||||
|
||||
public void power() {
|
||||
block.setTypeId(152);
|
||||
block.setType(Material.REDSTONE_BLOCK);
|
||||
}
|
||||
|
||||
public void unpower() {
|
||||
block.setTypeId(0);
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
public void disableTask(int taskId) {
|
||||
|
@ -2,10 +2,10 @@ package com.dre.dungeonsxl.signs;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.dre.dungeonsxl.P;
|
||||
import com.dre.dungeonsxl.game.GameWorld;
|
||||
|
||||
public class SIGNSoundMsg extends DSign {
|
||||
@ -40,7 +40,7 @@ public class SIGNSoundMsg extends DSign {
|
||||
String msg = gworld.config.getMsg(p.parseInt(lines[1]), true);
|
||||
if (msg != null) {
|
||||
this.msg = msg;
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.dre.dungeonsxl.signs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import com.dre.dungeonsxl.game.GameWorld;
|
||||
|
||||
public class SIGNStart extends DSign {
|
||||
@ -23,7 +25,7 @@ public class SIGNStart extends DSign {
|
||||
@Override
|
||||
public void onInit() {
|
||||
gworld.locStart = sign.getLocation();
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package com.dre.dungeonsxl.signs;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
@ -64,7 +65,7 @@ public class SIGNTrigger extends DSign {
|
||||
@Override
|
||||
public void onInit() {
|
||||
triggerId = p.parseInt(sign.getLine(1));
|
||||
sign.getBlock().setTypeId(0);
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
17
src/com/dre/dungeonsxl/util/OfflinePlayerUtil.java
Normal file
17
src/com/dre/dungeonsxl/util/OfflinePlayerUtil.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.dre.dungeonsxl.util;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
public class OfflinePlayerUtil {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static UUID getUniqueIdFromName(String name) {
|
||||
OfflinePlayer player = Bukkit.getServer().getOfflinePlayer(name);
|
||||
UUID uuid = player.getUniqueId();
|
||||
return uuid;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
name: DungeonsXL
|
||||
main: com.dre.dungeonsxl.P
|
||||
version: 0.9.1
|
||||
version: 0.9.3
|
||||
author: Frank Baumann
|
||||
authors: [Frank Baumann, Milan Albrecht, Tobias Schmitz, Daniel Saukel]
|
||||
website: http://www.dre2n.ml
|
||||
|
Loading…
Reference in New Issue
Block a user