This commit is contained in:
Daniel Mills 2021-08-06 10:22:28 -04:00
parent d9cd0257ba
commit ef5897969f
9 changed files with 159 additions and 22 deletions

View File

@ -32,7 +32,7 @@ plugins {
} }
group 'com.volmit.iris' group 'com.volmit.iris'
version '1.6.2' version '1.6.3'
def apiVersion = '1.17' def apiVersion = '1.17'
def name = 'Iris' def name = 'Iris'
def main = 'com.volmit.iris.Iris' def main = 'com.volmit.iris.Iris'

View File

@ -250,7 +250,7 @@ public class Iris extends VolmitPlugin implements Listener {
@Override @Override
public String getTag(String subTag) { public String getTag(String subTag) {
return C.BOLD + "" + C.DARK_GRAY + "[" + C.BOLD + "" + C.GREEN + "Iris" + C.BOLD + C.DARK_GRAY + "]" + C.RESET + "" + C.GRAY + ": "; return C.BOLD + "" + C.DARK_GRAY + "[" + C.BOLD + "" + C.IRIS + "Iris" + C.BOLD + C.DARK_GRAY + "]" + C.RESET + "" + C.GRAY + ": ";
} }
private void checkConfigHotload() { private void checkConfigHotload() {
@ -423,7 +423,7 @@ public class Iris extends VolmitPlugin implements Listener {
} }
public void imsg(CommandSender s, String msg) { public void imsg(CommandSender s, String msg) {
s.sendMessage(C.GREEN + "[" + C.DARK_GRAY + "Iris" + C.GREEN + "]" + C.GRAY + ": " + msg); s.sendMessage(C.IRIS + "[" + C.DARK_GRAY + "Iris" + C.IRIS + "]" + C.GRAY + ": " + msg);
} }
@ -442,9 +442,16 @@ public class Iris extends VolmitPlugin implements Listener {
public static void msg(String string) { public static void msg(String string) {
try { try {
sender.sendMessage(string); sender.sendMessage(string);
} catch (Throwable e) { } catch (Throwable ignored) {
System.out.println(string); try
Iris.reportError(e); {
System.out.println(string);
}
catch(Throwable ignored1)
{
}
} }
} }
@ -537,7 +544,7 @@ public class Iris extends VolmitPlugin implements Listener {
} }
public static void success(String string) { public static void success(String string) {
msg(C.GREEN + string); msg(C.IRIS + string);
} }
public static void info(String string) { public static void info(String string) {
@ -557,9 +564,9 @@ public class Iris extends VolmitPlugin implements Listener {
// @NoArgsConstructor // @NoArgsConstructor
String padd = Form.repeat(" ", 8); String padd = Form.repeat(" ", 8);
String padd2 = Form.repeat(" ", 4); String padd2 = Form.repeat(" ", 4);
String[] info = {"", "", "", "", "", padd2 + C.GREEN + " Iris", padd2 + C.GRAY + " by " + C.randomColor() + "V" + C.randomColor() + "o" + C.randomColor() + "l" + C.randomColor() + "m" + C.randomColor() + "i" + C.randomColor() + "t" + C.randomColor() + "S" + C.randomColor() + "o" + C.randomColor() + "f" + C.randomColor() + "t" + C.randomColor() + "w" + C.randomColor() + "a" + C.randomColor() + "r" + C.randomColor() + "e", padd2 + C.GRAY + " v" + getDescription().getVersion(), String[] info = {"", "", "", "", "", padd2 + C.IRIS + " Iris", padd2 + C.GRAY + " by " + "<rainbow>Volmit Software", padd2 + C.GRAY + " v" + C.IRIS + getDescription().getVersion(),
}; };
String[] splash = {padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@", padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.GREEN + " .(((()))). ", padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.GREEN + " .((((((())))))). ", padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.GREEN + " ((((((((())))))))) " + C.GRAY + " @", padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.GREEN + " ((((((((-))))))))) " + C.GRAY + " @@", padd + C.GRAY + "@@@&&" + C.GREEN + " ((((((({ })))))))) " + C.GRAY + " &&@@@", padd + C.GRAY + "@@" + C.GREEN + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@", padd + C.GRAY + "@" + C.GREEN + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@", padd + C.GRAY + "" + C.GREEN + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@", padd + C.GRAY + "" + C.GREEN + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@", padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@" String[] splash = {padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@", padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.IRIS + " .(((()))). ", padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.IRIS + " .((((((())))))). ", padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.IRIS + " ((((((((())))))))) " + C.GRAY + " @", padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.IRIS + " ((((((((-))))))))) " + C.GRAY + " @@", padd + C.GRAY + "@@@&&" + C.IRIS + " ((((((({ })))))))) " + C.GRAY + " &&@@@", padd + C.GRAY + "@@" + C.IRIS + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@", padd + C.GRAY + "@" + C.IRIS + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@", padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
}; };
//@done //@done
Iris.info("Server type & version: " + Bukkit.getVersion()); Iris.info("Server type & version: " + Bukkit.getVersion());

View File

@ -107,6 +107,9 @@ public class IrisSettings {
public boolean pluginMetrics = true; public boolean pluginMetrics = true;
public boolean splashLogoStartup = true; public boolean splashLogoStartup = true;
public String forceMainWorld = ""; public String forceMainWorld = "";
public int spinh = -20;
public int spins = 7;
public int spinb = 8;
} }
@Data @Data

View File

@ -64,7 +64,7 @@ public class WandManager implements Listener {
for (Player i : Bukkit.getOnlinePlayers()) { for (Player i : Bukkit.getOnlinePlayers()) {
tick(i); tick(i);
} }
}, 0); }, 5);
} }
public void tick(Player p) { public void tick(Player p) {

View File

@ -75,6 +75,9 @@ public class CommandIris extends MortarCommand {
@Command @Command
private CommandIrisReload reload; private CommandIrisReload reload;
@Command
private CommandIrisAura aura;
public CommandIris() { public CommandIris() {
super("iris", "ir", "irs"); super("iris", "ir", "irs");
requiresPermission(Iris.perm); requiresPermission(Iris.perm);

View File

@ -0,0 +1,66 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.command;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.plugin.MortarCommand;
import com.volmit.iris.util.plugin.VolmitSender;
public class CommandIrisAura extends MortarCommand {
public CommandIrisAura() {
super("aura", "au");
requiresPermission(Iris.perm.studio);
setDescription("Set aura spins");
setCategory("Studio");
}
@Override
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
}
@Override
public boolean handle(VolmitSender sender, String[] args) {
try
{
int h = Integer.parseInt(args[0]);
int s = Integer.parseInt(args[1]);
int b = Integer.parseInt(args[2]);
IrisSettings.get().getGeneral().setSpinh(h);
IrisSettings.get().getGeneral().setSpins(s);
IrisSettings.get().getGeneral().setSpinb(b);
IrisSettings.get().forceSave();
sender.sendMessage("<rainbow>Aura Spins updated to " + h + " " + s + " " + b);
}
catch(Throwable b)
{
sender.sendMessage(getArgsUsage());
}
return true;
}
@Override
protected String getArgsUsage() {
return "<spinH> <spinS> <spinB>";
}
}

View File

@ -21,7 +21,11 @@ package com.volmit.iris.util.format;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.nms.INMS; import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.engine.object.biome.IrisBiomeCustom; import com.volmit.iris.engine.object.biome.IrisBiomeCustom;
import com.volmit.iris.util.math.M;
import com.volmit.iris.util.plugin.VolmitSender; 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.apache.commons.lang.Validate;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
@ -139,6 +143,14 @@ public enum C {
return net.md_5.bungee.api.ChatColor.GREEN; 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 * Represents aqua
*/ */
@ -238,8 +250,10 @@ public enum C {
public net.md_5.bungee.api.ChatColor asBungee() { public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.RESET; return net.md_5.bungee.api.ChatColor.RESET;
} }
}; },
;
/** /**
* The special character which prefixes all chat colour codes. Use this if you * The special character which prefixes all chat colour codes. Use this if you
* need to dynamically convert colour codes from your custom format. * need to dynamically convert colour codes from your custom format.
@ -263,6 +277,7 @@ public enum C {
static { static {
chatHexMap.put(C.BLACK, "#000000"); chatHexMap.put(C.BLACK, "#000000");
chatHexMap.put(C.DARK_BLUE, "#0000AA"); chatHexMap.put(C.DARK_BLUE, "#0000AA");
chatHexMap.put(C.IRIS, "#1bb19e");
chatHexMap.put(C.DARK_GREEN, "#00AA00"); chatHexMap.put(C.DARK_GREEN, "#00AA00");
chatHexMap.put(C.DARK_AQUA, "#00AAAA"); chatHexMap.put(C.DARK_AQUA, "#00AAAA");
chatHexMap.put(C.DARK_RED, "#AA0000"); chatHexMap.put(C.DARK_RED, "#AA0000");
@ -332,12 +347,12 @@ public enum C {
public static float[] spin(float[] c, int shift) 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) 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) public static float spin(float c, int shift)
@ -346,7 +361,26 @@ public enum C {
return g < 0 ? 1f - g : g; 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(); StringBuilder b = new StringBuilder();
boolean c = false; boolean c = false;
@ -360,8 +394,11 @@ public enum C {
if(hrad != 0 || srad != 0 || vrad != 0) if(hrad != 0 || srad != 0 || vrad != 0)
{ {
//TODO: Spin to win b.append("<gradient:")
b.append(C.getByChar(i).token); .append(spinToHex(o, hrad, srad, vrad))
.append(":")
.append(spinToHex(o, -hrad, -srad, -vrad))
.append(">");
} }
else else
@ -384,6 +421,11 @@ public enum C {
return b.toString(); return b.toString();
} }
public static String compress(String c)
{
return BaseComponent.toLegacyText(TextComponent.fromLegacyText(c));
}
public net.md_5.bungee.api.ChatColor asBungee() { public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.RESET; return net.md_5.bungee.api.ChatColor.RESET;
} }
@ -399,7 +441,7 @@ public enum C {
@Override @Override
public String toString() { public String toString() {
return toString; return intCode == -1 ? token : toString;
} }
/** /**
@ -413,6 +455,11 @@ public enum C {
return chatToHex(this); 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. * 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 RED -> (byte) 12;
case WHITE -> (byte) 15; case WHITE -> (byte) 15;
case YELLOW -> (byte) 14; case YELLOW -> (byte) 14;
default -> (byte) 15;
}; };
} }
@ -657,6 +705,7 @@ public enum C {
case GREEN -> (byte) 5; case GREEN -> (byte) 5;
case LIGHT_PURPLE -> (byte) 2; case LIGHT_PURPLE -> (byte) 2;
case WHITE -> (byte) 0; case WHITE -> (byte) 0;
default -> (byte) 15;
}; };
} }

View File

@ -91,7 +91,7 @@ public abstract class MortarCommand implements ICommand {
b = true; 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) { if (!b) {

View File

@ -19,6 +19,7 @@
package com.volmit.iris.util.plugin; package com.volmit.iris.util.plugin;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.C;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -187,10 +188,18 @@ public class VolmitSender implements CommandSender {
@Override @Override
public void sendMessage(String message) { public void sendMessage(String message) {
String t = C.translateAlternateColorCodes('&', getTag() + message); try
String a = C.aura(t, 12, 0, 0); {
Component c = MiniMessage.get().parse(a); String t = C.translateAlternateColorCodes('&', getTag() + message);
Iris.audiences.sender(s).sendMessage(c); 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 @Override