mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-28 11:39:07 +00:00
Fixes
This commit is contained in:
@@ -21,7 +21,11 @@ package com.volmit.iris.util.format;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiomeCustom;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import net.kyori.adventure.text.minimessage.transformation.inbuild.FontTransformation;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
@@ -139,6 +143,14 @@ public enum C {
|
||||
return net.md_5.bungee.api.ChatColor.GREEN;
|
||||
}
|
||||
},
|
||||
|
||||
IRIS("<#1bb19e>", 'a', 0xA) {
|
||||
@Override
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.GREEN;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Represents aqua
|
||||
*/
|
||||
@@ -238,8 +250,10 @@ public enum C {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
;
|
||||
/**
|
||||
* The special character which prefixes all chat colour codes. Use this if you
|
||||
* need to dynamically convert colour codes from your custom format.
|
||||
@@ -263,6 +277,7 @@ public enum C {
|
||||
static {
|
||||
chatHexMap.put(C.BLACK, "#000000");
|
||||
chatHexMap.put(C.DARK_BLUE, "#0000AA");
|
||||
chatHexMap.put(C.IRIS, "#1bb19e");
|
||||
chatHexMap.put(C.DARK_GREEN, "#00AA00");
|
||||
chatHexMap.put(C.DARK_AQUA, "#00AAAA");
|
||||
chatHexMap.put(C.DARK_RED, "#AA0000");
|
||||
@@ -332,12 +347,12 @@ public enum C {
|
||||
|
||||
public static float[] spin(float[] c, int shift)
|
||||
{
|
||||
return new float[]{spin(c[0], shift),spin(c[1], shift),spin(c[2], shift)};
|
||||
return new float[]{spin(c[0], shift),spinc(c[1], shift),spinc(c[2], shift)};
|
||||
}
|
||||
|
||||
public static float[] spin(float[] c, int a,int b, int d)
|
||||
{
|
||||
return new float[]{spin(c[0], a),spin(c[1], b),spin(c[2], d)};
|
||||
return new float[]{spin(c[0], a),spinc(c[1], b),spinc(c[2], d)};
|
||||
}
|
||||
|
||||
public static float spin(float c, int shift)
|
||||
@@ -346,7 +361,26 @@ public enum C {
|
||||
return g < 0 ? 1f - g : g;
|
||||
}
|
||||
|
||||
public static String aura(String msg, int hrad, int srad, int vrad) {
|
||||
public static float spinc(float c, int shift)
|
||||
{
|
||||
float g = ((((int)Math.floor(c * 255)) + shift)) / 255F;
|
||||
return Math.max(0f, Math.min(g, 1f));
|
||||
}
|
||||
|
||||
public static java.awt.Color spin(java.awt.Color c, int h, int s, int b)
|
||||
{
|
||||
float[] hsb = java.awt.Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
|
||||
hsb = spin(hsb, h, s, b);
|
||||
return java.awt.Color.getHSBColor(hsb[0], hsb[1], hsb[2]);
|
||||
}
|
||||
|
||||
public static String spinToHex(C color, int h, int s, int b)
|
||||
{
|
||||
return "#" + Integer.toHexString(spin(color.awtColor(), h, s, b).getRGB()).substring(2);
|
||||
}
|
||||
|
||||
public static String aura(String s, int hrad, int srad, int vrad) {
|
||||
String msg = compress(s);
|
||||
StringBuilder b = new StringBuilder();
|
||||
boolean c = false;
|
||||
|
||||
@@ -360,8 +394,11 @@ public enum C {
|
||||
|
||||
if(hrad != 0 || srad != 0 || vrad != 0)
|
||||
{
|
||||
//TODO: Spin to win
|
||||
b.append(C.getByChar(i).token);
|
||||
b.append("<gradient:")
|
||||
.append(spinToHex(o, hrad, srad, vrad))
|
||||
.append(":")
|
||||
.append(spinToHex(o, -hrad, -srad, -vrad))
|
||||
.append(">");
|
||||
}
|
||||
|
||||
else
|
||||
@@ -384,6 +421,11 @@ public enum C {
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public static String compress(String c)
|
||||
{
|
||||
return BaseComponent.toLegacyText(TextComponent.fromLegacyText(c));
|
||||
}
|
||||
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
}
|
||||
@@ -399,7 +441,7 @@ public enum C {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString;
|
||||
return intCode == -1 ? token : toString;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,6 +455,11 @@ public enum C {
|
||||
return chatToHex(this);
|
||||
}
|
||||
|
||||
public java.awt.Color awtColor()
|
||||
{
|
||||
return java.awt.Color.decode(hex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this code is a format code as opposed to a color code.
|
||||
*
|
||||
@@ -638,6 +685,7 @@ public enum C {
|
||||
case RED -> (byte) 12;
|
||||
case WHITE -> (byte) 15;
|
||||
case YELLOW -> (byte) 14;
|
||||
default -> (byte) 15;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -657,6 +705,7 @@ public enum C {
|
||||
case GREEN -> (byte) 5;
|
||||
case LIGHT_PURPLE -> (byte) 2;
|
||||
case WHITE -> (byte) 0;
|
||||
default -> (byte) 15;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public abstract class MortarCommand implements ICommand {
|
||||
|
||||
b = true;
|
||||
|
||||
sender.sendMessage(C.GREEN + i.getNode() + " " + C.WHITE + i.getArgsUsage() + C.GRAY + " - " + i.getDescription());
|
||||
sender.sendMessage("" + C.GREEN + i.getNode() + " " + C.WHITE + "<font:minecraft:uniform>" + i.getArgsUsage() + C.GRAY + " - " + i.getDescription());
|
||||
}
|
||||
|
||||
if (!b) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.util.plugin;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -187,10 +188,18 @@ public class VolmitSender implements CommandSender {
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
String t = C.translateAlternateColorCodes('&', getTag() + message);
|
||||
String a = C.aura(t, 12, 0, 0);
|
||||
Component c = MiniMessage.get().parse(a);
|
||||
Iris.audiences.sender(s).sendMessage(c);
|
||||
try
|
||||
{
|
||||
String t = C.translateAlternateColorCodes('&', getTag() + message);
|
||||
String a = C.aura(t, IrisSettings.get().getGeneral().getSpinh(), IrisSettings.get().getGeneral().getSpins(), IrisSettings.get().getGeneral().getSpinb());
|
||||
Component c = MiniMessage.get().parse(a);
|
||||
Iris.audiences.sender(s).sendMessage(c);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
s.sendMessage(C.translateAlternateColorCodes('&', getTag() + message));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user