Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
a23d10c
Update readme.md
Nicholas-Vo Apr 7, 2022
9f6aaed
Update readme.md
Nicholas-Vo Apr 7, 2022
ba145aa
Working on Minecraft 1.18.2
Nicholas-Vo Apr 7, 2022
57a77f4
Merge remote-tracking branch 'origin/master'
Nicholas-Vo Apr 7, 2022
bcdc1b8
Update readme.md
Nicholas-Vo Apr 7, 2022
950250a
commit before cleanup. works
Nicholas-Vo Apr 7, 2022
5af606f
Merge remote-tracking branch 'origin/master'
Nicholas-Vo Apr 7, 2022
fb613f2
Finished cleanup
Nicholas-Vo Apr 7, 2022
32ac931
Update readme.md
Nicholas-Vo Apr 7, 2022
6cadf3c
Update readme.md
Nicholas-Vo Apr 7, 2022
9cf56c6
Update readme.md
Nicholas-Vo Apr 7, 2022
ce1b150
Update readme.md
Nicholas-Vo Apr 7, 2022
33ad5fd
Update readme.md
Nicholas-Vo Apr 7, 2022
9d2f115
Update readme.md
Nicholas-Vo Apr 7, 2022
e784f95
Update readme.md
Nicholas-Vo Apr 7, 2022
37c6db8
Update readme.md
Nicholas-Vo Apr 7, 2022
dc90407
Update readme.md
Nicholas-Vo Apr 7, 2022
fe5a4ca
Update readme.md
Nicholas-Vo Apr 7, 2022
c23c255
Update readme.md
Nicholas-Vo Apr 7, 2022
37aa326
Update readme.md
Nicholas-Vo Apr 7, 2022
644e6fe
Update readme.md
Nicholas-Vo Apr 7, 2022
51de54c
Update readme.md
Nicholas-Vo Apr 7, 2022
ce0ece0
Update readme.md
Nicholas-Vo Apr 7, 2022
6cf78bd
Update readme.md
Nicholas-Vo Apr 7, 2022
873568b
v1.0.1 - Added configurable delay to the sending of images
Nicholas-Vo Apr 9, 2022
81d35d0
Merge remote-tracking branch 'origin/master'
Nicholas-Vo Apr 9, 2022
082aec4
Updated bStats id
Nicholas-Vo Apr 10, 2022
bc92186
working on centering image
Nicholas-Vo Apr 10, 2022
b2c7c22
RGB support added for text
Nicholas-Vo Apr 14, 2022
00c8271
RGB support added for text
Nicholas-Vo Apr 14, 2022
29adcc5
RGB support added for text
Nicholas-Vo Apr 14, 2022
65027d8
RGB support added for text
Nicholas-Vo Apr 15, 2022
0d1ded9
Centering feature works!
Nicholas-Vo Apr 15, 2022
0185b95
Update readme.md
Nicholas-Vo Apr 15, 2022
3585235
Fixed center (again)
Nicholas-Vo Apr 15, 2022
bdceeac
Update readme.md
Nicholas-Vo Apr 15, 2022
d86d334
Update readme.md
Nicholas-Vo Apr 15, 2022
8805e82
Update readme.md
Nicholas-Vo Apr 15, 2022
f48678e
Update readme.md
Nicholas-Vo Apr 15, 2022
1703cbb
Update readme.md
Nicholas-Vo Apr 15, 2022
e8a8f02
Update readme.md
Nicholas-Vo Apr 15, 2022
9ce4279
Update readme.md
Nicholas-Vo Apr 15, 2022
2f55457
Update readme.md
Nicholas-Vo Apr 15, 2022
595c198
Update readme.md
Nicholas-Vo Apr 15, 2022
5609489
Update readme.md
Nicholas-Vo Apr 15, 2022
ad34214
Update readme.md
Nicholas-Vo Apr 15, 2022
1114d19
Update readme.md
Nicholas-Vo Apr 15, 2022
8a3549e
Update readme.md
Nicholas-Vo Apr 15, 2022
59b1481
Update readme.md
Nicholas-Vo Apr 15, 2022
7fce1eb
Update readme.md
Nicholas-Vo Apr 15, 2022
8df5a3b
Update readme.md
Nicholas-Vo Apr 15, 2022
e206bc5
Update readme.md
Nicholas-Vo Apr 15, 2022
6fab775
Update readme.md
Nicholas-Vo Apr 15, 2022
706e8e6
Update readme.md
Nicholas-Vo Apr 15, 2022
6dbb19e
Update readme.md
Nicholas-Vo Apr 15, 2022
761aa2b
Update readme.md
Nicholas-Vo Apr 15, 2022
942af1e
Update readme.md
Nicholas-Vo Apr 15, 2022
6aefee6
Update readme.md
Nicholas-Vo Apr 15, 2022
76e53c6
Update readme.md
Nicholas-Vo Apr 15, 2022
381c0d6
Update readme.md
Nicholas-Vo Apr 15, 2022
5335848
Fixed center (again)
Nicholas-Vo Apr 15, 2022
f8c6496
fixed update link
Nicholas-Vo Apr 15, 2022
f77c5f2
Fixed updater
Nicholas-Vo Apr 19, 2022
d7790c0
Merge remote-tracking branch 'origin/master'
Nicholas-Vo Apr 19, 2022
f271712
Fixed updater
Nicholas-Vo Apr 19, 2022
746eeb0
Moved the position of the PlaceholderAPI check to attempt to fix a bug
Nicholas-Vo Feb 2, 2023
fe59e1e
Possibly resolved issue where vault prefixes with hex colors don't di…
Nicholas-Vo Feb 3, 2023
d7cac05
Code cleanup
Nicholas-Vo Feb 3, 2023
7361274
Fixed bug where message would not display and an error would appear i…
Nicholas-Vo Feb 3, 2023
c297094
Update readme.md
Nicholas-Vo Feb 3, 2023
350aac7
Fixed hex colors coming through incorrectly (tweaked regex, thanks Je…
Nicholas-Vo Feb 3, 2023
c0f2ea3
Merge remote-tracking branch 'origin/master'
Nicholas-Vo Feb 3, 2023
550bbd0
Updated error message
Nicholas-Vo Aug 17, 2024
4c9a5e9
Updating version number to 1.0.6
Nicholas-Vo Aug 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>me.itsnathang</groupId>
<artifactId>PictureLogin</artifactId>
<version>1.6</version>
<groupId>me.nickv</groupId>
<artifactId>PictureLogin-Continued</artifactId>
<version>1.0.6</version>
<packaging>jar</packaging>

<name>Picture Login</name>

<properties>
<author>NathanG</author>
<author>NathanG, _NickV</author>
<mainClass>me.itsnathang.picturelogin.PictureLogin</mainClass>
</properties>

Expand All @@ -23,7 +23,7 @@
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>CodeMC</id>
Expand All @@ -33,6 +33,10 @@
<id>minedown-repo</id>
<url>https://repo.minebench.de/</url>
</repository>
<repository> <!-- for development builds -->
<id>sonatype-oss-snapshots1</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -45,7 +49,7 @@
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.7</version>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -66,10 +70,16 @@
<version>1.6.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.10.1</version>
</dependency>
</dependencies>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<directory>${dir}</directory>
<!-- <sourceDirectory>src/main/java</sourceDirectory>-->
<defaultGoal>clean install</defaultGoal>
<resources>
<resource>
Expand All @@ -79,11 +89,12 @@
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -94,7 +105,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.0</version>
<configuration>
<relocations>
<relocation>
Expand Down Expand Up @@ -130,5 +141,5 @@
</plugin>
</plugins>
</build>

</project>
29 changes: 20 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
Picture Login ![GitHub release (latest by date)](https://img.shields.io/github/v/release/ItsNathanG/PictureLogin?style=flat-square)
PictureLogin-Continued [![Version](https://img.shields.io/badge/version-1.0.4-blue)](https://www.spigotmc.org/resources/picturelogin-continued.101216/)
===

Picture Login provides a much nicer login message by displaying a picture of the player's head inside of chat.
This is a popular plugin for Minecraft servers (over 50,000 downloads) that has sadly been unsupported for a while; I've updated it to Minecraft 1.18 and will be supporting future versions! (Now confirmed working on Minecraft 1.21.1)

<div align="center">
<img src="https://i.imgur.com/kNW94py.png">
PictureLogin creates a fancy login message by displaying a picture of the player's head inside of chat.

<img src="https://bstats.org/signatures/bukkit/PictureLogin.svg">
</div>
![demo](https://user-images.githubusercontent.com/60233722/163606833-27671a07-1187-424f-abf7-f5a5d35abda8.PNG)

It is a plugin for [Spigot](http://www.spigotmc.org/) and you can find further information [here, on it's plugin page](http://www.spigotmc.org/resources/picture-login.4514/).
Obtaining the plugin
---
You can download the plugin over on Spigot: https://www.spigotmc.org/resources/picturelogin-continued.101216/

Credit to...
---

- The original plugin author, ItsNathanG
- bobacadodl for his Image Message Library
- Crafatar for their avatar service

Support [![Discord](https://img.shields.io/badge/discord-Nick's%20Place-orange)](https://discord.gg/fGzb73sPmV)
---
You can reach out to me on the Spigot forums or here on GitHub, although the best way to reach me is on Discord.

License
License [![License](https://img.shields.io/github/license/Nicholas-Vo/PictureLogin-Continued)](https://github.com/Nicholas-Vo/PictureLogin-Continued/blob/master/LICENSE)
---
This plugin is licensed under the MIT License. For more information please refer to LICENSE.
This plugin is licensed under the MIT License. For more information please refer to LICENSE.
2 changes: 1 addition & 1 deletion src/main/java/com/bobacadodl/imgmessage/ImageChar.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum ImageChar {
DARK_SHADE('\u2593'),
MEDIUM_SHADE('\u2592'),
LIGHT_SHADE('\u2591');
private char c;
private final char c;

ImageChar(char c) {
this.c = c;
Expand Down
61 changes: 9 additions & 52 deletions src/main/java/com/bobacadodl/imgmessage/ImageMessage.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.bobacadodl.imgmessage;

import org.bukkit.ChatColor;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.util.ChatPaginator;

import java.awt.*;
import java.awt.Color;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
Expand All @@ -17,25 +17,6 @@
public class ImageMessage {
private final static char TRANSPARENT_CHAR = ' ';

private final Color[] colors = {
new Color(0, 0, 0),
new Color(0, 0, 170),
new Color(0, 170, 0),
new Color(0, 170, 170),
new Color(170, 0, 0),
new Color(170, 0, 170),
new Color(255, 170, 0),
new Color(170, 170, 170),
new Color(85, 85, 85),
new Color(85, 85, 255),
new Color(85, 255, 85),
new Color(85, 255, 255),
new Color(255, 85, 85),
new Color(255, 85, 255),
new Color(255, 255, 85),
new Color(255, 255, 255),
};

private String[] lines;

public ImageMessage(BufferedImage image, int height, char imgChar) {
Expand Down Expand Up @@ -92,12 +73,12 @@ private ChatColor[][] toChatColorArray(BufferedImage image, int height) {
private String[] toImgMessage(ChatColor[][] colors, char imgchar) {
lines = new String[colors[0].length];
for (int y = 0; y < colors[0].length; y++) {
String line = "";
for (int x = 0; x < colors.length; x++) {
ChatColor color = colors[x][y];
line += (color != null) ? colors[x][y].toString() + imgchar : TRANSPARENT_CHAR;
StringBuilder line = new StringBuilder();
for (ChatColor[] chatColors : colors) {
ChatColor color = chatColors[y];
line.append((color != null) ? chatColors[y].toString() + imgchar : TRANSPARENT_CHAR);
}
lines[y] = line + ChatColor.RESET;
lines[y] = line.toString() + ChatColor.RESET;
}
return lines;
}
Expand Down Expand Up @@ -127,31 +108,11 @@ private boolean areIdentical(Color c1, Color c2) {
return Math.abs(c1.getRed() - c2.getRed()) <= 5 &&
Math.abs(c1.getGreen() - c2.getGreen()) <= 5 &&
Math.abs(c1.getBlue() - c2.getBlue()) <= 5;

}

private ChatColor getClosestChatColor(Color color) {
if (color.getAlpha() < 128) return null;

int index = 0;
double best = -1;

for (int i = 0; i < colors.length; i++) {
if (areIdentical(colors[i], color)) {
return ChatColor.values()[i];
}
}

for (int i = 0; i < colors.length; i++) {
double distance = getDistance(color, colors[i]);
if (distance < best || best == -1) {
best = distance;
index = i;
}
}

// Minecraft has 15 colors
return ChatColor.values()[index];
return ChatColor.of(color);
}

private String center(String s, int length) {
Expand All @@ -161,11 +122,7 @@ private String center(String s, int length) {
return s;
} else {
int leftPadding = (length - s.length()) / 2;
StringBuilder leftBuilder = new StringBuilder();
for (int i = 0; i < leftPadding; i++) {
leftBuilder.append(" ");
}
return leftBuilder.toString() + s;
return " ".repeat(leftPadding) + s;
}
}

Expand Down
74 changes: 39 additions & 35 deletions src/main/java/me/itsnathang/picturelogin/PictureLogin.java
Original file line number Diff line number Diff line change
@@ -1,56 +1,60 @@
package me.itsnathang.picturelogin;

import me.itsnathang.picturelogin.listeners.JoinListener;
import me.itsnathang.picturelogin.listeners.QuitListener;
import me.itsnathang.picturelogin.commands.BaseCommand;
import me.itsnathang.picturelogin.config.ConfigManager;
import me.itsnathang.picturelogin.listeners.JoinListener;
import me.itsnathang.picturelogin.listeners.QuitListener;
import me.itsnathang.picturelogin.util.Hooks;
import me.itsnathang.picturelogin.util.PictureUtil;

import me.itsnathang.picturelogin.util.Updater;
import org.bukkit.command.CommandExecutor;
import org.bukkit.plugin.java.JavaPlugin;
import org.bstats.bukkit.Metrics;
import org.bukkit.plugin.java.JavaPlugin;

/*
Updated to work with Minecraft 1.18.2 by _NickV on 4/7/2022
*/
public class PictureLogin extends JavaPlugin {
private ConfigManager configManager;
private PictureUtil pictureUtil;
private ConfigManager configManager;
private PictureUtil pictureUtil;

@Override
public void onEnable() {
// load config & languages file
configManager = new ConfigManager(this);
@Override
public void onEnable() {
// load config & languages file
configManager = new ConfigManager(this);

// Register Plugin Hooks
new Hooks(getServer().getPluginManager(), configManager, getLogger());
// Register Plugin Hooks
new Hooks(getServer().getPluginManager(), configManager, getLogger());

// Initialize Picture Utility
pictureUtil = new PictureUtil(this);
// Initialize Picture Utility
pictureUtil = new PictureUtil(this);

// register Listeners
getServer().getPluginManager().registerEvents(new JoinListener(this), this);
// register Listeners
getServer().getPluginManager().registerEvents(new JoinListener(this), this);

// (only register leave listener if enabled in config)
if (configManager.getBoolean("show-leave-message", false))
getServer().getPluginManager().registerEvents(new QuitListener(this), this);
// (only register leave listener if enabled in config)
if (configManager.getBoolean("show-leave-message", false)) {
getServer().getPluginManager().registerEvents(new QuitListener(this), this);
}

// register /picturelogin command
getCommand("picturelogin").setExecutor(new BaseCommand(this));
// register /picturelogin command
getCommand("picturelogin").setExecutor(new BaseCommand(this));

// Update Checker
if (configManager.getBoolean("update-check", true))
new Updater(getLogger(), getDescription().getVersion());
// Update Checker
if (configManager.getBoolean("update-check", true)) {
new Updater(getLogger(), getDescription().getVersion());
}

// bStats integration
if (configManager.getBoolean("metrics", true))
new Metrics(this, 2225);
}
// bStats integration
if (configManager.getBoolean("metrics", true)) {
new Metrics(this, 14892); // 2225 is the bStats plugin ID for PictureLogin
}
}

public ConfigManager getConfigManager() {
return configManager;
}
public ConfigManager getConfigManager() {
return configManager;
}

public PictureUtil getPictureUtil() {
return pictureUtil;
}
public PictureUtil getPictureUtil() {
return pictureUtil;
}
}
Loading