-
-
Save RoboMWM/fe6ce647ee4a5cba1e402c36c2faf6ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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