Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.io.File;
- import java.io.IOException;
- import org.bukkit.Bukkit;
- import org.bukkit.Effect;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.EntityDamageEvent;
- import org.bukkit.event.player.PlayerMoveEvent;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.util.Vector;
- public class JumpPads extends JavaPlugin implements Listener {
- static String prefix = "";
- static int on = 0;
- static int a = 0;
- static int b = 1;
- static int JumpPads = 0;
- static int c = 3;
- static int JumpPadsweite = 0;
- static int JumpPadsh = 0;
- static int d = 0;
- static String e = "true";
- static int JumpPadplate = 0;
- static int JumpPadNoFallDamage = 0;
- public void onEnable() {
- getJumpPads(null);
- if (JumpPads == 0)
- on = 0;
- if (JumpPads == 1)
- on = 1;
- getServer().getPluginManager().registerEvents(this, (Plugin)this);
- System.out.println("[JumpPads] Plugin erfolgreich aktiviert!");
- }
- public void onDisable() {
- System.out.println("[JumpPads] Plugin erfolgreich deaktiviert!");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- Player p = (Player)sender;
- if (sender instanceof org.bukkit.command.ConsoleCommandSender) {
- sender.sendMessage("kannst du nur als Spieler");
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("JumpPads")) {
- if (args.length == 0 &&
- p.hasPermission("JumpPads.configuration")) {
- p.sendMessage(String.valueOf(prefix) + "on die JumpPads an.");
- p.sendMessage(String.valueOf(prefix) + "off die JumpPads aus.");
- p.sendMessage(String.valueOf(prefix) + "Configuration eine Configurations Config.");
- }
- if (args.length == 1) {
- if (p.hasPermission("JumpPads.configuration") &&
- args[0].equalsIgnoreCase("Configuration")) {
- p.sendMessage(String.valueOf(prefix) + "Du hast Erfolgreich die Configurations-Config Ergestellt. Du kannst sie nun im Plugins Ordner bearbeiten.");
- setJumpPadsPlate(p);
- setJumpPadsLarge(p);
- setNoFallDamage(p);
- }
- if (p.hasPermission("JumpPads.configuration")) {
- if (args[0].equalsIgnoreCase("on"))
- if (on == 1) {
- p.sendMessage(String.valueOf(prefix) + "Du hast Erfolgreich die JumpPads );
- on = 0;
- setJumpPads(p);
- } else {
- p.sendMessage(String.valueOf(prefix) + "JumpPads sind schon );
- }
- if (args[0].equalsIgnoreCase("off"))
- if (on == 0) {
- p.sendMessage(String.valueOf(prefix) + "Du hast Erfolgreich die JumpPads );
- on = 1;
- setJumpPads(p);
- } else {
- p.sendMessage(String.valueOf(prefix) + "JumpPads sind schon );
- }
- }
- }
- }
- return false;
- }
- @EventHandler
- public void onFallDamageEvent(EntityDamageEvent e) {
- getNoFallDamage(null);
- if (JumpPadNoFallDamage == 0)
- e.setCancelled(true);
- }
- @EventHandler
- public void onMove(PlayerMoveEvent e) {
- Player p = e.getPlayer();
- getJumpPadsPlate(p);
- getJumpPadsLarge(p);
- if (JumpPadsweite > 5)
- Bukkit.broadcastMessage(String.valueOf(prefix) + "JumpPadsweite darf h5 betragen.");
- if (JumpPadsh > 5)
- Bukkit.broadcastMessage(String.valueOf(prefix) + "JumpPadshdarf h5 betragen.");
- if (JumpPadplate > 1)
- Bukkit.broadcastMessage(String.valueOf(prefix) + "in der Config eine Druckplatte von 0-1 W0 = Golddruckplatte 1 = Eisendruckplatte.");
- if (JumpPadplate == 1 &&
- p.getLocation().getBlock().getType() == Material.STONE_PLATE) {
- getJumpPads(p);
- getJumpPadsLarge(p);
- if (on == 0) {
- if (JumpPadsweite == 1 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(5.0D);
- p.setVelocity(v);
- }
- p.playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 3);
- p.playSound(p.getLocation(), Sound.ENDERDRAGON_WINGS, 3.0F, 2.0F);
- } else {
- p.sendMessage(String.valueOf(prefix) + "Die JumpPads sind );
- }
- }
- getJumpPadsPlate(p);
- if (JumpPadplate == 0 &&
- p.getLocation().getBlock().getType() == Material.GOLD_PLATE) {
- getJumpPads(p);
- if (on == 0) {
- getJumpPadsLarge(p);
- if (JumpPadsweite == 1 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 1 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(1.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 2 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(2.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 3 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(3.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 4 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(4.0D).setY(5.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 1) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(1.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 2) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(2.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 3) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(3.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 4) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(4.0D);
- p.setVelocity(v);
- }
- if (JumpPadsweite == 5 || JumpPadsh == 5) {
- Vector v = p.getLocation().getDirection().multiply(5.0D).setY(5.0D);
- p.setVelocity(v);
- }
- p.playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 3);
- p.playSound(p.getLocation(), Sound.ENDERDRAGON_WINGS, 3.0F, 2.0F);
- } else {
- p.sendMessage(String.valueOf(prefix) + "Die JumpPads sind );
- }
- }
- }
- public static void setJumpPads(Player p) {
- File ordner = new File("plugins//JumpPads");
- File file = new File("plugins//JumpPads//JumpPads.yml");
- if (!ordner.exists())
- ordner.mkdir();
- if (!file.exists())
- try {
- file.createNewFile();
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "Datei konnte auf dem Pfad nicht erstellt werden");
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- if (on == 0)
- cfg.set("JumpPads", Integer.valueOf(a));
- if (on == 1)
- cfg.set("JumpPads", Integer.valueOf(b));
- try {
- cfg.save(file);
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "konnte der angegebene Pfad nicht gefunden werde.");
- }
- }
- public static void getJumpPads(Player p) {
- File file = new File("plugins//JumpPads//JumpPads.yml");
- if (!file.exists())
- return;
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- double a = cfg.getDouble("JumpPads");
- JumpPads = (int)a;
- }
- public static void setJumpPadsLarge(Player p) {
- File ordner = new File("plugins//JumpPads");
- File file = new File("plugins//JumpPads//Configuration.yml");
- if (!ordner.exists())
- ordner.mkdir();
- if (!file.exists())
- try {
- file.createNewFile();
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "Datei konnte auf dem Pfad nicht erstellt werden");
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- cfg.set("Weite", Integer.valueOf(c));
- cfg.set("Hoehe", Integer.valueOf(c));
- try {
- cfg.save(file);
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "konnte der angegebene Pfad nicht gefunden werde.");
- }
- }
- public static void getJumpPadsLarge(Player p) {
- File file = new File("plugins//JumpPads//Configuration.yml");
- if (!file.exists())
- return;
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- double Coins1 = cfg.getDouble("Weite");
- double Coins2 = cfg.getDouble("Hoehe");
- JumpPadsweite = (int)Coins1;
- JumpPadsh = (int)Coins2;
- }
- public static void setJumpPadsPlate(Player p) {
- File ordner = new File("plugins//JumpPads");
- File file = new File("plugins//JumpPads//Druckplatte.yml");
- if (!ordner.exists())
- ordner.mkdir();
- if (!file.exists())
- try {
- file.createNewFile();
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "Datei konnte auf dem Pfad nicht erstellt werden");
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- cfg.set("Druckplatte", "GOLD_PLATE");
- try {
- cfg.save(file);
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "konnte der angegebene Pfad nicht gefunden werde.");
- }
- }
- public static void getJumpPadsPlate(Player p) {
- File file = new File("plugins//JumpPads//Druckplatte.yml");
- if (!file.exists())
- return;
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- String Druckplatte = cfg.getString("Druckplatte");
- if (Druckplatte == "GOLD_PLATE")
- JumpPadplate = 0;
- if (Druckplatte == "STONE_PLATE")
- JumpPadplate = 1;
- }
- public static void setNoFallDamage(Player p) {
- File ordner = new File("plugins//JumpPads");
- File file = new File("plugins//JumpPads//NoFallDamage.yml");
- if (!ordner.exists())
- ordner.mkdir();
- if (!file.exists())
- try {
- file.createNewFile();
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "Datei konnte auf dem Pfad nicht erstellt werden");
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- cfg.set("NoFallDamage", "true");
- try {
- cfg.save(file);
- } catch (IOException e) {
- p.sendMessage(String.valueOf(prefix) + "konnte der angegebene Pfad nicht gefunden werde.");
- }
- }
- public static void getNoFallDamage(Player p) {
- File file = new File("plugins//JumpPads//NoFallDamage.yml");
- if (!file.exists())
- return;
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- String b = cfg.getString("NoFallDamage");
- if (b == "true")
- JumpPadNoFallDamage = 0;
- if (b == "false")
- JumpPadNoFallDamage = 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement