Release Candidate 1

Alpha Release Candidate 1; almost ready for official Alpha Release.
This commit is contained in:
Paldiu 2021-04-27 15:25:50 -05:00
parent e617b0f87a
commit f3e4aab3ce
26 changed files with 103 additions and 651 deletions

View File

@ -4,25 +4,23 @@ import org.bukkit.Color;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
/** /**
* This interface is intended for creating custom potion effects. * This interface is intended for creating custom potion effects.
*/ */
public interface IPotionEffect { public interface ICompoundEffect {
@NotNull @NotNull
PotionEffect getEffect(); List<PotionEffect> getEffects();
@NotNull
PotionEffectType getType();
@NotNull @NotNull
String getName(); String getName();
@NotNull @NotNull
Long getDuration(); Integer getDuration();
@Nullable @Nullable
Particle getParticleType(); Particle getParticleType();

View File

@ -1,13 +0,0 @@
package io.github.simplexdev.api;
import org.bukkit.NamespacedKey;
public interface IEnchant {
NamespacedKey getNamespacedKey();
String getName();
Integer getMaximumLevel();
Boolean isGlowing();
}

View File

@ -5,11 +5,6 @@ import io.github.simplexdev.api.annotations.Requires;
import io.github.simplexdev.simplexcore.command.defaults.Command_info; import io.github.simplexdev.simplexcore.command.defaults.Command_info;
import io.github.simplexdev.simplexcore.config.Yaml; import io.github.simplexdev.simplexcore.config.Yaml;
import io.github.simplexdev.simplexcore.config.YamlFactory; import io.github.simplexdev.simplexcore.config.YamlFactory;
import io.github.simplexdev.simplexcore.crafting.RecipeBuilder;
import io.github.simplexdev.simplexcore.module.DependencyManagement;
import io.github.simplexdev.simplexcore.task.Announcer;
import io.github.simplexdev.simplexcore.listener.DependencyListener;
import io.github.simplexdev.simplexcore.listener.SimplexListener;
import io.github.simplexdev.simplexcore.module.SimplexModule; import io.github.simplexdev.simplexcore.module.SimplexModule;
@Requires(ReqType.SPIGOT) @Requires(ReqType.SPIGOT)
@ -17,7 +12,6 @@ public final class SimplexCorePlugin extends SimplexModule<SimplexCorePlugin> {
private static boolean debug = false; private static boolean debug = false;
private static boolean suspended = false; private static boolean suspended = false;
private static SimplexCorePlugin instance; private static SimplexCorePlugin instance;
private DependencyManagement dpm;
private Yaml config; private Yaml config;
private Yaml internals; private Yaml internals;
@ -33,7 +27,6 @@ public final class SimplexCorePlugin extends SimplexModule<SimplexCorePlugin> {
@Override @Override
public void init() { public void init() {
SimplexCorePlugin.instance = this; SimplexCorePlugin.instance = this;
this.dpm = new DependencyManagement();
this.config = new YamlFactory(this).setDefaultPathways(); this.config = new YamlFactory(this).setDefaultPathways();
this.internals = new YamlFactory(this).from("internals.yml", getParentFolder(), "internals.yml"); this.internals = new YamlFactory(this).from("internals.yml", getParentFolder(), "internals.yml");
} }
@ -45,9 +38,6 @@ public final class SimplexCorePlugin extends SimplexModule<SimplexCorePlugin> {
getCommandLoader().classpath(this, Command_info.class).load(); getCommandLoader().classpath(this, Command_info.class).load();
getYamlConfig().reload(); getYamlConfig().reload();
getInternals().reload(); getInternals().reload();
//
SimplexListener.register(new DependencyListener(), this);
new Announcer(this);
} catch (Exception ex) { } catch (Exception ex) {
suspended = true; suspended = true;
// TODO: Write an output to a file with why it suspended. // TODO: Write an output to a file with why it suspended.
@ -74,13 +64,11 @@ public final class SimplexCorePlugin extends SimplexModule<SimplexCorePlugin> {
return suspended; return suspended;
} }
public DependencyManagement getDependencyManager() {
return dpm;
}
public Yaml getYamlConfig() { public Yaml getYamlConfig() {
return config; return config;
} }
public Yaml getInternals() { return internals; } public Yaml getInternals() {
return internals;
}
} }

View File

@ -1,33 +0,0 @@
package io.github.simplexdev.simplexcore.config;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.github.simplexdev.api.IJson;
import io.github.simplexdev.api.func.Path;
import io.github.simplexdev.simplexcore.module.SimplexModule;
import org.json.simple.JSONObject;
public final class Json implements IJson {
// TODO: Write actual JSON implementations.
//
private final Gson gson;
private final SimplexModule<?> plugin;
Json(SimplexModule<?> plugin) {
this.gson = new GsonBuilder().setPrettyPrinting().create();
this.plugin = plugin;
}
final Gson getGson() {
return gson;
}
public final SimplexModule<?> getPlugin() {
return plugin;
}
@Override
public JSONObject getJSONObject(Path path) {
return null;
}
}

View File

@ -1,5 +0,0 @@
package io.github.simplexdev.simplexcore.config;
public final class JsonFactory {
// TODO: Write a JSON Object Factory.
}

View File

@ -151,13 +151,13 @@ public final class Yaml implements IConfig {
* Called when a file is created. * Called when a file is created.
*/ */
public void create() { public void create() {
SimplexCorePlugin.getInstance().getLogger().info("File created!"); plugin.getLogger().info("File created!");
} }
/** /**
* Called when then file is reloaded * Called when then file is reloaded
*/ */
public void onReload() { public void onReload() {
SimplexCorePlugin.getInstance().getLogger().info("The plugin configuration has been reloaded!"); plugin.getLogger().info("The plugin configuration has been reloaded!");
} }
} }

View File

@ -196,14 +196,22 @@ public class ItemBuilder {
public final Worker setUnbreakable(boolean unbreakable) { public final Worker setUnbreakable(boolean unbreakable) {
meta.setUnbreakable(unbreakable); meta.setUnbreakable(unbreakable);
stack.setItemMeta(meta);
return this; return this;
} }
/** /**
* @return The final item. * @return The final item.
*/ */
public final ItemStack get() { public final ItemStack getItem() {
return stack; return stack;
} }
/**
* @return The ItemMeta of the item.
*/
public final ItemMeta getItemMeta() {
return meta;
}
} }
} }

