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


Java EAMessages类代码示例

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


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

示例1: commandItemLoreClear

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
private CompletableFuture<Boolean> commandItemLoreClear(final EPlayer player) {
	if(!player.getItemInHand(HandTypes.MAIN_HAND).isPresent()) {
		EAMessages.EMPTY_ITEM_IN_HAND.sender()
			.prefix(EEMessages.PREFIX)
			.sendTo(player);
		return CompletableFuture.completedFuture(false);
	}
	
	ItemStack item = player.getItemInMainHand().get();
	if(!item.get(Keys.ITEM_LORE).isPresent()) {
		EEMessages.ITEM_LORE_CLEAR_ERROR.sender()
			.replace("{item}", EChat.getButtomItem(item, EEMessages.ITEM_LORE_CLEAR_COLOR.getColor()))
			.sendTo(player);
	}
	
	EEMessages.ITEM_LORE_CLEAR_NAME.sender()
		.replace("{item}", EChat.getButtomItem(item, EEMessages.ITEM_LORE_CLEAR_COLOR.getColor()))
		.sendTo(player);
	
	item.remove(Keys.ITEM_LORE);
	player.setItemInHand(HandTypes.MAIN_HAND, item);
	return CompletableFuture.completedFuture(true);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:24,代码来源:EEItemLoreClear.java

示例2: processPlayer

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
private void processPlayer(final Player source, final String arg, final List<String> args) throws CommandException, PluginDisableException, ServerDisableException, EMessageException {
	EPlayer player = this.plugin.getEServer().getEPlayer(source);
	if (player.isDead()) {
		EAMessages.COMMAND_ERROR_PLAYER_DEAD.sender()
			.prefix(this.plugin.getMessages().getPrefix())
			.sendTo(source);
	}
	
	if (!this.plugin.getGame().getEventManager().post(ESpongeEventFactory.createCommandEventSend(player, this.getName(), arg, args, Cause.source(this.plugin).build()))) {
		this.execute(player, args)
			.exceptionally(e -> {
				EAMessages.COMMAND_ERROR.sender()
					.prefix(this.plugin.getMessages().getPrefix())
					.sendTo(source);
				this.plugin.getELogger().warn("CompletableFuture : " + e.getMessage());
				e.printStackTrace();
				return false;
			})
			.thenAcceptAsync(result -> {
				this.sources.remove(player.getIdentifier());
				this.plugin.getGame().getEventManager().post(ESpongeEventFactory.createCommandEventResult(player, this.getName(), arg, args, result, Cause.source(this.plugin).build()));
			}, this.plugin.getThreadSync());
	}
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:25,代码来源:ECommand.java

示例3: getName

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
public static Text getName(final GameMode gamemode) {
	if (gamemode == null) return Text.EMPTY;

	if (gamemode.equals(GameModes.SURVIVAL)){
		return EAMessages.GAMEMODE_SURVIVAL.getText();
	} else if (gamemode.equals(GameModes.CREATIVE)) {
		return EAMessages.GAMEMODE_CREATIVE.getText();
	} else if (gamemode.equals(GameModes.ADVENTURE)) {
		return EAMessages.GAMEMODE_ADVENTURE.getText();
	} else if (gamemode.equals(GameModes.SPECTATOR)) {
		return EAMessages.GAMEMODE_SPECTATOR.getText();
	} else if (gamemode.equals(GameModes.NOT_SET)) {
		return EAMessages.GAMEMODE_NOT_SET.getText();
	}
	return Text.EMPTY;
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:17,代码来源:UtilsGameMode.java

示例4: execute

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
public void execute() {
	this.plugin.getELogger().warn(this.getMessage());
	if (this.plugin.getEverAPI() != null && this.plugin.getEverAPI().getMessages() != null) {
		if (this.plugin.getEverAPI().getManagerService() != null && this.plugin.getEverAPI().getManagerService().getMail().isPresent()) {
			this.plugin.getEverAPI().getManagerService().getMail().get().alert(
					EAMessages.MAIL_SERVER_DISABLE_OBJECT.getFormat().toString(
						"{server}", EReplace.of(this.plugin.getEServer().getName()),
						"{reason}", EReplace.of(this.getMessage())
					),
					EAMessages.MAIL_SERVER_DISABLE_MESSAGE.getFormat().toString(
						"{server}", EReplace.of(this.plugin.getEServer().getName()),
						"{reason}", EReplace.of(this.getMessage())
					));
		}
		this.plugin.getEverAPI().disable();
		this.plugin.getGame().getServer().shutdown(EAMessages.SERVER_ERROR.getText());
	} else {
		this.plugin.getGame().getServer().shutdown();
	}
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:21,代码来源:ServerDisableException.java

示例5: commandJailSetRadius

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
private CompletableFuture<Boolean> commandJailSetRadius(final CommandSource staff, final String jail_name, final Optional<String> radius_string) {
	String name = EChat.fixLength(jail_name, this.plugin.getEverAPI().getConfigs().getMaxCaractere());
	
	Optional<EJail> jail = this.plugin.getJailService().getEJail(name);
	if (!jail.isPresent()) {
		ESMessages.JAIL_UNKNOWN.sender()
			.replace("{jail}", jail_name)
			.sendTo(staff);
		return CompletableFuture.completedFuture(false);
	}
	
	if (!radius_string.isPresent()) {
		return this.commandJailSetRadius(staff, jail.get()); 
	} else {
		try {
			return this.commandJailSetRadius(staff, jail.get(), Integer.parseInt(radius_string.get())); 
		} catch (NumberFormatException e) {
			EAMessages.IS_NOT_NUMBER.sender()
				.prefix(ESMessages.PREFIX)
				.replace("{number}", radius_string.get())
				.sendTo(staff);
		}
	}
	return CompletableFuture.completedFuture(false);
}
 
开发者ID:EverCraft,项目名称:EverSanctions,代码行数:26,代码来源:ESJailsSetRadius.java

示例6: execute

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
@Override
public CompletableFuture<Boolean> execute(final CommandSource source, final List<String> args) {
	if (args.size() == 0) {
		if (source instanceof Locatable) {
			return this.commandWorldborder(source, ((Locatable) source).getWorld());
		} else {
			EAMessages.COMMAND_ERROR_FOR_PLAYER.sender()
				.prefix(EEMessages.PREFIX)
				.sendTo(source);
		}
	} else if (args.size() == 1){
		Optional<World> world = this.plugin.getEServer().getWorld(args.get(0));
		if (world.isPresent()) {
			return this.commandWorldborder(source, world.get());
		} else {
			EAMessages.WORLD_NOT_FOUND.sender()
				.prefix(EEMessages.PREFIX)
				.replace("{world}", args.get(0))
				.sendTo(source);
		}
	} else {
		source.sendMessage(this.help(source));
	}
	
	return CompletableFuture.completedFuture(false);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:27,代码来源:EEWorldborderInfo.java

示例7: execute

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
public CompletableFuture<Boolean> execute(final CommandSource source, final List<String> args) {
	if (args.size() == 2) {
		Optional<User> user = this.plugin.getEServer().getUser(args.get(0));
		// Le joueur existe
		if (user.isPresent()){
			return this.commandTake(source, user.get(), args.get(1));
		// Le joueur est introuvable
		} else {
			EAMessages.PLAYER_NOT_FOUND.sender()
				.prefix(EEMessages.PREFIX)
				.replace("{player}", args.get(0))
				.sendTo(source);
		}
	} else {
		source.sendMessage(this.help(source));
	}
	return CompletableFuture.completedFuture(false);
}
 
开发者ID:EverCraft,项目名称:EverEconomy,代码行数:19,代码来源:EETake.java

示例8: commandInfo

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
private CompletableFuture<Boolean> commandInfo(final EPlayer player) {
	Optional<ItemStack> item = player.getItemInMainHand();
	
	// Le joueur a aucun item dans la main
	if (!item.isPresent()) {
		EAMessages.EMPTY_ITEM_IN_HAND.sender()
			.prefix(EEMessages.PREFIX)
			.sendTo(player);
		return CompletableFuture.completedFuture(false);
	}
	
	EEMessages.INFO_PLAYER.sender()
		.replace("{type}", item.get().getType().getName().replaceAll("minecraft:", "").toUpperCase())
		.replace("{item}", EChat.getButtomItem(item.get(), EEMessages.INFO_ITEM_COLOR.getColor()))
		.sendTo(player);
	return CompletableFuture.completedFuture(true);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:18,代码来源:EEInfo.java

示例9: commandTree

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
private CompletableFuture<Boolean> commandTree(final EPlayer player, PopulatorObject generator) throws CommandException {
	Optional<Vector3i> block = player.getViewBlock();
	
	// Aucun block
	if (!block.isPresent()) {
		EAMessages.PLAYER_NO_LOOK_BLOCK.sender()
			.prefix(EEMessages.PREFIX)
			.sendTo(player);
		return CompletableFuture.completedFuture(false);
	}
	
	Vector3i location = block.get().add(0, 1, 0);
	
	// Impossible de le placer
	if (!generator.canPlaceAt(player.getWorld(), location.getX(), location.getY(), location.getZ())) {
		if (!generator.equals(PopulatorObjects.DESERT_WELL)) {
			EEMessages.TREE_NO_CAN_DIRT.sendTo(player);
		} else {
			EEMessages.TREE_NO_CAN_SAND.sendTo(player);
		}
	}
		
	generator.placeObject(player.getWorld(), player.getRandom(), location.getX(), location.getY(), location.getZ());
	return CompletableFuture.completedFuture(true);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:26,代码来源:EETree.java

示例10: commandWorldborderAdd

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
private CompletableFuture<Boolean> commandWorldborderAdd(final CommandSource source, final World world, final String diameter_string) {
	try {
		double diameter =  world.getWorldBorder().getDiameter() + Integer.parseInt(diameter_string);
		world.getWorldBorder().setDiameter(diameter);
		
		EEMessages message;
		if (world.getWorldBorder().getDiameter() > diameter){
			message = EEMessages.WORLDBORDER_ADD_BORDER_DECREASE;
		} else {
			message = EEMessages.WORLDBORDER_ADD_BORDER_INCREASE;
		}
		
		message.sender()
			.replace("{world}", world.getName())
			.replace("{amount}", String.valueOf(diameter))
			.sendTo(source);
		return CompletableFuture.completedFuture(true);
	} catch (NumberFormatException e) {
		EAMessages.IS_NOT_NUMBER.sender()
			.prefix(EEMessages.PREFIX)
			.replace("{number}", diameter_string)
			.sendTo(source);
		return CompletableFuture.completedFuture(false);
	}
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:26,代码来源:EEWorldborderAdd.java

示例11: commandConfirmation

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
private CompletableFuture<Boolean> commandConfirmation(final CommandSource staff, final EUserSubject subject) {
	return subject.clear()
			.exceptionally(e -> false)
			.thenApply(result -> {
				if (!result) {
					EAMessages.COMMAND_ERROR.sender()
						.prefix(EPMessages.PREFIX)
						.sendTo(staff);
					return false;
				}
				
				EPMessages.COLLECTION_CLEAR.sender()
					.replace("{subject}", subject.getIdentifier())
					.replace("{collection}", subject.getCollectionIdentifier())
					.sendTo(staff);
				this.plugin.getService().broadcastMessage(staff,
					EPMessages.COLLECTION_CLEAR_BROADCAST.sender()
						.replace("{staff}", staff.getName())
						.replace("{subject}", subject.getIdentifier())
						.replace("{collection}", subject.getCollectionIdentifier()));
				return true;
			});
}
 
开发者ID:EverCraft,项目名称:EverPermissions,代码行数:24,代码来源:EPCollectionClear.java

示例12: execute

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
@Override
public CompletableFuture<Boolean> execute(final CommandSource source, final List<String> args) throws CommandException {
	// Si on ne connait pas le joueur
	if (args.size() == 0) {
		
		// Si la source est un joueur
		if (source instanceof EPlayer) {
			return this.commandMotd((EPlayer) source);
		// La source n'est pas un joueur
		} else {
			EAMessages.COMMAND_ERROR_FOR_PLAYER.sender()
				.prefix(EEMessages.PREFIX)
				.sendTo(source);
		}
		
	// Nombre d'argument incorrect
	} else {
		source.sendMessage(this.help(source));
	}
	
	return CompletableFuture.completedFuture(false);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:23,代码来源:EEMotd.java

示例13: execute

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
@Override
public CompletableFuture<Boolean> execute(final CommandSource source, final List<String> args) throws CommandException {
	// Si on ne connait pas le joueur
	if (args.size() == 0) {
		
		// Si la source est un joueur
		if (source instanceof EPlayer) {
			return this.commandInfo((EPlayer) source);
		// La source n'est pas un joueur
		} else {
			EAMessages.COMMAND_ERROR_FOR_PLAYER.sender()
				.prefix(EEMessages.PREFIX)
				.sendTo(source);
		}
		
	// Nombre d'argument incorrect
	} else {
		source.sendMessage(this.help(source));
	}
	return CompletableFuture.completedFuture(false);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:22,代码来源:EEInfo.java

示例14: commandSetSpawnDefault

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的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

示例15: execute

import fr.evercraft.everapi.EAMessage.EAMessages; //导入依赖的package包/类
@Override
public CompletableFuture<Boolean> execute(final CommandSource source, final List<String> args) throws CommandException {
	// Si on ne connait pas le joueur
	if (args.size() == 1) {
		
		Optional<EPlayer> optPlayer = this.plugin.getEServer().getEPlayer(args.get(0));
		if (optPlayer.isPresent()){
			return this.commandKill(source, optPlayer.get());
		} else {
			EAMessages.PLAYER_NOT_FOUND.sender()
				.prefix(EEMessages.PREFIX)
				.replace("{player}", args.get(0))
				.sendTo(source);
		}
		
	} else {
		source.sendMessage(this.help(source));
	}
	
	return CompletableFuture.completedFuture(false);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:22,代码来源:EEKill.java


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