mirror of
https://github.com/SimplexDevelopment/SimplexCore.git
synced 2024-12-22 00:37:36 +00:00
BLEEDING EDGE v1.3_06
This commit is contained in:
parent
924c607ebc
commit
5f37e63b0f
@ -6,6 +6,8 @@ import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface IStructure {
|
||||
NamespacedKey getNamespacedKey();
|
||||
|
||||
@ -26,4 +28,6 @@ public interface IStructure {
|
||||
Size getApproximateSize();
|
||||
|
||||
Block[] getBlocks();
|
||||
|
||||
File getStructureFile();
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
package io.github.simplexdev.simplexcore.ban;
|
||||
|
||||
import io.github.simplexdev.api.IBan;
|
||||
import io.github.simplexdev.simplexcore.chat.Messages;
|
||||
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.Utilities;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.github.simplexdev.simplexcore.utils.Utilities.pathway;
|
||||
|
||||
public final class BanFactory {
|
||||
private final Player player;
|
||||
private final CommandSender sender;
|
||||
@ -44,6 +48,21 @@ public final class BanFactory {
|
||||
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.
|
||||
*
|
||||
@ -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() {
|
||||
return () -> {
|
||||
if (type.equals(BanType.PERMANENT)) {
|
||||
|
@ -2,6 +2,8 @@ package io.github.simplexdev.simplexcore.config;
|
||||
|
||||
import io.github.simplexdev.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.simplexdev.simplexcore.utils.Trio;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -22,6 +24,10 @@ public final class YamlFactory {
|
||||
return new Yaml(plugin, resourcePath, directory, fileName);
|
||||
}
|
||||
|
||||
public FileConfiguration load(File yamlFile) {
|
||||
return YamlConfiguration.loadConfiguration(yamlFile);
|
||||
}
|
||||
|
||||
public Yaml setDefaultPathways() {
|
||||
return from("config.yml", plugin.getDataFolder(), "config.yml");
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
import io.github.simplexdev.api.func.Path;
|
||||
import io.github.simplexdev.simplexcore.ban.BanType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -68,4 +69,8 @@ public final class Utilities {
|
||||
String temp = String.valueOf(character).toUpperCase();
|
||||
return temp.charAt(0);
|
||||
}
|
||||
|
||||
public static Path pathway(String pathway) {
|
||||
return () -> pathway;
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
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.HashCodeBuilder;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public final class Wrapper<T> {
|
||||
protected T bean;
|
||||
@ -61,8 +61,13 @@ public final class Wrapper<T> {
|
||||
return new Wrapper<>(function.apply(get()));
|
||||
}
|
||||
|
||||
public final Wrapper<T> filter(Consumer<? super T> predicate) {
|
||||
predicate.accept(get());
|
||||
public final Wrapper<T> filter(Consumer<? super T> consumer) {
|
||||
consumer.accept(get());
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Wrapper<T> then(VoidSupplier supplier) {
|
||||
supplier.get();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user