Skip to content

Instantly share code, notes, and snippets.

@RoboMWM
Created July 21, 2019 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoboMWM/fe6ce647ee4a5cba1e402c36c2faf6ed to your computer and use it in GitHub Desktop.
Save RoboMWM/fe6ce647ee4a5cba1e402c36c2faf6ed to your computer and use it in GitHub Desktop.
@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