use of net.minecraft.util.ChatComponentText in project Galacticraft by micdoodle8.
the class CommandSpaceStationRemoveOwner method processCommand.
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
String var3 = null;
EntityPlayerMP playerBase = null;
if (args.length > 0) {
var3 = args[0];
try {
playerBase = PlayerUtil.getPlayerBaseServerFromPlayerUsername(sender.getName(), false);
if (playerBase != null) {
GCPlayerStats stats = GCPlayerStats.get(playerBase);
if (stats.getSpaceStationDimensionData().isEmpty()) {
throw new WrongUsageException(GCCoreUtil.translate("commands.ssinvite.not_found"), new Object[0]);
} else {
for (Map.Entry<Integer, Integer> e : stats.getSpaceStationDimensionData().entrySet()) {
final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, e.getValue(), playerBase);
String str = null;
for (String name : data.getAllowedPlayers()) {
if (name.equalsIgnoreCase(var3)) {
str = name;
break;
}
}
if (str != null) {
data.getAllowedPlayers().remove(str);
data.markDirty();
} else {
throw new CommandException(GCCoreUtil.translateWithFormat("commands.ssuninvite.no_player", "\"" + var3 + "\""), new Object[0]);
}
}
}
}
} catch (final Exception var6) {
throw new CommandException(var6.getMessage(), new Object[0]);
}
} else {
throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.ssinvite.wrong_usage", this.getCommandUsage(sender)), new Object[0]);
}
if (playerBase != null) {
playerBase.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.spacestation.removesuccess", var3)));
}
}
use of net.minecraft.util.ChatComponentText in project Galacticraft by micdoodle8.
the class EntityBuggy method interactFirst.
@Override
public boolean interactFirst(EntityPlayer var1) {
if (this.worldObj.isRemote) {
if (this.riddenByEntity == null) {
var1.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.turn.name")));
var1.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.accel.name")));
var1.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.decel.name")));
var1.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.inv.name")));
}
return true;
} else {
if (this.riddenByEntity != null) {
if (this.riddenByEntity == var1)
var1.mountEntity(null);
return true;
} else {
var1.mountEntity(this);
return true;
}
}
}
use of net.minecraft.util.ChatComponentText in project Galacticraft by micdoodle8.
the class ThreadVersionCheck method run.
@Override
public void run() {
final Side sideToCheck = FMLCommonHandler.instance().getSide();
if (sideToCheck == null || ConfigManagerCore.disableUpdateCheck) {
return;
}
while (this.count < 3 && remotePatchVer == -1) {
BufferedReader in = null;
try {
final URL url = new URL("https://micdoodle8.com/galacticraft/version.html");
final HttpURLConnection http = (HttpURLConnection) url.openConnection();
http.addRequestProperty("User-Agent", "Mozilla/4.76");
InputStreamReader streamReader = new InputStreamReader(http.getInputStream());
in = new BufferedReader(streamReader);
String str;
String[] str2 = null;
while ((str = in.readLine()) != null) {
if (str.contains("Version")) {
str = str.replace("Version=", "");
str2 = str.split("#");
if (str2.length >= 3) {
remoteMajVer = Integer.parseInt(str2[0]);
remoteMinVer = Integer.parseInt(str2[1]);
remotePatchVer = Integer.parseInt(str2[2]);
}
if (remoteMajVer == Constants.LOCALMAJVERSION && (remoteMinVer > Constants.LOCALMINVERSION || (remoteMinVer == Constants.LOCALMINVERSION && remotePatchVer > Constants.LOCALPATCHVERSION))) {
Thread.sleep(5000);
if (sideToCheck.equals(Side.CLIENT)) {
FMLClientHandler.instance().getClient().thePlayer.addChatMessage(new ChatComponentText(EnumColor.GREY + "New " + EnumColor.DARK_AQUA + Constants.MOD_NAME_SIMPLE + EnumColor.GREY + " version available! v" + String.valueOf(remoteMajVer) + "." + String.valueOf(remoteMinVer) + "." + String.valueOf(remotePatchVer) + ".xxx" + EnumColor.DARK_BLUE + " http://micdoodle8.com/"));
} else if (sideToCheck.equals(Side.SERVER)) {
GCLog.severe("New Galacticraft version available! v" + String.valueOf(remoteMajVer) + "." + String.valueOf(remoteMinVer) + "." + String.valueOf(remotePatchVer) + ".xxx" + " http://micdoodle8.com/");
}
}
break;
}
}
in.close();
streamReader.close();
} catch (final Exception e) {
if (in != null) {
try {
in.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
if (remotePatchVer == -1) {
try {
GCLog.severe(GCCoreUtil.translate("newversion.failed.name"));
Thread.sleep(15000);
} catch (final InterruptedException e) {
}
} else {
GCLog.info(GCCoreUtil.translate("newversion.success.name") + " " + remoteMajVer + "." + remoteMinVer + "." + remotePatchVer);
}
this.count++;
}
}
use of net.minecraft.util.ChatComponentText in project Galacticraft by micdoodle8.
the class BlockShortRangeTelepad method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
TileEntity tile = worldIn.getTileEntity(pos);
boolean validSpot = true;
for (int x = -1; x <= 1; x++) {
for (int y = 0; y < 3; y += 2) {
for (int z = -1; z <= 1; z++) {
if (!(x == 0 && y == 0 && z == 0)) {
Block blockAt = worldIn.getBlockState(pos.add(x, y, z)).getBlock();
if (!blockAt.getMaterial().isReplaceable()) {
validSpot = false;
}
}
}
}
}
if (!validSpot) {
worldIn.setBlockToAir(pos);
if (placer instanceof EntityPlayer) {
if (!worldIn.isRemote) {
((EntityPlayer) placer).addChatMessage(new ChatComponentText(EnumColor.RED + GCCoreUtil.translate("gui.warning.noroom")));
}
((EntityPlayer) placer).inventory.addItemStackToInventory(new ItemStack(Item.getItemFromBlock(this), 1, 0));
}
return;
}
if (tile instanceof TileEntityShortRangeTelepad) {
((TileEntityShortRangeTelepad) tile).onCreate(worldIn, pos);
((TileEntityShortRangeTelepad) tile).setOwner(PlayerUtil.getName(((EntityPlayer) placer)));
}
}
use of net.minecraft.util.ChatComponentText in project Armourers-Workshop by RiskyKen.
the class ModClientFMLEventHandler method onPlayerTickEndEvent.
public void onPlayerTickEndEvent() {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (!shownUpdateInfo && UpdateCheck.updateFound) {
shownUpdateInfo = true;
ChatComponentText updateMessage = new ChatComponentText(TranslateUtils.translate("chat.armourersworkshop:updateAvailable", UpdateCheck.remoteModVersion) + " ");
ChatComponentText updateURL = new ChatComponentText(TranslateUtils.translate("chat.armourersworkshop:updateDownload"));
updateURL.getChatStyle().setUnderlined(true);
updateURL.getChatStyle().setColor(EnumChatFormatting.BLUE);
updateURL.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(TranslateUtils.translate("chat.armourersworkshop:updateDownloadRollover"))));
updateURL.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, LibModInfo.DOWNLOAD_URL));
updateMessage.appendSibling(updateURL);
player.addChatMessage(updateMessage);
}
if (!showmDevWarning && LibModInfo.DEVELOPMENT_VERSION) {
ChatComponentText devWarning = new ChatComponentText(TranslateUtils.translate("chat.armourersworkshop:devWarning"));
devWarning.getChatStyle().setColor(EnumChatFormatting.RED);
player.addChatMessage(devWarning);
showmDevWarning = true;
}
}
Aggregations