use of v1_8_9.net.minecraft.util.ChatComponentText in project RFToolsDimensions by McJty.
the class CmdSetOwner method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length < 3) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "The dimension and player parameters are missing!"));
return;
} else if (args.length > 3) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
return;
}
int dim = fetchInt(sender, args, 1, 0);
String playerName = fetchString(sender, args, 2, null);
World world = sender.getEntityWorld();
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
if (dimensionManager.getDimensionDescriptor(dim) == null) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
return;
}
for (Object o : MinecraftServer.getServer().getConfigurationManager().playerEntityList) {
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) o;
if (playerName.equals(entityPlayerMP.getDisplayName())) {
DimensionInformation information = dimensionManager.getDimensionInformation(dim);
information.setOwner(playerName, entityPlayerMP.getGameProfile().getId());
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Owner of dimension changed!"));
dimensionManager.save(world);
return;
}
}
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not find player!"));
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Hyperium by HyperiumClient.
the class NetworkHandler method handleChat.
@Override
public void handleChat(String s) {
if (s.toLowerCase().contains("reconnecting hyperium connection"))
return;
Hyperium.LOGGER.debug("Chat: {}", s);
s = s.replace("&", C.COLOR_CODE_SYMBOL);
IChatComponent chatComponent = new ChatComponentText("");
Arrays.stream(s.split(" ")).forEach(s1 -> {
ChatComponentText iChatComponents = new ChatComponentText(s1 + " ");
if (s1.contains(".") && !s1.startsWith(".") && !s1.endsWith(".")) {
ChatStyle chatStyle = new ChatStyle();
chatStyle.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, s1.startsWith("http") ? s1 : "http://" + s1));
iChatComponents.setChatStyle(chatStyle);
}
chatComponent.appendSibling(iChatComponents);
});
GeneralChatHandler.instance().sendMessage(chatComponent);
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Hyperium by HyperiumClient.
the class HyperiumScreenshotHelper method saveScreenshot.
public static IChatComponent saveScreenshot(int width, int height, Framebuffer buffer, IntBuffer pixelBuffer, int[] pixelValues) {
final File file1 = new File(Minecraft.getMinecraft().mcDataDir, "screenshots");
file1.mkdir();
if (OpenGlHelper.isFramebufferEnabled()) {
width = buffer.framebufferTextureWidth;
height = buffer.framebufferTextureHeight;
}
final int i = width * height;
if (pixelBuffer == null || pixelBuffer.capacity() < i) {
pixelBuffer = BufferUtils.createIntBuffer(i);
pixelValues = new int[i];
}
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
pixelBuffer.clear();
if (OpenGlHelper.isFramebufferEnabled()) {
GlStateManager.bindTexture(buffer.framebufferTexture);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
} else {
GL11.glReadPixels(0, 0, width, height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
}
boolean upload = true;
pixelBuffer.get(pixelValues);
if (!Settings.DEFAULT_UPLOAD_SS) {
HyperiumBind uploadBind = Hyperium.INSTANCE.getHandlers().getKeybindHandler().getBinding("Upload Screenshot");
int keyCode = uploadBind.getKeyCode();
upload = keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode);
}
new Thread(new AsyncScreenshotSaver(width, height, pixelValues, Minecraft.getMinecraft().getFramebuffer(), new File(Minecraft.getMinecraft().mcDataDir, "screenshots"), upload)).start();
if (!upload) {
return Settings.HYPERIUM_CHAT_PREFIX ? new ChatComponentText(ChatColor.RED + "[Hyperium] " + ChatColor.WHITE + "Capturing...") : new ChatComponentText(ChatColor.WHITE + "Capturing...");
}
return Settings.HYPERIUM_CHAT_PREFIX ? new ChatComponentText(ChatColor.RED + "[Hyperium] " + ChatColor.WHITE + "Uploading...") : new ChatComponentText(ChatColor.WHITE + "Uploading...");
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Hyperium by HyperiumClient.
the class HyperiumEntityPlayer method getDisplayName.
public IChatComponent getDisplayName() {
if (cachedName == null || System.currentTimeMillis() - lastChangeTime > 50L) {
IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(parent.getTeam(), displayName));
ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + parent.getName() + " "));
// Unneeded for client
if (Minecraft.getMinecraft().isIntegratedServerRunning()) {
ichatcomponent.getChatStyle().setChatHoverEvent(((IMixinEntity) parent).callGetHoverEvent());
}
ichatcomponent.getChatStyle().setInsertion(parent.getName());
cachedName = ichatcomponent;
}
return cachedName;
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Hyperium by HyperiumClient.
the class UpdateChecker method serverJoinEvent.
@InvokeEvent
public void serverJoinEvent(ServerJoinEvent event) {
// If they were already asked, don't even make the new thread.
if (asked)
return;
UpdateUtils updateUtils = new UpdateUtils();
Multithreading.runAsync(() -> {
boolean latest = updateUtils.isAbsoluteLatest();
boolean beta = updateUtils.isBeta();
int version = Metadata.getVersionID();
Hyperium.LOGGER.info("version is: " + version);
// dont alert beta users
if (beta)
return;
// If they're on the latest version, I don't want to mess with them.
if (latest)
return;
Hyperium.INSTANCE.getNotification().display("You have an update pending.", "Click here to be sent to the installer.", 10f, null, () -> {
try {
Desktop.getDesktop().browse(new URI("https://hyperium.cc/downloads"));
} catch (IOException | URISyntaxException e) {
IChatComponent urlComponent = new ChatComponentText(ChatColor.RED + "[Hyperium] " + ChatColor.GRAY + "Click to be sent to update Hyperium");
urlComponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://hyperium.cc/downloads"));
Hyperium.INSTANCE.getHandlers().getGeneralChatHandler().sendMessage(urlComponent);
}
}, new Color(200, 150, 50));
asked = true;
});
}
Aggregations