Skip to content

Instantly share code, notes, and snippets.

@RoboMWM RoboMWM/verybad.java Secret
Created Jul 21, 2019

Embed
What would you like to do?
@EventHandler
public void onPlayerBreak(BlockBreakEvent e) {
Player player = e.getPlayer();
File rankFile = new File(String.valueOf(this.m.fileLoc) + "Ranks" + ".yml");
File playerFile = new File(String.valueOf(this.m.fileLoc) + "Players" + ".yml");
YamlConfiguration rankYaml = new YamlConfiguration();
YamlConfiguration playerYaml = new YamlConfiguration();
try {
rankYaml.load(rankFile);
playerYaml.load(playerFile);
String rank = playerYaml.getString("players." + player.getUniqueId());
boolean canBuild = rankYaml.getBoolean("Groups." + rank + ".build");
e.setCancelled(!canBuild);
} catch (Exception e1) {
e1.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.