View File

@ -1,47 +0,0 @@
package io.github.simplexdev.simplexcore.crafting;
import io.github.simplexdev.simplexcore.module.SimplexModule;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
public class RBImpl {
private final RecipeBuilder builder;
private final SimplexModule<?> plugin;
private final ItemBuilder bldr;
public RBImpl(SimplexModule<?> plugin) {
this.plugin = plugin;
this.builder = new RecipeBuilder(plugin);
this.bldr = new ItemBuilder(plugin);
chainMailBoots();
customWand();
}
public void chainMailBoots() {
ItemStack is = bldr.createNoBounds(Material.CHAINMAIL_BOOTS);
builder.of(is, "chainmail_boots", true)
.addIngredient('c', Material.CHAIN)
.addIngredient('a', Material.AIR)
.setShape("aaa", "cac", "cac")
.create();
}
public void customWand() {
ItemStack is = bldr.newItem(Material.BLAZE_ROD)
.setName("Magic Wand")
.addLore("This wand is magical.")
.addEnchant(Enchantment.KNOCKBACK, 10)
.addAttribute(Attribute.GENERIC_ATTACK_KNOCKBACK,
bldr.multiply("generic_attack_knockback", 24.0))
.get();
builder.of(is, "magic_wand", true)
.addIngredient('b', Material.BLAZE_ROD)
.addIngredient('n', Material.NETHER_STAR)
.addIngredient('a', Material.AIR)
.setShape("aan", "aba", "baa")
.create();
}
}

View File

@ -4,7 +4,12 @@ import io.github.simplexdev.simplexcore.module.SimplexModule;
import io.github.simplexdev.simplexcore.utils.Utilities; import io.github.simplexdev.simplexcore.utils.Utilities;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.ShapelessRecipe;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -30,7 +35,7 @@ public final class RecipeBuilder {
* @param isShaped Whether or not the recipe is shaped or shapeless. * @param isShaped Whether or not the recipe is shaped or shapeless.
* @return A new appendable RecipeBuilder Worker instance based on the given parameters. * @return A new appendable RecipeBuilder Worker instance based on the given parameters.
*/ */
public final Worker of(ItemStack result, String recipeName, boolean isShaped) { public final Worker newRecipe(ItemStack result, String recipeName, boolean isShaped) {
return new Worker(result, recipeName, isShaped); return new Worker(result, recipeName, isShaped);
} }
@ -72,6 +77,9 @@ public final class RecipeBuilder {
return recipe; return recipe;
} }
/**
* Creates the recipe and registers it with Bukkit.
*/
public void create() { public void create() {
plugin.getServer().addRecipe(shaped ? sha() : nosha()); plugin.getServer().addRecipe(shaped ? sha() : nosha());
} }

