Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DropList implements CommandExecutor {
- FileConfiguration config = Main.plugin.getConfig();
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if(args.length == 0) {
- List<Material> blocksPlaced = Arrays.stream(Material.values())
- .filter(Material::isBlock)
- .collect(Collectors.toList());
- List<Material> shuffledBlocks = Arrays.stream(Material.values())
- .collect(Collectors.toList());
- Collections.shuffle(shuffledBlocks);
- Map<Material, Material> blockTypeMappings = Streams.zip(blocksPlaced.stream(), shuffledBlocks.stream(), AbstractMap.SimpleEntry::new)
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
- File configFile = new File("plugins/Randomizer/dictionary.yml");
- if (configFile.exists())
- configFile.delete();
- try {
- configFile.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- FileConfiguration config = YamlConfiguration.loadConfiguration(configFile);
- for (Map.Entry<Material, Material> entry : blockTypeMappings.entrySet())
- config.set(entry.getKey().toString(), entry.getValue().toString());
- }else{
- sender.sendMessage("§cBitte benutze nur §6/randomize§c!");
- }
- return false;
- }
- ---------------------------------------------------------------------------------------------------------------------------------------
- public class BlockDestroyedListener implements Listener{
- FileConfiguration config = Main.plugin.getConfig();
- @EventHandler
- public void onBreak(BlockBreakEvent e){
- Block block = e.getBlock();
- e.setCancelled(true);
- block.setType(Material.AIR);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment