Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
Implement moveable
Browse files Browse the repository at this point in the history
  • Loading branch information
virustotalop committed Jun 19, 2020
1 parent e295262 commit 710f081
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class SlotToken implements Serializable {
private String name;
private String nbt;
private boolean glow;
private boolean moveable;
private boolean closed;
private byte data;
private List<String> lore;
Expand Down Expand Up @@ -71,6 +72,7 @@ public SlotToken(int index, ConfigurationSection section, List<MacroToken> macro
this.name = this.macroParser.parseStringMacros(section.getString("name"));
this.nbt = this.macroParser.parseStringMacros(section.getString("nbt"));
this.glow = this.parseBoolean(section.getString("glow"));
this.moveable = this.parseBoolean(section.getString("moveable"));
this.closed = this.parseBoolean(section.getString("close"));
this.data = this.parseData(this.macroParser, section);
this.lore = this.macroParser.parseListMacros(section.getStringList("lore"));
Expand Down Expand Up @@ -177,6 +179,11 @@ public boolean getGlow()
return this.glow;
}

public boolean isMoveable()
{
return this.moveable;
}

public boolean isClosed()
{
return this.closed;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.clubobsidian.dynamicgui.parser.test.slot;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.io.File;

import org.junit.Test;

import com.clubobsidian.dynamicgui.parser.slot.SlotToken;
import com.clubobsidian.wrappy.Configuration;
import com.clubobsidian.wrappy.ConfigurationSection;

public class MoveableTest {

@Test
public void testSlotMoveable()
{
File slotFolder = new File("test", "slot");
File metadataFile = new File(slotFolder, "moveable.yml");
Configuration config = Configuration.load(metadataFile);
ConfigurationSection slot = config.getConfigurationSection("0");
SlotToken token = new SlotToken(0, slot);
assertTrue(token.isMoveable());
}

@Test
public void testSlotNotMoveable()
{
File slotFolder = new File("test", "slot");
File metadataFile = new File(slotFolder, "moveable.yml");
Configuration config = Configuration.load(metadataFile);
ConfigurationSection slot = config.getConfigurationSection("1");
SlotToken token = new SlotToken(1, slot);
assertFalse(token.isMoveable());
}
}
4 changes: 4 additions & 0 deletions test/slot/moveable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'0':
moveable: true
'1':
moveable: false

0 comments on commit 710f081

Please sign in to comment.