diff --git a/src/main/java/com/volmit/iris/core/ConversionManager.java b/src/main/java/com/volmit/iris/core/ConversionManager.java index a36579004..2b0397d52 100644 --- a/src/main/java/com/volmit/iris/core/ConversionManager.java +++ b/src/main/java/com/volmit/iris/core/ConversionManager.java @@ -28,11 +28,11 @@ import com.volmit.iris.engine.object.objects.IrisDirection; import com.volmit.iris.engine.object.objects.IrisObject; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KMap; +import com.volmit.iris.util.data.B; import com.volmit.iris.util.format.Form; import com.volmit.iris.util.function.Consumer2; import com.volmit.iris.util.io.Converter; import com.volmit.iris.util.io.IO; -import com.volmit.iris.util.io.SKConversion; import com.volmit.iris.util.json.JSONObject; import com.volmit.iris.util.nbt.io.NBTUtil; import com.volmit.iris.util.nbt.io.NamedTag; @@ -42,6 +42,7 @@ import com.volmit.iris.util.nbt.tag.IntTag; import com.volmit.iris.util.nbt.tag.ListTag; import com.volmit.iris.util.plugin.VolmitSender; import com.volmit.iris.util.scheduling.J; +import net.kyori.adventure.text.minimessage.parser.Token; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.data.BlockData; @@ -62,41 +63,7 @@ public class ConversionManager { J.s(() -> J.attemptAsync(() -> { - if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) { - converters.add(new Converter() { - @Override - public String getOutExtension() { - return "iob"; - } - @Override - public String getInExtension() { - return "schem"; - } - - @Override - public void convert(File in, File out) { - SKConversion.convertSchematic(in, out); - } - }); - - converters.add(new Converter() { - @Override - public String getOutExtension() { - return "iob"; - } - - @Override - public String getInExtension() { - return "schematic"; - } - - @Override - public void convert(File in, File out) { - SKConversion.convertSchematic(in, out); - } - }); - } }), 5); } diff --git a/src/main/java/com/volmit/iris/core/WandManager.java b/src/main/java/com/volmit/iris/core/WandManager.java index 10516d71d..ea683439a 100644 --- a/src/main/java/com/volmit/iris/core/WandManager.java +++ b/src/main/java/com/volmit/iris/core/WandManager.java @@ -20,6 +20,7 @@ package com.volmit.iris.core; import com.volmit.iris.Iris; import com.volmit.iris.core.edit.DustRevealer; +import com.volmit.iris.core.wand.WandSelection; import com.volmit.iris.engine.object.objects.IrisObject; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.data.Cuboid; @@ -29,6 +30,7 @@ import com.volmit.iris.util.matter.IrisMatter; import com.volmit.iris.util.matter.Matter; import com.volmit.iris.util.matter.WorldMatter; import com.volmit.iris.util.plugin.VolmitSender; +import com.volmit.iris.util.scheduling.J; import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; @@ -57,22 +59,30 @@ public class WandManager implements Listener { public WandManager() { wand = createWand(); dust = createDust(); - Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, () -> - { + + J.ar(() -> { for (Player i : Bukkit.getOnlinePlayers()) { tick(i); } - }, 0, 5); + }, 0); } public void tick(Player p) { - try { - if (isWand(p.getInventory().getItemInMainHand())) { - Location[] d = getCuboid(p.getInventory().getItemInMainHand()); - draw(d, p); + try + { + try { + if (isWand(p.getInventory().getItemInMainHand())) { + Location[] d = getCuboid(p.getInventory().getItemInMainHand()); + new WandSelection(new Cuboid(d[0], d[1]), p).draw(); + } + } catch (Throwable e) { + Iris.reportError(e); } - } catch (Throwable e) { - Iris.reportError(e); + } + + catch(Throwable e) + { + e.printStackTrace(); } } diff --git a/src/main/java/com/volmit/iris/core/link/OraxenLink.java b/src/main/java/com/volmit/iris/core/link/OraxenLink.java index 2ee2e3d52..c19d82aaa 100644 --- a/src/main/java/com/volmit/iris/core/link/OraxenLink.java +++ b/src/main/java/com/volmit/iris/core/link/OraxenLink.java @@ -18,26 +18,86 @@ package com.volmit.iris.core.link; +import com.volmit.iris.Iris; +import com.volmit.iris.util.collection.KList; +import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.data.B; +import io.th0rgal.oraxen.items.ItemBuilder; +import io.th0rgal.oraxen.items.OraxenItems; +import io.th0rgal.oraxen.mechanics.Mechanic; +import io.th0rgal.oraxen.mechanics.MechanicFactory; +import io.th0rgal.oraxen.mechanics.MechanicsManager; +import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanic; +import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanicFactory; +import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanicFactory; +import io.th0rgal.oraxen.utils.Utils; import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; -import org.bukkit.inventory.ItemStack; +import org.bukkit.block.data.MultipleFacing; import org.bukkit.plugin.Plugin; +import java.lang.reflect.Field; +import java.util.Map; + public class OraxenLink { + private static final String[] EMPTY = new String[0]; + public boolean supported() { return getOraxen() != null; } public BlockData getBlockDataFor(String id) { - // TODO: Unimplemented - return B.get("AIR"); + if(!supported()) + { + return null; + } + + MechanicFactory f = getFactory(id); + + if(f == null) + { + return null; + } + + Mechanic m = f.getMechanic(id); + + // TODO: Why isnt there a simple getBlockData() function? + if(m.getFactory() instanceof NoteBlockMechanicFactory) + { + return ((NoteBlockMechanicFactory) m.getFactory()).createNoteBlockData(id); + } + + else if(m.getFactory() instanceof BlockMechanicFactory) + { + MultipleFacing newBlockData = (MultipleFacing)Bukkit.createBlockData(Material.MUSHROOM_STEM); + Utils.setBlockFacing(newBlockData, ((BlockMechanic)m).getCustomVariation()); + return newBlockData; + } + + return null; } - public ItemStack getItemStackForType(String item) { + public MechanicFactory getFactory(String id) + { + if(!supported()) + { + return null; + } + try { - Object itemBuilder = Class.forName("io.th0rgal.oraxen.items.OraxenItems").getDeclaredMethod("getItemById", String.class).invoke(null, item); - return (ItemStack) itemBuilder.getClass().getDeclaredMethod("getReferenceClone").invoke(itemBuilder); + Field f = MechanicsManager.class.getDeclaredField("FACTORIES_BY_MECHANIC_ID"); + f.setAccessible(true); + Map map = (Map) f.get(null); + + for(MechanicFactory i : map.values()) + { + if(i.getItems().contains(id)) + { + return i; + } + } } catch (Throwable e) { e.printStackTrace(); } @@ -46,13 +106,22 @@ public class OraxenLink { } public String[] getItemTypes() { - try { - return supported() ? (String[]) Class.forName("io.th0rgal.oraxen.items.OraxenItems").getDeclaredMethod("getItemNames").invoke(null) : new String[0]; - } catch (Throwable e) { - e.printStackTrace(); + if(!supported()) + { + return EMPTY; } - return new String[0]; + KList v = new KList<>(); + + for(String i : OraxenItems.getItemNames()) + { + if(getBlockDataFor(i) != null) + { + v.add(i); + } + } + + return v.toArray(new String[0]); } public Plugin getOraxen() { diff --git a/src/main/java/com/volmit/iris/core/wand/WandSelection.java b/src/main/java/com/volmit/iris/core/wand/WandSelection.java new file mode 100644 index 000000000..11942f9b4 --- /dev/null +++ b/src/main/java/com/volmit/iris/core/wand/WandSelection.java @@ -0,0 +1,125 @@ +/* + * 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 . + */ + +package com.volmit.iris.core.wand; + +import com.volmit.iris.Iris; +import com.volmit.iris.util.data.Cuboid; +import com.volmit.iris.util.math.M; +import com.volmit.iris.util.math.RNG; +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import java.awt.*; + +public class WandSelection { + private final Cuboid c; + private final Player p; + + public WandSelection(Cuboid c, Player p) + { + this.c = c; + this.p = p; + } + + public void draw() + { + double accuracy = M.lerpInverse(0, 64 * 64, p.getLocation().distanceSquared(c.getCenter())); + double dist = M.lerp(0.125, 3.5, accuracy); + + for(double i = c.getLowerX()-1; i < c.getUpperX()+1; i+=0.25) + { + for(double j = c.getLowerY()-1; j < c.getUpperY()+1; j+=0.25) + { + for(double k = c.getLowerZ()-1; k < c.getUpperZ()+1; k+=0.25) + { + boolean ii = i == c.getLowerX() || i == c.getUpperX(); + boolean jj = j == c.getLowerY() || j == c.getUpperY(); + boolean kk = k == c.getLowerZ() || k == c.getUpperZ(); + + if ((ii && jj) || (ii && kk) || (kk && jj)) { + Vector push = new Vector(0, 0, 0); + + if (i == c.getLowerX()) { + push.add(new Vector(-0.55, 0, 0)); + } + + if (j == c.getLowerY()) { + push.add(new Vector(0, -0.55, 0)); + } + + if (k == c.getLowerZ()) { + push.add(new Vector(0, 0, -0.55)); + } + + if (i == c.getUpperX()) { + push.add(new Vector(0.55, 0, 0)); + } + + if (j == c.getUpperY()) { + push.add(new Vector(0, 0.55, 0)); + } + + if (k == c.getUpperZ()) { + push.add(new Vector(0, 0, 0.55)); + } + + Location a = new Location(c.getWorld(), i, j, k).add(0.5, 0.5, 0.5).add(push); + accuracy = M.lerpInverse(0, 64 * 64, p.getLocation().distanceSquared(a)); + dist = M.lerp(0.125, 3.5, accuracy); + + if(M.r(M.min(dist, 1D) * 0.99)) + { + continue; + } + + if(ii && jj) + { + a.add(0, 0, RNG.r.d(-0.3, 0.3)); + } + + if(kk && jj) + { + a.add(RNG.r.d(-0.3, 0.3), 0, 0); + } + + if(ii && kk) + { + a.add(0, RNG.r.d(-0.3, 0.3), 0); + } + + if(p.getLocation().distanceSquared(a) < 256 * 256) + { + Color color = Color.getHSBColor((float) (0.5f + (Math.sin((i + j + k + (p.getTicksLived() / 2f)) / (20f)) / 2)), 1, 1); + int r = color.getRed(); + int g = color.getGreen(); + int b = color.getBlue(); + + p.spawnParticle(Particle.REDSTONE, a.getX(), a.getY(), a.getZ(), + 1, 0, 0, 0, 0, + new Particle.DustOptions(org.bukkit.Color.fromRGB(r, g, b), + (float) dist*2f)); + } + } + } + } + } + } +} diff --git a/src/main/java/com/volmit/iris/engine/object/block/IrisBlockData.java b/src/main/java/com/volmit/iris/engine/object/block/IrisBlockData.java index c8fa40f38..6e796df3b 100644 --- a/src/main/java/com/volmit/iris/engine/object/block/IrisBlockData.java +++ b/src/main/java/com/volmit/iris/engine/object/block/IrisBlockData.java @@ -51,9 +51,6 @@ public class IrisBlockData extends IrisRegistrant { @Desc("Debug this block by printing it to the console when it's used. Must have debug turned on in settings.") private boolean debug = false; - @Desc("The resource key. Typically Minecraft") - private String key = "minecraft"; - @MinNumber(1) @MaxNumber(1000) @Desc("The weight is used when this block data is inside of a list of blockdata. A weight of two is just as if you placed two of the same block data values in the same list making it more common when randomly picked.") @@ -115,7 +112,7 @@ public class IrisBlockData extends IrisRegistrant { cdata.put(i, getData().get(i)); } - String sx = getKey() + ":" + st.split("\\Q:\\E")[1] + computeProperties(cdata); + String sx = keyify(st) + computeProperties(cdata); if (debug) { Iris.debug("Block Data used " + sx + " (CUSTOM)"); @@ -133,7 +130,7 @@ public class IrisBlockData extends IrisRegistrant { } } - String ss = getKey() + ":" + getBlock() + computeProperties(); + String ss = keyify(getBlock()) + computeProperties(); b = B.get(ss); if (debug) { @@ -152,34 +149,37 @@ public class IrisBlockData extends IrisRegistrant { }); } + private String keyify(String dat) + { + if(dat.contains(":")) + { + return dat; + } + + return "minecraft:" + dat; + } + public static IrisBlockData from(String j) { IrisBlockData b = new IrisBlockData(); - String m = j.toLowerCase().trim(); + String v = j.toLowerCase().trim(); - if (m.contains(":")) { - b.setKey(m.split("\\Q:\\E")[0]); - String v = m.split("\\Q:\\E")[1]; + if (v.contains("[")) { + KList props = new KList<>(); + String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", ""); + b.setBlock(v.split("\\Q[\\E")[0]); - if (v.contains("[")) { - KList props = new KList<>(); - String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", ""); - b.setBlock(v.split("\\Q[\\E")[0]); - - if (rp.contains(",")) { - props.add(rp.split("\\Q,\\E")); - } else { - props.add(rp); - } - - for (String i : props) { - Object kg = filter(i.split("\\Q=\\E")[1]); - b.data.put(i.split("\\Q=\\E")[0], kg); - } + if (rp.contains(",")) { + props.add(rp.split("\\Q,\\E")); } else { - b.setBlock(v); + props.add(rp); + } + + for (String i : props) { + Object kg = filter(i.split("\\Q=\\E")[1]); + b.data.put(i.split("\\Q=\\E")[0], kg); } } else { - b.setBlock(m); + b.setBlock(v); } return b; diff --git a/src/main/java/com/volmit/iris/util/data/B.java b/src/main/java/com/volmit/iris/util/data/B.java index b13d3bd65..6cdb1c417 100644 --- a/src/main/java/com/volmit/iris/util/data/B.java +++ b/src/main/java/com/volmit/iris/util/data/B.java @@ -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]); } } diff --git a/src/main/java/com/volmit/iris/util/format/C.java b/src/main/java/com/volmit/iris/util/format/C.java index 6cc96512b..f69f47997 100644 --- a/src/main/java/com/volmit/iris/util/format/C.java +++ b/src/main/java/com/volmit/iris/util/format/C.java @@ -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("", '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("", '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 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) { diff --git a/src/main/java/com/volmit/iris/util/io/SKConversion.java b/src/main/java/com/volmit/iris/util/io/SKConversion.java deleted file mode 100644 index b92b9dd6a..000000000 --- a/src/main/java/com/volmit/iris/util/io/SKConversion.java +++ /dev/null @@ -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 . - */ - -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(); - } - } -} diff --git a/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java b/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java index 33df53cbb..8a8f8da12 100644 --- a/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java +++ b/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java @@ -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 diff --git a/src/main/java/com/volmit/iris/util/reflect/ShadeFix.java b/src/main/java/com/volmit/iris/util/reflect/ShadeFix.java new file mode 100644 index 000000000..2b63145f1 --- /dev/null +++ b/src/main/java/com/volmit/iris/util/reflect/ShadeFix.java @@ -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 . + */ + +package com.volmit.iris.util.reflect; + +public class ShadeFix { + public static void fix(Class c) + { + c.getCanonicalName(); + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7032a2aa3..03f999133 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -8,8 +8,8 @@ description: More than a Dimension! libraries: - org.zeroturnaround:zt-zip:1.14 - com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2 - - org.ow2.asm:asm:9.0 - - com.google.code.gson:gson:2.8.5 + - org.ow2.asm:asm:9.2 + - com.google.code.gson:gson:2.8.7 - it.unimi.dsi:fastutil:8.5.4 - com.google.guava:guava:30.1.1-jre commands: