Working Restrictions
This commit is contained in:
parent
b5468b1fe9
commit
4bdb3f94d5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,6 +13,7 @@ public class HubCommand extends Command {
|
|||||||
setCondition((sender, commandString) -> ((Player) sender).getInstance() instanceof Room);
|
setCondition((sender, commandString) -> ((Player) sender).getInstance() instanceof Room);
|
||||||
|
|
||||||
setDefaultExecutor((sender, context) -> {
|
setDefaultExecutor((sender, context) -> {
|
||||||
|
Room.unsetRoom((Player) sender);
|
||||||
MoveInstance.move((Player) sender, Hub.INSTANCE);
|
MoveInstance.move((Player) sender, Hub.INSTANCE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,22 @@
|
|||||||
package eu.mhsl.minenet.minigames.instance.game.minigame.config;
|
package eu.mhsl.minenet.minigames.instance.game.minigame.config;
|
||||||
|
|
||||||
|
import com.extollit.linalg.mutable.Vec2d;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.Game;
|
import eu.mhsl.minenet.minigames.instance.game.Game;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.IRestriction;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.IRestriction;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionHandler;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionHandler;
|
||||||
import eu.mhsl.minenet.minigames.shared.inventory.InteractableInventory;
|
import eu.mhsl.minenet.minigames.shared.inventory.InteractableInventory;
|
||||||
|
import eu.mhsl.minenet.minigames.util.InventoryItemAlignment;
|
||||||
import eu.mhsl.minenet.minigames.util.TextUtil;
|
import eu.mhsl.minenet.minigames.util.TextUtil;
|
||||||
import eu.mhsl.minenet.minigames.instance.room.Room;
|
import eu.mhsl.minenet.minigames.instance.room.Room;
|
||||||
import net.kyori.adventure.sound.Sound;
|
import net.kyori.adventure.sound.Sound;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.minestom.server.MinecraftServer;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.event.instance.AddEntityToInstanceEvent;
|
import net.minestom.server.event.instance.AddEntityToInstanceEvent;
|
||||||
|
import net.minestom.server.event.instance.RemoveEntityFromInstanceEvent;
|
||||||
import net.minestom.server.inventory.InventoryType;
|
import net.minestom.server.inventory.InventoryType;
|
||||||
import net.minestom.server.inventory.click.ClickType;
|
import net.minestom.server.inventory.click.ClickType;
|
||||||
import net.minestom.server.inventory.condition.InventoryConditionResult;
|
import net.minestom.server.inventory.condition.InventoryConditionResult;
|
||||||
@ -36,10 +40,8 @@ public class GameConfigurationInventory extends InteractableInventory {
|
|||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
|
|
||||||
room.eventNode()
|
room.eventNode()
|
||||||
.addListener(AddEntityToInstanceEvent.class, addEntityToInstanceEvent -> {
|
.addListener(AddEntityToInstanceEvent.class, addEntityToInstanceEvent -> MinecraftServer.getSchedulerManager().scheduleNextTick(this::updatePlayButton))
|
||||||
System.out.println("UPDATE");
|
.addListener(RemoveEntityFromInstanceEvent.class, removeEntityFromInstanceEvent -> MinecraftServer.getSchedulerManager().scheduleNextTick(this::updatePlayButton));
|
||||||
updatePlayButton();
|
|
||||||
});
|
|
||||||
|
|
||||||
ConfigManager config = factory.configuration();
|
ConfigManager config = factory.configuration();
|
||||||
|
|
||||||
@ -70,18 +72,22 @@ public class GameConfigurationInventory extends InteractableInventory {
|
|||||||
ItemStack.builder(Material.BARRIER).displayName(Component.text("Keine Optionen")).lore(TextUtil.autoWrap("Für dieses Spiel sind keine Einstellungen verfügbar!")).build(),
|
ItemStack.builder(Material.BARRIER).displayName(Component.text("Keine Optionen")).lore(TextUtil.autoWrap("Für dieses Spiel sind keine Einstellungen verfügbar!")).build(),
|
||||||
31
|
31
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
|
} else {
|
||||||
|
int offset = 18;
|
||||||
|
InventoryItemAlignment itemAlignment = new InventoryItemAlignment(config.getAll().size(), 3);
|
||||||
|
for(Option<?> item : config.getAll()) {
|
||||||
|
Vec2d current = itemAlignment.next();
|
||||||
|
System.out.println(current.x + " : " + current.y);
|
||||||
|
map.put((int) (offset + (current.y * 9) + current.x), item);
|
||||||
|
|
||||||
|
setDummyItem(
|
||||||
|
item.getCurrent(),
|
||||||
|
(int) (offset + (current.y * 9) + current.x)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = 18;
|
|
||||||
for(Option<?> item : config.getAll()) {
|
|
||||||
map.put(pos, item);
|
|
||||||
|
|
||||||
setDummyItem(
|
|
||||||
item.getCurrent(),
|
|
||||||
pos++
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -104,6 +110,8 @@ public class GameConfigurationInventory extends InteractableInventory {
|
|||||||
RestrictionHandler restrictionHandler = factory.globalRestrictions();
|
RestrictionHandler restrictionHandler = factory.globalRestrictions();
|
||||||
RestrictionData restrictionData = new RestrictionData(room);
|
RestrictionData restrictionData = new RestrictionData(room);
|
||||||
|
|
||||||
|
System.out.println("UpdatePlayButton:" + restrictionHandler.canPlay(restrictionData));
|
||||||
|
|
||||||
if(restrictionHandler.canPlay(restrictionData)) {
|
if(restrictionHandler.canPlay(restrictionData)) {
|
||||||
|
|
||||||
setClickableItem(
|
setClickableItem(
|
||||||
@ -132,11 +140,17 @@ public class GameConfigurationInventory extends InteractableInventory {
|
|||||||
.build(),
|
.build(),
|
||||||
8,
|
8,
|
||||||
itemClick -> {
|
itemClick -> {
|
||||||
|
if(restrictionHandler.canPlay(restrictionData)) {
|
||||||
|
updatePlayButton();
|
||||||
|
return;
|
||||||
|
}
|
||||||
itemClick.getPlayer().playSound(Sound.sound(SoundEvent.ENTITY_SILVERFISH_DEATH, Sound.Source.AMBIENT, 1f, 1f));
|
itemClick.getPlayer().playSound(Sound.sound(SoundEvent.ENTITY_SILVERFISH_DEATH, Sound.Source.AMBIENT, 1f, 1f));
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction;
|
package eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction;
|
||||||
|
|
||||||
import eu.mhsl.minenet.minigames.instance.MineNetInstance;
|
|
||||||
import eu.mhsl.minenet.minigames.instance.room.Room;
|
import eu.mhsl.minenet.minigames.instance.room.Room;
|
||||||
|
|
||||||
public class RestrictionData {
|
public class RestrictionData {
|
||||||
final private Room instance;
|
final private Room room;
|
||||||
|
|
||||||
public RestrictionData(Room instance) {
|
public RestrictionData(Room room) {
|
||||||
this.instance = instance;
|
this.room = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MineNetInstance getInstance() {
|
public Room getRoom() {
|
||||||
return instance;
|
return room;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,9 @@ public class RestrictionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlay(RestrictionData data) {
|
public boolean canPlay(RestrictionData data) {
|
||||||
|
if(restrictions.size() < 1) return true;
|
||||||
return this.restrictions.stream()
|
return this.restrictions.stream()
|
||||||
.anyMatch(iRestriction -> !iRestriction.calculate(data).getType().equals(Restriction.Type.OK));
|
.noneMatch(iRestriction -> iRestriction.calculate(data).getType().equals(Restriction.Type.FAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getWarnings(RestrictionData data) {
|
public List<String> getWarnings(RestrictionData data) {
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common;
|
||||||
|
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.IRestriction;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
||||||
|
|
||||||
|
public class MaximalPlayeramountGameRestriction implements IRestriction {
|
||||||
|
private int max;
|
||||||
|
|
||||||
|
public MaximalPlayeramountGameRestriction(int max) {
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Restriction calculate(RestrictionData data) {
|
||||||
|
return new Restriction(
|
||||||
|
"Minimal players needed",
|
||||||
|
"Minimal players",
|
||||||
|
null,
|
||||||
|
data.getRoom().getAllMembers().size() > this.max ? Restriction.Type.FAIL : Restriction.Type.OK
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -3,12 +3,11 @@ package eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.comm
|
|||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.IRestriction;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.IRestriction;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
||||||
import kotlin.Result;
|
|
||||||
|
|
||||||
public class MaximalPlayeramountRestriction implements IRestriction {
|
public class MaximalPlayeramountInstanceRestriction implements IRestriction {
|
||||||
final private int max;
|
final private int max;
|
||||||
|
|
||||||
public MaximalPlayeramountRestriction(int max) {
|
public MaximalPlayeramountInstanceRestriction(int max) {
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ public class MaximalPlayeramountRestriction implements IRestriction {
|
|||||||
"Maxplayers",
|
"Maxplayers",
|
||||||
"Maximale spieleranzahl",
|
"Maximale spieleranzahl",
|
||||||
null,
|
null,
|
||||||
data.getInstance().getPlayers().size() > this.max ? Restriction.Type.FAIL : Restriction.Type.OK
|
data.getRoom().getPlayers().size() > this.max ? Restriction.Type.FAIL : Restriction.Type.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common;
|
||||||
|
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.IRestriction;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
||||||
|
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
|
|
||||||
|
public class MinimalPlayeramountGameRestriction implements IRestriction {
|
||||||
|
private int min;
|
||||||
|
|
||||||
|
public MinimalPlayeramountGameRestriction(int min) {
|
||||||
|
this.min = min;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Restriction calculate(RestrictionData data) {
|
||||||
|
return new Restriction(
|
||||||
|
"Minimal players",
|
||||||
|
"minimal Players needed",
|
||||||
|
null,
|
||||||
|
data.getRoom().getAllMembers().size() < this.min ? Restriction.Type.FAIL : Restriction.Type.OK
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -4,10 +4,10 @@ import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.IRest
|
|||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.Restriction;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionData;
|
||||||
|
|
||||||
public class MinimalPlayeramountRestriction implements IRestriction {
|
public class MinimalPlayeramountInstanceRestriction implements IRestriction {
|
||||||
final int min;
|
final int min;
|
||||||
|
|
||||||
public MinimalPlayeramountRestriction(int min) {
|
public MinimalPlayeramountInstanceRestriction(int min) {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class MinimalPlayeramountRestriction implements IRestriction {
|
|||||||
"Minimal players",
|
"Minimal players",
|
||||||
"Minimal amount of players needed",
|
"Minimal amount of players needed",
|
||||||
null,
|
null,
|
||||||
data.getInstance().getPlayers().size() < min ? Restriction.Type.FAIL : Restriction.Type.OK
|
data.getRoom().getPlayers().size() < min ? Restriction.Type.FAIL : Restriction.Type.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,9 +4,12 @@ import eu.mhsl.minenet.minigames.instance.game.minigame.Minigame;
|
|||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.ConfigManager;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.ConfigManager;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.GameFactory;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.GameFactory;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.Option;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.Option;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.common.NumericOption;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionHandler;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.RestrictionHandler;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common.MaximalPlayeramountRestriction;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common.MaximalPlayeramountGameRestriction;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common.MinimalPlayeramountRestriction;
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common.MaximalPlayeramountInstanceRestriction;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common.MinimalPlayeramountGameRestriction;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.minigame.config.restriction.common.MinimalPlayeramountInstanceRestriction;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.minestom.server.item.Material;
|
import net.minestom.server.item.Material;
|
||||||
|
|
||||||
@ -20,14 +23,15 @@ public class StickFightFactory implements GameFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigManager configuration() {
|
public ConfigManager configuration() {
|
||||||
return null;
|
return new ConfigManager()
|
||||||
|
.addOption(new NumericOption("lenght", Material.SANDSTONE, "Länge", 5, 7, 9, 11));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestrictionHandler globalRestrictions() {
|
public RestrictionHandler globalRestrictions() {
|
||||||
return new RestrictionHandler()
|
return new RestrictionHandler()
|
||||||
.addRestriction(new MinimalPlayeramountRestriction(2))
|
.addRestriction(new MinimalPlayeramountGameRestriction(2))
|
||||||
.addRestriction(new MaximalPlayeramountRestriction(4));
|
.addRestriction(new MaximalPlayeramountGameRestriction(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.mhsl.minenet.minigames.shared.entity;
|
package eu.mhsl.minenet.minigames.shared.entity;
|
||||||
|
|
||||||
import eu.mhsl.minenet.minigames.instance.Spawnable;
|
import eu.mhsl.minenet.minigames.instance.Spawnable;
|
||||||
|
import net.minestom.server.coordinate.Pos;
|
||||||
import net.minestom.server.entity.EntityCreature;
|
import net.minestom.server.entity.EntityCreature;
|
||||||
import net.minestom.server.entity.EntityType;
|
import net.minestom.server.entity.EntityType;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
@ -36,26 +37,22 @@ public class InteractableEntity extends EntityCreature {
|
|||||||
private void setInstanceEvent(@NotNull AddEntityToInstanceEvent addEntityToInstanceEvent) {
|
private void setInstanceEvent(@NotNull AddEntityToInstanceEvent addEntityToInstanceEvent) {
|
||||||
if(addEntityToInstanceEvent.getInstance() instanceof Spawnable instance) {
|
if(addEntityToInstanceEvent.getInstance() instanceof Spawnable instance) {
|
||||||
scheduleNextTick((unused) -> {
|
scheduleNextTick((unused) -> {
|
||||||
this.lookAt(instance.getSpawn()); //TODO only works someitmes?
|
this.teleport(this.position.withPitch(180).withYaw(0));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addEntityToInstanceEvent.getInstance().eventNode()
|
addEntityToInstanceEvent.getInstance().eventNode()
|
||||||
.addListener(PlayerEntityInteractEvent.class, playerEntityInteractEvent -> {
|
.addListener(PlayerEntityInteractEvent.class, playerEntityInteractEvent -> {
|
||||||
if(playerEntityInteractEvent.getTarget() == this) onInteract(playerEntityInteractEvent);
|
if(playerEntityInteractEvent.getTarget() == this) {
|
||||||
|
onInteract(playerEntityInteractEvent);
|
||||||
|
this.lookAt(playerEntityInteractEvent.getPlayer());
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.addListener(EntityAttackEvent.class, entityAttackEvent -> {
|
.addListener(EntityAttackEvent.class, entityAttackEvent -> {
|
||||||
if(entityAttackEvent.getTarget() == this) onAttack(entityAttackEvent);
|
if(entityAttackEvent.getTarget() == this) {
|
||||||
})
|
onAttack(entityAttackEvent);
|
||||||
.addListener(PlayerMoveEvent.class, playerMoveEvent -> {
|
this.lookAt(entityAttackEvent.getEntity());
|
||||||
//TODO this is heavy in production
|
}
|
||||||
//maybe store the player and update to the closest Entity only periodic
|
|
||||||
scheduler().submitTask(() -> {
|
|
||||||
setTarget(new ClosestEntityTarget(this, 5, entity -> entity instanceof Player).findTarget());
|
|
||||||
if(getTarget() != null) lookAt(getTarget());
|
|
||||||
|
|
||||||
return TaskSchedule.stop();
|
|
||||||
}, ExecutionType.ASYNC);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,135 @@
|
|||||||
|
package eu.mhsl.minenet.minigames.util;
|
||||||
|
|
||||||
|
|
||||||
|
import com.extollit.linalg.mutable.Vec2d;
|
||||||
|
import it.unimi.dsi.fastutil.Pair;
|
||||||
|
import net.minestom.server.coordinate.Vec;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class InventoryItemAlignment {
|
||||||
|
private int size;
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
|
||||||
|
private int counter = -1;
|
||||||
|
|
||||||
|
public InventoryItemAlignment(int size, int x, int y) {
|
||||||
|
this.size = size;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
|
||||||
|
if(x * y < size) throw new RuntimeException("Not enough space for Item alignment");
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryItemAlignment(int size, int y) {
|
||||||
|
this.size = size;
|
||||||
|
this.x = 9;
|
||||||
|
this.y = y;
|
||||||
|
|
||||||
|
if(x * y < size) throw new RuntimeException("Not enough space for Item alignment");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec2d next() {
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
if(this.size < 9) return new Vec2d(this.row(this.size).get(counter), y/2);
|
||||||
|
//TODO more items?
|
||||||
|
return new Vec2d(0,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<Integer> row(int count) {
|
||||||
|
return new ArrayList<ArrayList<Integer>>() {
|
||||||
|
{
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(3);
|
||||||
|
add(5);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(2);
|
||||||
|
add(4);
|
||||||
|
add(6);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(1);
|
||||||
|
add(3);
|
||||||
|
add(5);
|
||||||
|
add(7);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(2);
|
||||||
|
add(3);
|
||||||
|
add(4);
|
||||||
|
add(5);
|
||||||
|
add(6);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(1);
|
||||||
|
add(2);
|
||||||
|
add(3);
|
||||||
|
add(5);
|
||||||
|
add(6);
|
||||||
|
add(7);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(1);
|
||||||
|
add(2);
|
||||||
|
add(3);
|
||||||
|
add(4);
|
||||||
|
add(5);
|
||||||
|
add(6);
|
||||||
|
add(7);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(0);
|
||||||
|
add(1);
|
||||||
|
add(2);
|
||||||
|
add(3);
|
||||||
|
add(5);
|
||||||
|
add(6);
|
||||||
|
add(7);
|
||||||
|
add(8);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(new ArrayList<>() {
|
||||||
|
{
|
||||||
|
add(0);
|
||||||
|
add(1);
|
||||||
|
add(2);
|
||||||
|
add(3);
|
||||||
|
add(4);
|
||||||
|
add(5);
|
||||||
|
add(6);
|
||||||
|
add(7);
|
||||||
|
add(8);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}.get(count);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user