BLEEDING EDGE v1.3_06

This commit is contained in:
Paldiu 2021-03-01 22:56:13 -06:00
parent 924c607ebc
commit 5f37e63b0f
5 changed files with 55 additions and 4 deletions

View File

@ -6,6 +6,8 @@ import org.bukkit.NamespacedKey;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import java.io.File;
public interface IStructure { public interface IStructure {
NamespacedKey getNamespacedKey(); NamespacedKey getNamespacedKey();
@ -26,4 +28,6 @@ public interface IStructure {
Size getApproximateSize(); Size getApproximateSize();
Block[] getBlocks(); Block[] getBlocks();
File getStructureFile();
} }

View File

@ -1,16 +1,20 @@
package io.github.simplexdev.simplexcore.ban; package io.github.simplexdev.simplexcore.ban;
import io.github.simplexdev.api.IBan; import io.github.simplexdev.api.IBan;
import io.github.simplexdev.simplexcore.chat.Messages;
import io.github.simplexdev.api.func.VoidSupplier; import io.github.simplexdev.api.func.VoidSupplier;
import io.github.simplexdev.simplexcore.chat.Messages;
import io.github.simplexdev.simplexcore.config.Yaml;
import io.github.simplexdev.simplexcore.utils.Constants; import io.github.simplexdev.simplexcore.utils.Constants;
import io.github.simplexdev.simplexcore.utils.Utilities; import io.github.simplexdev.simplexcore.utils.Utilities;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.File;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import static io.github.simplexdev.simplexcore.utils.Utilities.pathway;
public final class BanFactory { public final class BanFactory {
private final Player player; private final Player player;
private final CommandSender sender; private final CommandSender sender;
@ -44,6 +48,21 @@ public final class BanFactory {
return this; return this;
} }
public void write(Yaml yaml, IBan ban) {
yaml.set(pathway("offender"), ban.getOffender());
yaml.set(pathway("sender"), ban.getSender());
yaml.set(pathway("duration"), ban.getBanDuration());
yaml.set(pathway("date"), ban.getDate());
yaml.set(pathway("type"), ban.getBanType());
yaml.set(pathway("id"), ban.getBanId());
yaml.set(pathway("reason"), ban.getBanReason());
yaml.create();
}
public Yaml read(File yamlFile) {
return null;
}
/** /**
* Creates a new instance of the abstract class Ban. * Creates a new instance of the abstract class Ban.
* *
@ -92,6 +111,18 @@ public final class BanFactory {
} }
public IBan getBan(String banId) {
return null;
}
public IBan getBan(Player player) {
return null;
}
public IBan getBan(UUID offenderUUID) {
return null;
}
private VoidSupplier assignBanDuration() { private VoidSupplier assignBanDuration() {
return () -> { return () -> {
if (type.equals(BanType.PERMANENT)) { if (type.equals(BanType.PERMANENT)) {

View File

@ -2,6 +2,8 @@ package io.github.simplexdev.simplexcore.config;
import io.github.simplexdev.simplexcore.plugin.SimplexAddon; import io.github.simplexdev.simplexcore.plugin.SimplexAddon;
import io.github.simplexdev.simplexcore.utils.Trio; import io.github.simplexdev.simplexcore.utils.Trio;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
@ -22,6 +24,10 @@ public final class YamlFactory {
return new Yaml(plugin, resourcePath, directory, fileName); return new Yaml(plugin, resourcePath, directory, fileName);
} }
public FileConfiguration load(File yamlFile) {
return YamlConfiguration.loadConfiguration(yamlFile);
}
public Yaml setDefaultPathways() { public Yaml setDefaultPathways() {
return from("config.yml", plugin.getDataFolder(), "config.yml"); return from("config.yml", plugin.getDataFolder(), "config.yml");
} }

View File

@ -1,5 +1,6 @@
package io.github.simplexdev.simplexcore.utils; package io.github.simplexdev.simplexcore.utils;
import io.github.simplexdev.api.func.Path;
import io.github.simplexdev.simplexcore.ban.BanType; import io.github.simplexdev.simplexcore.ban.BanType;
import java.util.ArrayList; import java.util.ArrayList;
@ -68,4 +69,8 @@ public final class Utilities {
String temp = String.valueOf(character).toUpperCase(); String temp = String.valueOf(character).toUpperCase();
return temp.charAt(0); return temp.charAt(0);
} }
public static Path pathway(String pathway) {
return () -> pathway;
}
} }

View File

@ -1,11 +1,11 @@
package io.github.simplexdev.simplexcore.utils; package io.github.simplexdev.simplexcore.utils;
import io.github.simplexdev.api.func.VoidSupplier;
import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate;
public final class Wrapper<T> { public final class Wrapper<T> {
protected T bean; protected T bean;
@ -61,8 +61,13 @@ public final class Wrapper<T> {
return new Wrapper<>(function.apply(get())); return new Wrapper<>(function.apply(get()));
} }
public final Wrapper<T> filter(Consumer<? super T> predicate) { public final Wrapper<T> filter(Consumer<? super T> consumer) {
predicate.accept(get()); consumer.accept(get());
return this;
}
public final Wrapper<T> then(VoidSupplier supplier) {
supplier.get();
return this; return this;
} }
} }