当前位置: 首页>>代码示例>>Java>>正文


Java VirtualTransform类代码示例

本文整理汇总了Java中fr.evercraft.everapi.server.location.VirtualTransform的典型用法代码示例。如果您正苦于以下问题:Java VirtualTransform类的具体用法?Java VirtualTransform怎么用?Java VirtualTransform使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VirtualTransform类属于fr.evercraft.everapi.server.location包,在下文中一共展示了VirtualTransform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addHome

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public boolean addHome(final String identifier, final Transform<World> location) {
	Preconditions.checkNotNull(identifier, "identifier");
	Preconditions.checkNotNull(location, "location");
	
	if (!this.homes.containsKey(identifier)) {
		final VirtualTransform locationSQL = new EVirtualTransform(this.plugin, location);
		this.homes.put(identifier, locationSQL);
		
		if (this.plugin.getManagerEvent().homeAdd(this.getUniqueId(), identifier, location)) {
			this.homes.remove(identifier);
		} else {
			this.plugin.getThreadAsync().execute(() -> this.plugin.getDataBases().addHome(this.getIdentifier(), identifier, locationSQL));
		}
		return true;
	}
	return false;
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:19,代码来源:EUserSubject.java

示例2: moveHome

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public boolean moveHome(final String identifier, final Transform<World> location) {
	Preconditions.checkNotNull(identifier, "identifier");
	Preconditions.checkNotNull(location, "location");
	
	VirtualTransform before_sql = this.homes.get(identifier);
	if (before_sql != null) {
		final VirtualTransform after_sql = new EVirtualTransform(this.plugin, location);
		this.homes.put(identifier, after_sql);
		
		if (this.plugin.getManagerEvent().homeMove(this.getUniqueId(), identifier, before_sql.getTransform(), location)) {
			this.homes.put(identifier, before_sql);
		} else {
			this.plugin.getThreadAsync().execute(() -> this.plugin.getDataBases().moveHome(this.getIdentifier(), identifier, after_sql));
			return true;
		}
	}
	return false;
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:20,代码来源:EUserSubject.java

示例3: removeHome

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public boolean removeHome(final String identifier) {
	Preconditions.checkNotNull(identifier, "identifier");
	
	VirtualTransform location = this.homes.get(identifier);
	if (location != null) {
		this.homes.remove(identifier);

		if (this.plugin.getManagerEvent().homeRemove(this.getUniqueId(), identifier, location.getTransform())) {
			this.homes.put(identifier, location);
		} else {
			this.plugin.getThreadAsync().execute(() -> this.plugin.getDataBases().removeHome(this.getIdentifier(), identifier));
			return true;
		}
	}
	return false;
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:18,代码来源:EUserSubject.java

示例4: ESpawnService

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
public ESpawnService(final EverEssentials plugin){
	this.plugin = plugin;
	
	this.subjects = new ConcurrentHashMap<String, VirtualTransform>();
	
	// MultiThreading
	this.lock = new ReentrantReadWriteLock();
	this.write_lock = this.lock.writeLock();
	this.read_lock = this.lock.readLock();
	
	this.reload();
	
	this.plugin.getEverAPI().getManagerService().getSpawn().register(SpawnSubjectService.Priorities.SPAWN, user -> {
		return this.getSpawn(user);
	});
	this.plugin.getEverAPI().getManagerService().getSpawn().register(SpawnSubjectService.Priorities.NEWBIE, user -> {
		if (!user.isSpawnNewbie()) return Optional.empty();
		
		Optional<VirtualTransform> spawn = this.getNewbie();
		if (!spawn.isPresent()) return Optional.empty();
		
		return spawn.get().getTransform();
	});
	
	this.plugin.getGame().getServiceManager().setProvider(this.plugin, SpawnSubjectService.class, this);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:27,代码来源:ESpawnService.java

示例5: getAll

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public Map<SubjectReference, Transform<World>> getAll() {
	this.read_lock.lock();
	try {
		ImmutableMap.Builder<SubjectReference, Transform<World>> spawns = ImmutableMap.builder();
		for (Entry<String, VirtualTransform> spawn : this.subjects.entrySet()) {
			Optional<Transform<World>> transform = spawn.getValue().getTransform();
			if (transform.isPresent()) {
				spawns.put(this.plugin.getEverAPI().getManagerService().getPermission().getGroupSubjects().newSubjectReference(spawn.getKey()), transform.get());
			}
		}
		return spawns.build();
	} finally {
		this.read_lock.unlock();
	}
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:17,代码来源:ESpawnService.java

示例6: add

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
public CompletableFuture<Boolean> add(final String identifier, final Transform<World> location) {
	final VirtualTransform locationVirtual = new EVirtualTransform(this.plugin, location);
	return this.addExecute(identifier, locationVirtual).thenApply(result -> {
		if (!result) return false;
		
		this.write_lock.lock();
		try {
			if (identifier.equalsIgnoreCase(SpawnSubjectService.DEFAULT)) {
				this.spawnDefault = locationVirtual;
			} else if (identifier.equalsIgnoreCase(SpawnSubjectService.NEWBIE)) {
				this.spawnNewbie = locationVirtual;
			} else {
				this.subjects.put(identifier, locationVirtual);
			}
		} finally {
			this.write_lock.unlock();
		}
		return true;
	});
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:21,代码来源:ESpawnService.java

示例7: update

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
public CompletableFuture<Boolean> update(final String identifier, final Transform<World> location) {
	final VirtualTransform locationVirtual = new EVirtualTransform(this.plugin, location);
	return this.updateExecute(identifier, locationVirtual).thenApply(result -> {
		if (!result) return false;
		
		this.write_lock.lock();
		try {
			if (identifier.equalsIgnoreCase(SpawnSubjectService.DEFAULT)) {
				this.spawnDefault = locationVirtual;
			} else if (identifier.equalsIgnoreCase(SpawnSubjectService.NEWBIE)) {
				this.spawnNewbie = locationVirtual;
			} else {
				this.subjects.put(identifier, locationVirtual);
			}
		} finally {
			this.write_lock.unlock();
		}
		return true;
	});
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:21,代码来源:ESpawnService.java

示例8: commandSetSpawn

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
private CompletableFuture<Boolean> commandSetSpawn(final EPlayer player, final Subject subject) {
	SpawnSubjectService service = this.plugin.getSpawn();
	Optional<VirtualTransform> group = service.get(subject.asSubjectReference());
	
	return service.set(subject.asSubjectReference(), player.getTransform())
		.exceptionally(e -> false)
		.thenApply(result -> {
			if (!result) {
				EAMessages.COMMAND_ERROR.sender()
					.prefix(EEMessages.PREFIX)
					.sendTo(player);
				return false;
			}
			
			if (group.isPresent()) {
				EEMessages.SETSPAWN_REPLACE.sender()
					.replace("{name}", this.getButtonSpawn(subject.getFriendlyIdentifier().orElse(subject.getIdentifier()), player.getLocation()))
					.sendTo(player);
			} else {
				EEMessages.SETSPAWN_NEW.sender()
				.replace("{name}", this.getButtonSpawn(subject.getFriendlyIdentifier().orElse(subject.getIdentifier()), player.getLocation()))
					.sendTo(player);
			}
			return true;
		});
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:27,代码来源:EESpawnSet.java

示例9: commandSetSpawnDefault

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
private CompletableFuture<Boolean> commandSetSpawnDefault(final EPlayer player) {
	SpawnSubjectService service = this.plugin.getSpawn();
	Optional<VirtualTransform> group = service.getDefault();
	
	return service.setDefault(player.getTransform())
		.exceptionally(e -> false)
		.thenApply(result -> {
			if (!result) {
				EAMessages.COMMAND_ERROR.sender()
					.prefix(EEMessages.PREFIX)
					.sendTo(player);
				return false;
			}
			
			if (group.isPresent()) {
				EEMessages.SETSPAWN_REPLACE.sender()
					.replace("{name}", this.getButtonSpawn(SpawnSubjectService.DEFAULT, player.getLocation()))
					.sendTo(player);
			} else {
				EEMessages.SETSPAWN_NEW.sender()
					.replace("{name}", this.getButtonSpawn(SpawnSubjectService.DEFAULT, player.getLocation()))
					.sendTo(player);
			}
			return true;
		});
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:27,代码来源:EESpawnSet.java

示例10: commandSetSpawnNewbie

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
private CompletableFuture<Boolean> commandSetSpawnNewbie(final EPlayer player) {
	SpawnSubjectService service = this.plugin.getSpawn();
	Optional<VirtualTransform> group = service.getDefault();
	
	return service.setNewbie(player.getTransform())
		.exceptionally(e -> false)
		.thenApply(result -> {
			if (!result) {
				EAMessages.COMMAND_ERROR.sender()
					.prefix(EEMessages.PREFIX)
					.sendTo(player);
				return false;
			}
			
			if (group.isPresent()) {
				EEMessages.SETSPAWN_REPLACE.sender()
					.replace("{name}", this.getButtonSpawn(SpawnSubjectService.NEWBIE, player.getLocation()))
					.sendTo(player);
			} else {
				EEMessages.SETSPAWN_NEW.sender()
					.replace("{name}", this.getButtonSpawn(SpawnSubjectService.NEWBIE, player.getLocation()))
					.sendTo(player);
			}
			return true;
		});
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:27,代码来源:EESpawnSet.java

示例11: serialize

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public String serialize(VirtualTransform value) {
	if (!(value instanceof EVirtualTransform)) {
		return value.getPosition().getX() + "," + value.getPosition().getY() + "," + value.getPosition().getZ();
	} else if (value.getWorldIdentifier().isEmpty()){
		return value.getPosition().getX() + "," + value.getPosition().getY() + "," + value.getPosition().getZ() + "," + value.getYaw() + "," + value.getPitch();
	} else {
		return value.getPosition().getX() + "," + value.getPosition().getY() + "," + value.getPosition().getZ() + "," + value.getYaw() + "," + value.getPitch() + "," + value.getWorldIdentifier();
	}
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:11,代码来源:LocationFlag.java

示例12: parseAdd

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public VirtualTransform parseAdd(CommandSource source, ProtectedRegion region, ProtectedRegion.Group group, List<String> values) throws IllegalArgumentException {
	String value = String.join(",", values.get(0));
	if (value.equalsIgnoreCase(HERE)) {
		if (source instanceof EPlayer) {
			return new EVirtualTransform(this.plugin, ((EPlayer) source).getTransform());
		} else {
			throw new IllegalArgumentException(EAMessages.COMMAND_ERROR_FOR_PLAYER.getString());
		}
	} else {
		return this.deserialize(value);
	}
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:14,代码来源:LocationFlag.java

示例13: getValueFormat

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public Text getValueFormat(VirtualTransform value) {
	List<Text> hover = new ArrayList<Text>();
	hover.add(EAMessages.FLAG_LOCATION_X.getFormat()
			.toText("{x}", Math.round(value.getPosition().getX())));
	hover.add(EAMessages.FLAG_LOCATION_Y.getFormat()
			.toText("{y}", Math.round(value.getPosition().getY())));
	hover.add(EAMessages.FLAG_LOCATION_Z.getFormat()
			.toText("{z}", Math.round(value.getPosition().getZ())));
	
	if (value instanceof EVirtualTransform) {
		hover.add(EAMessages.FLAG_LOCATION_YAW.getFormat()
				.toText("{yaw}", Math.round(value.getYaw())));
		hover.add(EAMessages.FLAG_LOCATION_PITCH.getFormat()
				.toText("{pitch}", Math.round(value.getPitch())));
	}
	
	if (value.getWorldName().isPresent()) {
		hover.add(EAMessages.FLAG_LOCATION_WORLD.getFormat()
				.toText("{world}", value.getWorldName().get()));
	}
	
	return EAMessages.FLAG_LOCATION.getFormat()
			.toText("{x}", Math.round(value.getPosition().getX()),
					"{y}", Math.round(value.getPosition().getY()),
					"{z}", Math.round(value.getPosition().getZ()))
			.toBuilder()
			.onHover(TextActions.showText(Text.joinWith(Text.of("\n"), hover)))
			.build();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:31,代码来源:LocationFlag.java

示例14: EUserSubject

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
public EUserSubject(final EverEssentials plugin, final UUID uuid) {
	Preconditions.checkNotNull(plugin, "plugin");
	Preconditions.checkNotNull(uuid, "uuid");
	
	this.plugin = plugin;
	this.identifier = uuid;
	
	this.homes = new ConcurrentHashMap<String, VirtualTransform>();
	this.ignores = new CopyOnWriteArraySet<UUID>();
	this.mails = new CopyOnWriteArraySet<Mail>();
	this.back = Optional.empty();
	
	this.god = false;
	this.vanish = false;
	this.toggle = true;
	this.freeze = false;
	this.last_ip = Optional.empty();
	
	// Tempo
	this.afk = false;
	this.updateLastActivated();
	
	this.afk_auto_fake = false;
	this.afk_kick_fake = false;
	
	this.last_played = Optional.empty();
			
	this.teleports = new LinkedHashMap<UUID, TeleportRequest>();
	this.teleport = Optional.empty();
	
	this.replyTo = Optional.empty();
	
	reloadData();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:35,代码来源:EUserSubject.java

示例15: getHomes

import fr.evercraft.everapi.server.location.VirtualTransform; //导入依赖的package包/类
@Override
public Map<String, Transform<World>> getHomes() {
	ImmutableMap.Builder<String, Transform<World>> homes = ImmutableMap.builder();
	for (Entry<String, VirtualTransform> home : this.homes.entrySet()) {
		Optional<Transform<World>> transform = home.getValue().getTransform();
		if (transform.isPresent()) {
			homes.put(home.getKey(), transform.get());
		}
	}
	return homes.build();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:12,代码来源:EUserSubject.java


注:本文中的fr.evercraft.everapi.server.location.VirtualTransform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。