Coded a persistence test to monitor config.yml
This commit is contained in:
parent
6863487ad6
commit
f830129381
5 changed files with 53 additions and 1 deletions
0
config.yml
Normal file
0
config.yml
Normal file
|
@ -29,7 +29,7 @@ public class HelloSound extends PlayerCommand{
|
|||
}
|
||||
|
||||
}
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, volume, pitch);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_BLAZE_DEATH, volume, pitch);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package buttondevteam.presents.test;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import buttondevteam.presents.architecture.commands.UniversalCommand;
|
||||
|
||||
public class PersistenceTest extends UniversalCommand {
|
||||
final private String path = "test.presistence.data";
|
||||
|
||||
public PersistenceTest(){
|
||||
runTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
if(runTest()){
|
||||
sender.sendMessage("Everything seems pretty fine");
|
||||
sender.sendMessage(path + " contains the String");
|
||||
sender.sendMessage(this.getPlugin().getConfig().getString(path));
|
||||
return true;
|
||||
}else{
|
||||
sender.sendMessage("[ButtonPresents] Persistence Test Failed! Button Presents may have an erased config.yml");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean runTest(){
|
||||
boolean test = this.getPlugin().getConfig().contains(path);
|
||||
if(test){
|
||||
return true;
|
||||
}else{
|
||||
this.getPlugin().getConfig().set(path, "Lorem Ipsum");
|
||||
throw new AssertionError("[ButtonPresents] Persistence Test Failed! Button Presents may have an erased config.yml");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
src/main/java/buttondevteam/presents/test/TestComponent.java
Normal file
15
src/main/java/buttondevteam/presents/test/TestComponent.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package buttondevteam.presents.test;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import buttondevteam.presents.architecture.Component;
|
||||
|
||||
public class TestComponent extends Component{
|
||||
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
this.registerCommand(plugin, new PersistenceTest());
|
||||
|
||||
}
|
||||
|
||||
}
|
0
target/classes/config.yml
Normal file
0
target/classes/config.yml
Normal file
Loading…
Reference in a new issue