View File

@ -1,29 +1,6 @@
package io.github.simplexdev.simplexcore.enchanting; package io.github.simplexdev.simplexcore.enchanting;
import io.github.simplexdev.api.annotations.Enchant; import net.minecraft.server.v1_16_R3.Enchantment;
import io.github.simplexdev.simplexcore.utils.ReflectionTools;
import org.bukkit.enchantments.EnchantmentWrapper;
import java.lang.reflect.Constructor;
public class EnchUtils { public class EnchUtils {
public SimplexEnch enchantment;
public <T extends SimplexEnch> void loadFrom(Class<T> clz) {
Enchant info = clz.getDeclaredAnnotation(Enchant.class);
if (info == null) {
// TODO
return;
}
ReflectionTools.reflect(clz).getTypesAnnotatedWith(info).forEach(cls -> {
Constructor<?> c = ReflectionTools.getDeclaredConstructor(cls);
if (c == null) return;
SimplexEnch ench = (SimplexEnch) ReflectionTools.initConstructor(c);
load(ench);
});
}
public <T extends SimplexEnch> void load(T enchantment) {} // TODO
} }

View File

@ -1,23 +1,24 @@
package io.github.simplexdev.simplexcore.enchanting; package io.github.simplexdev.simplexcore.enchanting;
import io.github.simplexdev.api.IEnchant;
import io.github.simplexdev.simplexcore.module.SimplexModule; import io.github.simplexdev.simplexcore.module.SimplexModule;
import net.minecraft.server.v1_16_R3.EnchantmentSlotType; import net.minecraft.server.v1_16_R3.EnchantmentSlotType;
import net.minecraft.server.v1_16_R3.EnumItemRarity;
import net.minecraft.server.v1_16_R3.EnumItemSlot; import net.minecraft.server.v1_16_R3.EnumItemSlot;
import net.minecraft.server.v1_16_R3.Enchantment; import net.minecraft.server.v1_16_R3.Enchantment;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
public abstract class SimplexEnch extends Enchantment implements IEnchant { public abstract class SimplexEnch extends Enchantment {
protected final SimplexModule<?> plugin; private final SimplexModule<?> plugin;
private final Rarity rarity;
protected SimplexEnch(SimplexModule<?> plugin, Rarity rarity, EnchantmentSlotType type, EnumItemSlot[] enumSlot) { protected SimplexEnch(SimplexModule<?> plugin, Rarity rarity, EnchantmentSlotType type, EnumItemSlot[] enumSlot) {
super(rarity, type, enumSlot); super(rarity, type, enumSlot);
this.rarity = rarity;
this.plugin = plugin; this.plugin = plugin;
} }
public abstract String name(); public abstract String name();
@Override
public NamespacedKey getNamespacedKey() { public NamespacedKey getNamespacedKey() {
return new NamespacedKey(plugin, name()); return new NamespacedKey(plugin, name());
} }

View File

@ -1,44 +0,0 @@
package io.github.simplexdev.simplexcore.listener;
import io.github.simplexdev.simplexcore.SimplexCorePlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.server.PluginEnableEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BooleanSupplier;
public final class DependencyListener extends SimplexListener {
public List<String> PAPI_NAMES = new ArrayList<>() {{
add("PlaceholderAPI");
add("PlaceHolderAPI");
add("placeholderapi");
add("PLACEHOLDERAPI");
add("PAPI");
add("papi");
}};
public List<String> PLIB_NAMES = new ArrayList<>() {{
add("ProtocolLib");
add("PLib");
add("Protocollib");
add("plib");
add("protocollib");
add("PROTOCOLLIB");
}};
@EventHandler(priority = EventPriority.HIGHEST)
public void pluginRegister(PluginEnableEvent event) {
BooleanSupplier temp = () -> PLIB_NAMES.contains(event.getPlugin().getName());
BooleanSupplier temp2 = () -> PAPI_NAMES.contains(event.getPlugin().getName());
if (temp.getAsBoolean()) {
SimplexCorePlugin.getInstance().getDependencyManager().registerProtocolLib();
}
if (temp2.getAsBoolean()) {
SimplexCorePlugin.getInstance().getDependencyManager().registerPAPI();
}
}
}

View File

@ -1,51 +0,0 @@
package io.github.simplexdev.simplexcore.math;
import io.github.simplexdev.simplexcore.SimplexCorePlugin;
import io.github.simplexdev.simplexcore.utils.TickedTime;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.scheduler.BukkitTask;
import java.util.function.Consumer;
public final class Cuboid {
private final int x, y, z;
public Cuboid() {
this(3, 3, 3);
}
public Cuboid(int xSize, int ySize, int zSize) {
this.x = xSize;
this.y = ySize;
this.z = zSize;
}
public Cuboid(Size size) {
this(size.getX(), size.getY(), size.getZ());
}
public void generate(Location location, Material material) {
Consumer<BukkitTask> task = bukkitTask -> {
int t1 = location.getBlockX();
int t2 = location.getBlockY();
int t3 = location.getBlockZ();
int a = t1 + x;
int b = t2 + y;
int c = t3 + z;
for (int currentX = t1; currentX < a; currentX++) {
for (int currentY = t2; currentY < b; currentY++) {
for (int currentZ = t3; currentZ < c; currentZ++) {
location.getWorld().getBlockAt(currentX, currentY, currentZ).setType(material);
}
}
}
};
SimplexCorePlugin.getInstance().getScheduler().runTaskLaterAsynchronously(SimplexCorePlugin.getInstance(), task,
TickedTime.SECOND);
}
}

View File

@ -1,149 +0,0 @@
package io.github.simplexdev.simplexcore.math;
import io.github.simplexdev.simplexcore.SimplexCorePlugin;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.scheduler.BukkitTask;
import java.util.function.Consumer;
public final class Pyramid {
private final int height;
private Location location;
private Material material;
public Pyramid(int height, Location location, Material material) {
this.height = height;
this.location = location;
this.material = material;
}
public Pyramid(Size size, Location location, Material material) {
this.height = size.getY();
this.location = location;
this.material = material;
}
public void setLocation(Location location) {
this.location = location;
}
public void setMaterial(Material material) {
this.material = material;
}
public void generate() {
Consumer<BukkitTask> consumer = bukkitTask -> {
System.out.println(height % 2 == 0);
if (height % 2 == 0)
createEvenFull();
else
createOddFull();
};
SimplexCorePlugin.getInstance().getScheduler().runTaskLater(SimplexCorePlugin.getInstance(), consumer, 20L);
}
private void createOddFull() {
int locX = location.getBlockX();
int locY = location.getBlockY();
int locZ = location.getBlockZ();
int currentArea = 1;
for (int y = height; y > 0; y--) {
for (int x = -(int) (Math.floor(currentArea / (double) 2)); x <= (int) Math.floor(currentArea / (double) 2); x++) {
for (int z = -(int) (Math.floor(currentArea / (double) 2)); z <= (int) Math.floor(currentArea / (double) 2); z++) {
Block block = location.getWorld().getBlockAt(locX + x, locY + y, locZ + z);
block.setType(material);
}
}
currentArea += 2;
}
}
private void createEvenFull() {
createEvenSide(1);
location.setX(location.getBlockX() + 1);
createEvenSide(2);
location.setZ(location.getBlockZ() + 1);
createEvenSide(3);
location.setX(location.getBlockX() - 1);
createEvenSide(4);
}
private void createEvenSide(int quadrant) {
int locX = location.getBlockX();
int locY = location.getBlockY();
int locZ = location.getBlockZ();
int currentArea = 1;
int x = currentArea;
int z = currentArea;
switch (quadrant) {
case 1:
x = +x;
z = +z;
break;
case 2:
x = -x;
z = +z;
break;
case 3:
x = -x;
z = -z;
break;
case 4:
x = +x;
z = -z;
break;
}
for (int y2 = locY + height; y2 > locY; y2--) {
for (int x2 = x; x2 != 0; x2 = decreaseOrIncrease(x2)) {
for (int z2 = z; z2 != 0; z2 = decreaseOrIncrease(z2)) {
Block block = location.getWorld().getBlockAt(locX + x2, y2, locZ + z2);
block.setType(material);
}
}
x += x > 0 ? 1 : -1;
z += z > 0 ? 1 : -1;
}
}
private int decreaseOrIncrease(int x) {
if (x > 0)
x--;
else if (x < 0)
x++;
return x;
}
}

View File

@ -1,30 +0,0 @@
package io.github.simplexdev.simplexcore.math;
public enum Size {
SMALL(1, 1, 1),
MEDIUM(3, 3, 3),
LARGE(5, 5, 5),
EXTRA_LARGE(10, 10, 10),
HUGE(20, 20, 20),
ENORMOUS(50, 50, 50);
int x, y, z;
Size(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
}

View File

@ -1,34 +0,0 @@
package io.github.simplexdev.simplexcore.module;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import org.jetbrains.annotations.Nullable;
public class DependencyManagement {
private ProtocolManager manager;
private PlaceholderAPIPlugin papi;
public DependencyManagement() {
manager = null;
papi = null;
}
public void registerProtocolLib() {
manager = ProtocolLibrary.getProtocolManager();
}
public void registerPAPI() {
papi = PlaceholderAPIPlugin.getInstance();
}
@Nullable
public PlaceholderAPIPlugin getPAPI() {
return papi;
}
@Nullable
public ProtocolManager getProtocolManager() {
return manager;
}
}

View File

@ -71,8 +71,4 @@ public abstract class SimplexModule<T extends SimplexModule<T>> extends JavaPlug
public CommandLoader getCommandLoader() { public CommandLoader getCommandLoader() {
return CommandLoader.getInstance(); return CommandLoader.getInstance();
} }
public SimplexCorePlugin getProvider() {
return SimplexCorePlugin.getInstance();
}
} }

View File

@ -85,9 +85,9 @@ public final class ParticleFactory {
}; };
} }
// TODO: Needs work :)
public void spawnParticle(IParticleEffect effect, Location location) { public void spawnParticle(IParticleEffect effect, Location location) {
World world = location.getWorld(); World world = location.getWorld();
if (world == null) return;
effect.getParticles().forEach(particle -> { effect.getParticles().forEach(particle -> {
Color color = effect.getParticleColors().get(particle); Color color = effect.getParticleColors().get(particle);
world.spawnParticle(particle, location, 20); world.spawnParticle(particle, location, 20);

View File

@ -1,22 +1,80 @@
package io.github.simplexdev.simplexcore.potion; package io.github.simplexdev.simplexcore.potion;
import io.github.simplexdev.api.IPotionEffect; import io.github.simplexdev.api.ICompoundEffect;
import io.github.simplexdev.simplexcore.listener.SimplexListener;
import io.github.simplexdev.simplexcore.module.SimplexModule;
import io.github.simplexdev.simplexcore.utils.Utilities; import io.github.simplexdev.simplexcore.utils.Utilities;
import org.bukkit.entity.LivingEntity; import org.bukkit.Color;
import org.bukkit.NamespacedKey;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.stream.Collectors; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
public final class PotionsFactory { public final class PotionsFactory {
private PotionsFactory() { private final Player player;
throw new AssertionError("This class should not be instantiated!"); private final Map<Player, ICompoundEffect> map = new HashMap<>();
public PotionsFactory(Player player) {
this.player = player;
} }
public static void applyEffect(LivingEntity entity, PotionEffect... effect) { public static ICompoundEffect compoundEffect(SimplexModule<?> plugin, String name, int duration, int amplifier, PotionEffectType... effects) {
entity.addPotionEffects(Utilities.stream(effect).collect(Collectors.toSet())); List<PotionEffect> list = new ArrayList<>();
Utilities.forEach(effects, effect -> {
list.add(effect.createEffect(duration, amplifier));
});
return new ICompoundEffect() {
@Override
public @NotNull List<PotionEffect> getEffects() {
return list;
} }
public static void applyEffect(LivingEntity entity, IPotionEffect... effect) { @Override
Utilities.forEach(effect, sim -> sim.getEffect().apply(entity)); // Interesting, not how it will be done in the end though. public @NotNull String getName() {
return name;
}
@Override
public @NotNull Integer getDuration() {
return duration;
}
@Override
public @Nullable Particle getParticleType() {
return null;
}
@Override
public @Nullable Color getParticleColor() {
return null;
}
@Override
public @NotNull NamespacedKey getNamespacedKey() {
return new NamespacedKey(plugin, name);
}
};
}
public void applyCompoundEffect(ICompoundEffect effect) {
effect.getEffects().forEach(item -> {
item.apply(player);
});
map.put(player, effect);
}
public boolean hasPotionEffect(ICompoundEffect effect) {
return (map.containsKey(player) && map.get(player).equals(effect));
} }
} }

View File

@ -1,7 +0,0 @@
package io.github.simplexdev.simplexcore.structures;
public enum PasteType {
BLOCKBYBLOCKASYNC,
INSTANTASYNC
}

View File

@ -1,103 +0,0 @@
package io.github.simplexdev.simplexcore.structures;
import io.github.simplexdev.api.IStructure;
import io.github.simplexdev.simplexcore.math.Size;
import io.github.simplexdev.simplexcore.module.SimplexModule;
import io.github.simplexdev.simplexcore.structures.block.NBTBlock;
import io.github.simplexdev.simplexcore.structures.exception.InvalidSchematic;
import io.github.simplexdev.simplexcore.structures.exception.SchematicNotLoaded;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.util.Vector;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class Structure implements IStructure {
private final SimplexModule<?> plugin;
private File schematic;
private short width, height, length = 0;
private byte[] blockdatacontainer;
private HashMap<Vector, NBTBlock> nbtBlocks = new HashMap<>();
private HashMap<Integer, BlockData> blocks = new HashMap<>();
public Structure(SimplexModule<?> plugin, File schematic) {
this.plugin = plugin;
this.schematic = schematic;
}
public void load() throws InvalidSchematic {
}
public void paste(Location loc, PasteType pasteType) throws SchematicNotLoaded {
if (width == 0 || height == 0 || length == 0 || blocks.isEmpty()) {
throw new SchematicNotLoaded("Schematic not loaded please load schematic first...");
}
}
@Override
public NamespacedKey getNamespacedKey() {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public Location getLocation() {
return null;
}
@Override
public World getWorld() {
return null;
}
@Override
public boolean shouldGenerateNaturally() {
return false;
}
@Override
public void generate(Location location, World world) {
}
@Override
public void generate(Location location, World world, boolean generateNaturally) {
}
@Override
public Size getApproximateSize() {
return null;
}
@Override
public Block[] getBlocks() {
return new Block[0];
}
@Override
public Map<Block, Location> getBlockLocations() {
return null;
}
@Override
public File getStructureFile() {
return null;
}
public SimplexModule<?> getPlugin() {
return plugin;
}
// TODO: Write this
}

View File

@ -1,19 +0,0 @@
package io.github.simplexdev.simplexcore.structures.block;
import io.github.simplexdev.simplexcore.structures.exception.InvalidSchematic;
import java.util.Vector;
public abstract class NBTBlock {
private Object nbttag;
public Object getNbttag(){
return nbttag;
}
public abstract Vector getOffset() throws InvalidSchematic;
public abstract boolean isEmpty();
}

View File

@ -1,9 +0,0 @@
package io.github.simplexdev.simplexcore.structures.exception;
public class InvalidSchematic extends Exception{
public InvalidSchematic(String msg)
{
super(msg);
}
}

View File

@ -1,8 +0,0 @@
package io.github.simplexdev.simplexcore.structures.exception;
public class SchematicNotLoaded extends Exception {
public SchematicNotLoaded(String msg) {
super(msg);
}
}

View File

@ -1,30 +0,0 @@
package io.github.simplexdev.simplexcore.task;
import io.github.simplexdev.simplexcore.SimplexCorePlugin;
import io.github.simplexdev.simplexcore.chat.Messages;
import io.github.simplexdev.simplexcore.module.SimplexModule;
import io.github.simplexdev.simplexcore.utils.TickedTime;
import org.apache.commons.lang.math.RandomUtils;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
import java.util.ArrayList;
import java.util.List;
public class Announcer extends SimplexTask {
private final List<String> stringList = new ArrayList<>() {{
add("Join our discord!" + Messages.DISCORD.getMessage());
add("Thank you for using SimplexCore!");
add("https://github.com/SimplexDevelopment/SimplexCore");
}};
public Announcer(SimplexCorePlugin plugin) {
super(plugin, TickedTime.HOUR);
register(this, true, false);
}
@Override
public void accept(BukkitTask bukkitTask) {
Bukkit.getServer().broadcastMessage(stringList.get(RandomUtils.nextInt(stringList.size())));
}
}

View File

@ -11,7 +11,7 @@ import java.util.UUID;
public final class PlayerTools { public final class PlayerTools {
@NotNull @NotNull
public static String stringUUID(@NotNull Player player) { public static String stringedUUID(@NotNull Player player) {
return player.getUniqueId().toString(); return player.getUniqueId().toString();
} }