Advertisement
Guest User

Classes Class

a guest
Aug 1st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.61 KB | None | 0 0
  1. package me.frostedtimmy.classes.util;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Material;
  5. import org.bukkit.Sound;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.inventory.Inventory;
  8. import org.bukkit.inventory.ItemStack;
  9. import org.bukkit.potion.PotionEffectType;
  10.  
  11. import me.frostedtimmy.classes.TimmyClasses;
  12. import net.md_5.bungee.api.ChatColor;
  13.  
  14. public class Classes {
  15.     TimmyClasses main;
  16.     private MySQLUtil sql = new MySQLUtil();
  17.     private CustomItems item = new CustomItems();
  18.    
  19.     String prefix = ChatColor.translateAlternateColorCodes('&', main.getConfig().getString("prefix"));
  20.    
  21.     public void openGui(Player player) {
  22.         Inventory inv = Bukkit.createInventory(null, 9, ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Class Selector");
  23.        
  24.         ItemStack tank = item.tankClay();
  25.         ItemStack dps = item.dpsClay();
  26.         ItemStack assassin = item.assassinClay();
  27.         ItemStack ench = item.enchanterClay();
  28.         ItemStack bruiser = item.bruiserClay();
  29.        
  30.         inv.setItem(2, tank);
  31.         inv.setItem(3, dps);
  32.         inv.setItem(4, assassin);
  33.         inv.setItem(5, ench);
  34.         inv.setItem(6, bruiser);
  35.        
  36.         player.openInventory(inv);
  37.     }
  38.    
  39.     public void tankClass(Player p) {
  40.         sql.setClassid(p, 1);
  41.        
  42.         p.sendMessage(prefix + ChatColor.translateAlternateColorCodes('&', main.getConfig().getString("tank")));
  43.         p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 2.0f);
  44.        
  45.         p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
  46.         p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  47.         p.removePotionEffect(PotionEffectType.SPEED);
  48.        
  49.         p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(Integer.MAX_VALUE, 2), true);
  50.         p.addPotionEffect(PotionEffectType.WEAKNESS.createEffect(Integer.MAX_VALUE, 1), true);
  51.        
  52.         p.setMaxHealth(36);
  53.         p.setHealth(36);
  54.     }
  55.    
  56.     public void dpsClass(Player p) {
  57.         sql.setClassid(p, 2);
  58.        
  59.         p.sendMessage(prefix + ChatColor.translateAlternateColorCodes('&', main.getConfig().getString("dps")));
  60.         p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 2.0f);
  61.        
  62.         p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
  63.         p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  64.         p.removePotionEffect(PotionEffectType.WEAKNESS);
  65.         p.removePotionEffect(PotionEffectType.SPEED);
  66.        
  67.         p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(Integer.MAX_VALUE, 0), true);
  68.        
  69.         p.setMaxHealth(20);
  70.         p.setHealth(20);
  71.     }
  72.    
  73.     public void assassinClass(Player p) {
  74.         sql.setClassid(p, 3);
  75.        
  76.         p.sendMessage(prefix + ChatColor.translateAlternateColorCodes('&', main.getConfig().getString("assassin")));
  77.         p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 2.0f);
  78.        
  79.         p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
  80.         p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  81.         p.removePotionEffect(PotionEffectType.WEAKNESS);
  82.         p.removePotionEffect(PotionEffectType.SPEED);
  83.        
  84.         p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(Integer.MAX_VALUE, 2), true);
  85.         p.addPotionEffect(PotionEffectType.SPEED.createEffect(Integer.MAX_VALUE, 0), true);
  86.        
  87.         p.setMaxHealth(16);
  88.     }
  89.    
  90.     public void enchanterClass(Player p) {
  91.         sql.setClassid(p, 4);
  92.        
  93.         p.sendMessage(prefix + ChatColor.translateAlternateColorCodes('&', main.getConfig().getString("enchanter")));
  94.         p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 2.0f);
  95.        
  96.         p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
  97.         p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  98.         p.removePotionEffect(PotionEffectType.WEAKNESS);
  99.         p.removePotionEffect(PotionEffectType.SPEED);
  100.        
  101.         p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(Integer.MAX_VALUE, 0), true);
  102.         p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(Integer.MAX_VALUE, 0), true);
  103.        
  104.         p.getInventory().addItem(new ItemStack(Material.GOLD_HOE));
  105.         p.getInventory().addItem(new ItemStack(Material.STONE_HOE));
  106.        
  107.         p.setMaxHealth(26);
  108.         p.setHealth(26);
  109.     }
  110.    
  111.     public void bruiserClass(Player p) {
  112.         sql.setClassid(p, 5);
  113.        
  114.         p.sendMessage(prefix + ChatColor.translateAlternateColorCodes('&', main.getConfig().getString("brusier")));
  115.         p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 2.0f);
  116.        
  117.         p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
  118.         p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  119.         p.removePotionEffect(PotionEffectType.WEAKNESS);
  120.         p.removePotionEffect(PotionEffectType.SPEED);
  121.        
  122.         p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(Integer.MAX_VALUE, 0), true);
  123.         p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(Integer.MAX_VALUE, 0), true);
  124.        
  125.         p.setMaxHealth(26);
  126.         p.setHealth(26);
  127.     }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement