mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-28 11:39:07 +00:00
Oraxen Impl & Fixes
This commit is contained in:
@@ -233,6 +233,8 @@ public class B {
|
||||
return bd;
|
||||
}
|
||||
|
||||
Iris.warn("Unknown Block Data: " + ix);
|
||||
|
||||
return AIR;
|
||||
}
|
||||
|
||||
@@ -566,14 +568,22 @@ public class B {
|
||||
v = v.split("\\Q[\\E")[0];
|
||||
}
|
||||
|
||||
if (v.contains(":")) {
|
||||
v = v.split("\\Q:\\E")[1];
|
||||
}
|
||||
|
||||
bt.add(v);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
for (String i : Iris.linkOraxen.getItemTypes()) {
|
||||
bt.add("oraxen:" + i);
|
||||
}
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return bt.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@@ -585,12 +595,6 @@ public class B {
|
||||
bt.add(v);
|
||||
}
|
||||
|
||||
if (Iris.linkOraxen.supported()) {
|
||||
for (String i : Iris.linkOraxen.getItemTypes()) {
|
||||
bt.add("oraxen:" + i);
|
||||
}
|
||||
}
|
||||
|
||||
return bt.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,18 @@
|
||||
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.plugin.VolmitSender;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -181,7 +187,7 @@ public enum C {
|
||||
/**
|
||||
* Represents magical characters that change around randomly
|
||||
*/
|
||||
MAGIC('k', 0x10, true) {
|
||||
MAGIC("<obf>", 'k', 0x10, true) {
|
||||
@Override
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.MAGIC;
|
||||
@@ -208,7 +214,7 @@ public enum C {
|
||||
/**
|
||||
* Makes the text appear underlined.
|
||||
*/
|
||||
UNDERLINE('n', 0x13, true) {
|
||||
UNDERLINE("<underlined>", 'n', 0x13, true) {
|
||||
@Override
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.UNDERLINE;
|
||||
@@ -244,6 +250,7 @@ public enum C {
|
||||
private final static C[] COLORS = new C[]{C.BLACK, C.DARK_BLUE, C.DARK_GREEN, C.DARK_AQUA, C.DARK_RED, C.DARK_PURPLE, C.GOLD, C.GRAY, C.DARK_GRAY, C.BLUE, C.GREEN, C.AQUA, C.RED, C.LIGHT_PURPLE, C.YELLOW, C.WHITE};
|
||||
private final int intCode;
|
||||
private final char code;
|
||||
private final String token;
|
||||
private final boolean isFormat;
|
||||
private final String toString;
|
||||
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
|
||||
@@ -254,22 +261,22 @@ public enum C {
|
||||
private final static Map<DyeColor, String> dyeHexMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
chatHexMap.put(C.BLACK, "#000");
|
||||
chatHexMap.put(C.DARK_BLUE, "#00a");
|
||||
chatHexMap.put(C.DARK_GREEN, "#0a0");
|
||||
chatHexMap.put(C.DARK_AQUA, "#0aa");
|
||||
chatHexMap.put(C.DARK_RED, "#a00");
|
||||
chatHexMap.put(C.DARK_PURPLE, "#a0a");
|
||||
chatHexMap.put(C.GOLD, "#fa0");
|
||||
chatHexMap.put(C.GRAY, "#999");
|
||||
chatHexMap.put(C.DARK_GRAY, "#555");
|
||||
chatHexMap.put(C.BLUE, "#55f");
|
||||
chatHexMap.put(C.GREEN, "#5c5");
|
||||
chatHexMap.put(C.AQUA, "#5cc");
|
||||
chatHexMap.put(C.RED, "#f55");
|
||||
chatHexMap.put(C.LIGHT_PURPLE, "#f5f");
|
||||
chatHexMap.put(C.YELLOW, "#cc5");
|
||||
chatHexMap.put(C.WHITE, "#aaa");
|
||||
chatHexMap.put(C.BLACK, "#000000");
|
||||
chatHexMap.put(C.DARK_BLUE, "#0000AA");
|
||||
chatHexMap.put(C.DARK_GREEN, "#00AA00");
|
||||
chatHexMap.put(C.DARK_AQUA, "#00AAAA");
|
||||
chatHexMap.put(C.DARK_RED, "#AA0000");
|
||||
chatHexMap.put(C.DARK_PURPLE, "#AA00AA");
|
||||
chatHexMap.put(C.GOLD, "#FFAA00");
|
||||
chatHexMap.put(C.GRAY, "#AAAAAA");
|
||||
chatHexMap.put(C.DARK_GRAY, "#555555");
|
||||
chatHexMap.put(C.BLUE, "#5555FF");
|
||||
chatHexMap.put(C.GREEN, "#55FF55");
|
||||
chatHexMap.put(C.AQUA, "#55FFFF");
|
||||
chatHexMap.put(C.RED, "#FF5555");
|
||||
chatHexMap.put(C.LIGHT_PURPLE, "#FF55FF");
|
||||
chatHexMap.put(C.YELLOW, "#FFFF55");
|
||||
chatHexMap.put(C.WHITE, "#FFFFFF");
|
||||
dyeChatMap.put(DyeColor.BLACK, C.DARK_GRAY);
|
||||
dyeChatMap.put(DyeColor.BLUE, C.DARK_BLUE);
|
||||
dyeChatMap.put(DyeColor.BROWN, C.GOLD);
|
||||
@@ -305,16 +312,78 @@ public enum C {
|
||||
}
|
||||
|
||||
C(char code, int intCode) {
|
||||
this(code, intCode, false);
|
||||
this("^", code, intCode, false);
|
||||
}
|
||||
|
||||
C(char code, int intCode, boolean isFormat) {
|
||||
C(String token, char code, int intCode) {
|
||||
this(token, code, intCode, false);
|
||||
}
|
||||
|
||||
C( char code, int intCode, boolean isFormat) {
|
||||
this("^", code, intCode, false);
|
||||
}
|
||||
C(String token, char code, int intCode, boolean isFormat) {
|
||||
this.code = code;
|
||||
this.token = token.equalsIgnoreCase("^") ? "<" + name().toLowerCase(Locale.ROOT) + ">" : token;
|
||||
this.intCode = intCode;
|
||||
this.isFormat = isFormat;
|
||||
this.toString = new String(new char[]{COLOR_CHAR, code});
|
||||
}
|
||||
|
||||
public static float[] spin(float[] c, int shift)
|
||||
{
|
||||
return new float[]{spin(c[0], shift),spin(c[1], shift),spin(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)};
|
||||
}
|
||||
|
||||
public static float spin(float c, int shift)
|
||||
{
|
||||
float g = ((((int)Math.floor(c * 360)) + shift) % 360) / 360F;
|
||||
return g < 0 ? 1f - g : g;
|
||||
}
|
||||
|
||||
public static String aura(String msg, int hrad, int srad, int vrad) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
boolean c = false;
|
||||
|
||||
for(char i : msg.toCharArray())
|
||||
{
|
||||
if(c)
|
||||
{
|
||||
c = false;
|
||||
|
||||
C o = C.getByChar(i);
|
||||
|
||||
if(hrad != 0 || srad != 0 || vrad != 0)
|
||||
{
|
||||
//TODO: Spin to win
|
||||
b.append(C.getByChar(i).token);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
b.append(C.getByChar(i).token);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i == C.COLOR_CHAR)
|
||||
{
|
||||
c = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
b.append(i);
|
||||
}
|
||||
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
}
|
||||
@@ -341,7 +410,7 @@ public enum C {
|
||||
}
|
||||
|
||||
public String hex() {
|
||||
return chatToHex(chatColor());
|
||||
return chatToHex(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,7 +440,8 @@ public enum C {
|
||||
*/
|
||||
public static C getByChar(char code) {
|
||||
try {
|
||||
return BY_CHAR.get(code);
|
||||
C c = BY_CHAR.get(code);
|
||||
return c == null ? C.WHITE : c;
|
||||
} catch (Exception e) {
|
||||
Iris.reportError(e);
|
||||
return C.WHITE;
|
||||
@@ -436,12 +506,12 @@ public enum C {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unlikely-arg-type")
|
||||
public static String chatToHex(ChatColor clr) {
|
||||
public static String chatToHex(C clr) {
|
||||
if (chatHexMap.containsKey(clr)) {
|
||||
return chatHexMap.get(clr);
|
||||
}
|
||||
|
||||
return "#000";
|
||||
return "#000000";
|
||||
}
|
||||
|
||||
public static String dyeToHex(DyeColor clr) {
|
||||
@@ -449,7 +519,7 @@ public enum C {
|
||||
return dyeHexMap.get(clr);
|
||||
}
|
||||
|
||||
return "#000";
|
||||
return "#000000";
|
||||
}
|
||||
|
||||
public static Color hexToColor(String hex) {
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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.util.io;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class SKConversion {
|
||||
public static void convertSchematic(File in, File out) {
|
||||
ClipboardFormat format = ClipboardFormats.findByFile(in);
|
||||
try (ClipboardReader reader = format.getReader(new FileInputStream(in))) {
|
||||
Clipboard clipboard = reader.read();
|
||||
BlockVector3 size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint());
|
||||
IrisObject o = new IrisObject(size.getBlockX() + 1, size.getBlockY() + 1, size.getBlockZ() + 1);
|
||||
|
||||
for (int i = clipboard.getMinimumPoint().getBlockX(); i <= clipboard.getMaximumPoint().getBlockX(); i++) {
|
||||
for (int j = clipboard.getMinimumPoint().getBlockY(); j <= clipboard.getMaximumPoint().getBlockY(); j++) {
|
||||
for (int k = clipboard.getMinimumPoint().getBlockZ(); k <= clipboard.getMaximumPoint().getBlockZ(); k++) {
|
||||
o.setUnsigned(i - clipboard.getMinimumPoint().getBlockX(), j - clipboard.getMinimumPoint().getBlockY(), k - clipboard.getMinimumPoint().getBlockZ(), BukkitAdapter.adapt(clipboard.getFullBlock(BlockVector3.at(i, j, k))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
o.write(out);
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,17 @@
|
||||
|
||||
package com.volmit.iris.util.plugin;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.kyori.adventure.Adventure;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.platform.AudienceProvider;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.transformation.inbuild.GradientTransformation;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -179,13 +187,16 @@ public class VolmitSender implements CommandSender {
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
s.sendMessage(C.translateAlternateColorCodes('&', getTag()) + 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String[] messages) {
|
||||
for (String str : messages)
|
||||
s.sendMessage(C.translateAlternateColorCodes('&', getTag() + str));
|
||||
sendMessage(str);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
26
src/main/java/com/volmit/iris/util/reflect/ShadeFix.java
Normal file
26
src/main/java/com/volmit/iris/util/reflect/ShadeFix.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.util.reflect;
|
||||
|
||||
public class ShadeFix {
|
||||
public static void fix(Class<?> c)
|
||||
{
|
||||
c.getCanonicalName();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user