mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-09 20:31:28 +01:00
NMS handler
Works with v1_7_R3 - v1_8_R3.
This commit is contained in:
parent
fa17562a09
commit
0faa6df7ef
@ -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);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -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,6 @@
|
||||
name: DungeonsXL
|
||||
main: com.dre.dungeonsxl.P
|
||||
version: 0.9.2-SNAPSHOT
|
||||
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