Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FakePlayer {
- private MinecraftServer server;
- private WorldServer world;
- private UUID uuid;
- private GameProfile profile;
- private PlayerInteractManager manager;
- private EnumGamemode mode;
- private int ping;
- private EntityPlayer player;
- public FakePlayer(String name) {
- this.server = MinecraftServer.getServer();
- this.world = server.getWorldServer(0);
- this.uuid = UUID.randomUUID();
- this.profile = new GameProfile(uuid, name);
- this.manager = new PlayerInteractManager(world);
- this.mode = EnumGamemode.SURVIVAL;
- this.ping = 0;
- }
- public FakePlayer withName(String name) {
- this.profile = new GameProfile(this.profile.getId(), name);
- return this;
- }
- public FakePlayer withUniqueId(UUID id) {
- this.uuid = id;
- this.profile = new GameProfile(uuid, this.profile.getName());
- return this;
- }
- public FakePlayer withGameMode(EnumGamemode mode) {
- this.mode = mode;
- return this;
- }
- public FakePlayer withPing(int ping) {
- this.ping = ping;
- return this;
- }
- public FakePlayer create() {
- this.player = new EntityPlayer(this.server, this.world, this.profile, this.manager);
- this.player.a(this.mode);
- this.player.ping = this.ping;
- return this.player;
- }
- }
Add Comment
Please, Sign In to add comment