本文整理匯總了Java中net.minecraft.util.ChatStyle類的典型用法代碼示例。如果您正苦於以下問題:Java ChatStyle類的具體用法?Java ChatStyle怎麽用?Java ChatStyle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ChatStyle類屬於net.minecraft.util包,在下文中一共展示了ChatStyle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerRemoval
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
public static void onPlayerRemoval(String player, SpaceRace race)
{
for (String member : race.getPlayerNames())
{
EntityPlayerMP memberObj = PlayerUtil.getPlayerForUsernameVanilla(MinecraftServer.getServer(), member);
if (memberObj != null)
{
memberObj.addChatMessage(new ChatComponentText(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.spaceRace.chat.removeSuccess", EnumColor.RED + player + EnumColor.DARK_AQUA)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_AQUA)));
}
}
List<String> playerList = new ArrayList<String>();
playerList.add(player);
SpaceRace newRace = SpaceRaceManager.addSpaceRace(new SpaceRace(playerList, SpaceRace.DEFAULT_NAME, new FlagData(48, 32), new Vector3(1, 1, 1)));
EntityPlayerMP playerToRemove = PlayerUtil.getPlayerBaseServerFromPlayerUsername(player, true);
if (playerToRemove != null)
{
SpaceRaceManager.sendSpaceRaceData(playerToRemove, newRace);
SpaceRaceManager.sendSpaceRaceData(playerToRemove, race);
}
}
示例2: printHelp
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
public static void printHelp(final @Nonnull ICommandSender sender, final @Nonnull IModCommand command) {
final ChatStyle header = new ChatStyle();
header.setColor(EnumChatFormatting.BLUE);
ChatBuilder.create("signpic.command."+command.getFullCommandString().replace(" ", ".")+".format").useTranslation().setStyle(header).setParams(command.getFullCommandString()).sendPlayer(sender);
final ChatStyle body = new ChatStyle();
body.setColor(EnumChatFormatting.GRAY);
final List<String> aliases = command.getCommandAliases();
if (aliases!=null)
ChatBuilder.create("signpic.command.aliases").useTranslation().setStyle(body).setParams(aliases.toString().replace("[", "").replace("]", "")).sendPlayer(sender);
ChatBuilder.create("signpic.command.permlevel").useTranslation().setStyle(body).setParams(Integer.valueOf(command.getRequiredPermissionLevel())).sendPlayer(sender);
ChatBuilder.create("signpic.command."+command.getFullCommandString().replace(" ", ".")+".help").useTranslation().setStyle(body).sendPlayer(sender);
if (!command.getChildren().isEmpty()) {
ChatBuilder.create("signpic.command.list").useTranslation().sendPlayer(sender);
final Iterator<SubCommand> arg3 = command.getChildren().iterator();
while (arg3.hasNext()) {
final SubCommand child = arg3.next();
ChatBuilder.create("signpic.command."+child.getFullCommandString().replace(" ", ".")+".desc").useTranslation().setParams(child.getCommandName()).sendPlayer(sender);
}
}
}
示例3: processSubCommand
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@Override
public void processSubCommand(final ICommandSender sender, final String[] args) {
if (CommandAuth.this.auther==null)
printAuthStart(sender);
else if (CommandAuth.this.auther.getState()!=TweetQuakeAuther.AuthState.START)
new ChatBuilder().setText("このコマンドは現在有効ではありません。").setStyle(new ChatStyle().setColor(EnumChatFormatting.RED)).sendPlayer(sender);
else {
try {
final ChatStyle style1 = new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, CommandAuth.this.auther.getAuthURL()));
new ChatBuilder().setText("クリックして認証URLを開く").setStyle(style1).sendPlayer(sender);
final ChatStyle style2 = new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/eewreciever auth pin <これを消して數字にしてください>"));
new ChatBuilder().setText("認証IDを手に入れたらクリックしてIDを入力").setStyle(style2).sendPlayer(sender);
} catch (final TwitterException e) {
Reference.logger.error(e.getMessage(), e);
CommandAuth.printRetry(sender, this);
}
}
}
示例4: processSubCommand
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@Override
public void processSubCommand(final ICommandSender sender, final String[] args) {
if (args.length>2) {
try {
final String arg = RootCommand.func_82360_a(sender, args, 0);
String text = null;
if (NumberUtils.isNumber(arg))
text = TweetQuakeManager.intance().getAuthedTwitter().showStatus(NumberUtils.toLong(arg)).getText();
else if (arg.startsWith("https://twitter.com/eewbot/status/"))
TweetQuakeManager.intance().getAuthedTwitter().showStatus(NumberUtils.toLong(StringUtils.remove(arg, "https://twitter.com/eewbot/status/"))).getText();
else
text = arg;
TweetQuake.instance().getQuakeUpdate().add(new TweetQuakeNode().parseString(text));
} catch (final Exception e) {
ChatBuilder.create(e.getClass().getName()).setStyle(new ChatStyle().setColor(EnumChatFormatting.RED)).sendPlayer(sender);
Reference.logger.error(e.getMessage(), e);
}
}
}
示例5: onEvent
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{
if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote
&& !ClientProxy.versionChecker.isLatestVersion())
{
ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,
"http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
ChatComponentText versionWarningChatComponent =
new ChatComponentText("Your EpicProportions Mod is not latest version! Click here to update.");
versionWarningChatComponent.setChatStyle(clickableChatStyle);
event.player.addChatMessage(versionWarningChatComponent);
ClientProxy.haveWarnedVersionOutOfDate = true;
}
}
示例6: onEvent
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{
if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote
&& !ClientProxy.versionChecker.isLatestVersion())
{
ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,
"http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
ChatComponentText versionWarningChatComponent =
new ChatComponentText("�4�l" + "Your EpicProportions Mod is not latest version! Click here to update.");
versionWarningChatComponent.setChatStyle(clickableChatStyle);
event.player.addChatMessage(versionWarningChatComponent);
ClientProxy.haveWarnedVersionOutOfDate = true;
}
}
示例7: BroadcastJoining
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
public static void BroadcastJoining(ItemStack scanner) {
NBTTagCompound nbt = scanner.getTagCompound();
ChatComponentText message = new ChatComponentText("");
message.appendSibling(
new ChatComponentText(nbt.getString("codename"))
.setChatStyle(
new ChatStyle()
.setColor(nbt.getInteger("faction") == Constants.Faction.RESISTANCE ? EnumChatFormatting.BLUE : EnumChatFormatting.GREEN)
)
);
message.appendSibling(new ChatComponentText(" has joined the "));
message.appendSibling(
new ChatComponentText(nbt.getInteger("faction") == Constants.Faction.RESISTANCE ? "Resistance" : "Enlightened")
.setChatStyle(
new ChatStyle()
.setColor(nbt.getInteger("faction") == Constants.Faction.RESISTANCE ? EnumChatFormatting.BLUE : EnumChatFormatting.GREEN)
)
);
message.appendSibling(new ChatComponentText("."));
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(message);
}
示例8: BroadcastDeploying
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
public static void BroadcastDeploying(ItemStack scanner) {
NBTTagCompound nbt = scanner.getTagCompound();
ChatComponentText message = new ChatComponentText("");
message.appendSibling(
new ChatComponentText(nbt.getString("codename"))
.setChatStyle(
new ChatStyle()
.setColor(nbt.getInteger("faction") == Constants.Faction.RESISTANCE ? EnumChatFormatting.BLUE : EnumChatFormatting.GREEN)
)
);
message.appendSibling(new ChatComponentText(" has deployed a Resonator."));
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(message);
}
示例9: BroadcastCapturing
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
public static void BroadcastCapturing(ItemStack scanner) {
NBTTagCompound nbt = scanner.getTagCompound();
ChatComponentText message = new ChatComponentText("");
message.appendSibling(
new ChatComponentText(nbt.getString("codename"))
.setChatStyle(
new ChatStyle()
.setColor(nbt.getInteger("faction") == Constants.Faction.RESISTANCE ? EnumChatFormatting.BLUE : EnumChatFormatting.GREEN)
)
);
message.appendSibling(new ChatComponentText(" has captured a Portal."));
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(message);
}
示例10: BroadcastDestroying
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
public static void BroadcastDestroying(ItemStack scanner) {
NBTTagCompound nbt = scanner.getTagCompound();
ChatComponentText message = new ChatComponentText("");
message.appendSibling(
new ChatComponentText(nbt.getString("codename"))
.setChatStyle(
new ChatStyle()
.setColor(nbt.getInteger("faction") == Constants.Faction.RESISTANCE ? EnumChatFormatting.BLUE : EnumChatFormatting.GREEN)
)
);
message.appendSibling(new ChatComponentText(" has destroyed a Resonator."));
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(message);
}
示例11: BroadcastNeutralizing
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
public static void BroadcastNeutralizing(ItemStack scanner) {
NBTTagCompound nbt = scanner.getTagCompound();
ChatComponentText message = new ChatComponentText("");
message.appendSibling(
new ChatComponentText(nbt.getString("codename"))
.setChatStyle(
new ChatStyle()
.setColor(nbt.getInteger("faction") == Constants.Faction.RESISTANCE ? EnumChatFormatting.BLUE : EnumChatFormatting.GREEN)
)
);
message.appendSibling(new ChatComponentText(" has neutralized a Portal."));
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(message);
}
示例12: getStatName
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@Override
public IChatComponent getStatName() {
IChatComponent text = this.name.createCopy();
ChatStyle style = text.getChatStyle();
style.setColor(color);
// So the achievement doesn't have to be registered on the client.
IChatComponent desc = new ChatComponentText("");
desc.appendSibling(text.createCopy()).appendText("\n");
IChatComponent type = new ChatComponentText("Achievement");
type.getChatStyle().setItalic(true);
desc.appendSibling(type).appendText("\n");
desc.appendSibling(new ChatComponentText(this.getDescription()));
HoverEvent hover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, desc);
style.setChatHoverEvent(hover);
return text;
}
示例13: onBlockActivated
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float hitX, float hitY, float hitZ) {
if (!player.isSneaking()) {
if (/*world.getBlock(x,y,z) == BlockRegistry.wandMakerLit || */world.getBlockLightValue(x,y,z) >= 10 || player.isPotionActive(Potion.nightVision)) {
if (!world.isRemote) {
player.openGui(MagiciansArtifice.instance, GuiHandler.IDS.WandMaker, world, x, y, z);
}
} else {
if (!world.isRemote) {
player.addChatComponentMessage(new ChatComponentTranslation("maker.read.nope").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(true)));
}
}
} else {
if (world.getBlock(x,y,z) == BlockRegistry.wandMaker) {
updateMakerState(false,world,x,y,z);
} else if (world.getBlock(x,y,z) == BlockRegistry.wandMakerLit){
updateMakerState(true,world,x,y,z);
}
}
return true;
}
示例14: onItemRightClick
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
Calendar calendar = Calendar.getInstance();
if (!world.isRemote) {
player.addChatComponentMessage(new ChatComponentTranslation("merlin.letter.header").setChatStyle(new ChatStyle().setItalic(true).setBold(true)));
if (calendar.get(2) + 1 == 4 && calendar.get(5) == 1) {
player.addChatComponentMessage(new ChatComponentTranslation("merlin.letter.body.april"));
} else {
player.addChatComponentMessage(new ChatComponentTranslation("merlin.letter.body"));
}
player.addChatComponentMessage(new ChatComponentText(""));
player.addChatComponentMessage(new ChatComponentTranslation("merlin.letter.ending").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_BLUE)));
for (int i = 0; i < player.inventory.getSizeInventory();i++) {
if (player.inventory.getStackInSlot(i) != null) {
if (player.inventory.getStackInSlot(i).getItem() == ItemRegistry.merlinLetter) {
player.inventory.setInventorySlotContents(i, null);
}
}
}
return stack;
}
return stack;
}
示例15: onPlayerLogin
import net.minecraft.util.ChatStyle; //導入依賴的package包/類
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
System.out.println("world join ");
if (!Basemod.vlcLoaded)//Display message in chat with link to vlc for arch
{
ChatStyle style = new ChatStyle().setUnderlined(true).setColor(EnumChatFormatting.GOLD);
IChatComponent text = new ChatComponentText("You need to download VLC here to hear the radio ").setChatStyle(style);
event.player.addChatComponentMessage(text);
if (Basemod.is64bit) {//TODO detect platform (mac/linux/windogs)
text = new ChatComponentText("http://download.videolan.org/pub/videolan/vlc/last/win64/vlc-2.1.3-win64.exe").setChatStyle(style);
} else {
text = new ChatComponentText("http://download.videolan.org/pub/videolan/vlc/last/win32/vlc-2.1.3-win32.exe").setChatStyle(style);
}
event.player.addChatComponentMessage(text);
}
}