Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static File logs = new File("plugins/Smash", "stats.yml");
- public static YamlConfiguration cfg = YamlConfiguration.loadConfiguration(logs);
- public static void save(Player p){
- try {
- cfg.save(logs);
- p.sendMessage("Kopf gesetzt!");
- } catch (IOException e) {
- }
- }
- public static void createStats(){
- if(!logs.exists()){
- try {
- logs.createNewFile();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- @EventHandler
- public void onDeath(PlayerDeathEvent e){
- e.setDeathMessage(null);
- final Player p = e.getEntity();
- final Player k = p.getKiller();
- e.setDeathMessage(null);
- if(p.getKiller() == null) {
- p.sendMessage(Data.prefix + "Du bist gestorben!");
- MySQL.addTode(p.getUniqueId().toString(), 1, p.getName());
- p.spigot().respawn();
- } else {
- double leben = k.getHealth();
- double herzen = leben / 2;
- p.sendMessage(Data.prefix + "Du wurdest von §e" + p.getKiller().getName() + " §7mit §e" + herzen +"❤ §7getötet!");
- k.sendMessage(Data.prefix + "Du hast §e" + p.getName() + " §7getötet!");
- k.setHealth(20D);
- MySQL.addCoins(k.getUniqueId().toString(), 1, k);
- p.sendMessage("+1 Coin");
- MySQL.addKIlls(k.getUniqueId().toString(), 1, k.getName());
- MySQL.addTode(p.getUniqueId().toString(), 1, p.getName());
- p.getInventory().clear();
- p.spigot().respawn();
- }
- }
- @EventHandler
- public void onInteract(PlayerInteractEvent e){
- Player p = e.getPlayer();
- if(e.getAction() == Action.RIGHT_CLICK_BLOCK){
- if(e.getClickedBlock().getType() == Material.SKULL){
- Block skull = e.getClickedBlock();
- Skull s = (Skull) skull.getState();
- if(CMD_KOPF.kopfsetup.contains(p)){
- cfg.set("Kopf-1" + ".X", skull.getX());
- cfg.set("Kopf-1" + ".Y", skull.getY());
- cfg.set("Kopf-1" + ".Z", skull.getZ());
- cfg.set("Kopf-1" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-1" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup.remove(p);
- }else if(CMD_KOPF.kopfsetup2.contains(p)){
- cfg.set("Kopf-2" + ".X", skull.getX());
- cfg.set("Kopf-2" + ".Y", skull.getY());
- cfg.set("Kopf-2" + ".Z", skull.getZ());
- cfg.set("Kopf-2" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-2" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup2.remove(p);
- }else if(CMD_KOPF.kopfsetup3.contains(p)){
- cfg.set("Kopf-3" + ".X", skull.getX());
- cfg.set("Kopf-3" + ".Y", skull.getY());
- cfg.set("Kopf-3" + ".Z", skull.getZ());
- cfg.set("Kopf-3" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-3" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup3.remove(p);
- }else if(CMD_KOPF.kopfsetup4.contains(p)){
- cfg.set("Kopf-4" + ".X", skull.getX());
- cfg.set("Kopf-4" + ".Y", skull.getY());
- cfg.set("Kopf-4" + ".Z", skull.getZ());
- cfg.set("Kopf-4" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-4" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup4.remove(p);
- }else if(CMD_KOPF.kopfsetup5.contains(p)){
- cfg.set("Kopf-5" + ".X", skull.getX());
- cfg.set("Kopf-5" + ".Y", skull.getY());
- cfg.set("Kopf-5" + ".Z", skull.getZ());
- cfg.set("Kopf-5" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-5" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup5.remove(p);
- }else if(CMD_KOPF.kopfsetup6.contains(p)){
- cfg.set("Kopf-6" + ".X", skull.getX());
- cfg.set("Kopf-6" + ".Y", skull.getY());
- cfg.set("Kopf-6" + ".Z", skull.getZ());
- cfg.set("Kopf-6" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-6" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup6.remove(p);
- }else if(CMD_KOPF.kopfsetup7.contains(p)){
- cfg.set("Kopf-7" + ".X", skull.getX());
- cfg.set("Kopf-7" + ".Y", skull.getY());
- cfg.set("Kopf-7" + ".Z", skull.getZ());
- cfg.set("Kopf-7" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-7" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup7.remove(p);
- }else if(CMD_KOPF.kopfsetup8.contains(p)){
- cfg.set("Kopf-8" + ".X", skull.getX());
- cfg.set("Kopf-8" + ".Y", skull.getY());
- cfg.set("Kopf-8" + ".Z", skull.getZ());
- cfg.set("Kopf-8" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-8" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup8.remove(p);
- }else if(CMD_KOPF.kopfsetup9.contains(p)){
- cfg.set("Kopf-9" + ".X", skull.getX());
- cfg.set("Kopf-9" + ".Y", skull.getY());
- cfg.set("Kopf-9" + ".Z", skull.getZ());
- cfg.set("Kopf-9" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-9" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup9.remove(p);
- }else if(CMD_KOPF.kopfsetup10.contains(p)){
- cfg.set("Kopf-10" + ".X", skull.getX());
- cfg.set("Kopf-10" + ".Y", skull.getY());
- cfg.set("Kopf-10" + ".Z", skull.getZ());
- cfg.set("Kopf-10" + ".World", skull.getWorld().getName());
- cfg.set("Kopf-10" + ".Richtung", s.getRotation().toString());
- save(p);
- CMD_KOPF.kopfsetup10.remove(p);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement