From 095beb5039fa49973cb974e6ea81b773333938f5 Mon Sep 17 00:00:00 2001 From: CrabMustard Date: Thu, 2 Apr 2020 20:24:49 -0500 Subject: [PATCH] Fixed uncolored action bar --- .classpath | 3 +- dependency-reduced-pom.xml | 8 +- pom.xml | 173 ++++++++++-------- .../classicswords/ClassicSwordsMain.java | 14 +- .../classicswords/commands/CSwordCommand.java | 0 .../classicswords/item/CItemManager.java | 0 .../fpghoti/classicswords/item/CItemType.java | 0 .../classicswords/item/ClassicSword.java | 5 +- .../classicswords/item/SetAttributes.java | 0 .../listener}/BlockingListener.java | 7 +- .../listener}/InventoryListener.java | 26 ++- .../listener/PlayerListener.java | 39 ++++ .../listener}/RegenListener.java | 6 +- .../listener}/SwingListener.java | 47 ++--- .../fpghoti/classicswords/util/Storage.java | 3 + .../com/fpghoti/classicswords/util/Util.java} | 12 +- src/{ => main/resources}/plugin.yml | 4 +- 17 files changed, 224 insertions(+), 123 deletions(-) rename src/{ => main/java}/com/fpghoti/classicswords/ClassicSwordsMain.java (87%) rename src/{ => main/java}/com/fpghoti/classicswords/commands/CSwordCommand.java (100%) rename src/{ => main/java}/com/fpghoti/classicswords/item/CItemManager.java (100%) rename src/{ => main/java}/com/fpghoti/classicswords/item/CItemType.java (100%) rename src/{ => main/java}/com/fpghoti/classicswords/item/ClassicSword.java (95%) rename src/{ => main/java}/com/fpghoti/classicswords/item/SetAttributes.java (100%) rename src/{com/fpghoti/classicswords/event => main/java/com/fpghoti/classicswords/listener}/BlockingListener.java (90%) rename src/{com/fpghoti/classicswords/event => main/java/com/fpghoti/classicswords/listener}/InventoryListener.java (83%) create mode 100644 src/main/java/com/fpghoti/classicswords/listener/PlayerListener.java rename src/{com/fpghoti/classicswords/event => main/java/com/fpghoti/classicswords/listener}/RegenListener.java (87%) rename src/{com/fpghoti/classicswords/event => main/java/com/fpghoti/classicswords/listener}/SwingListener.java (82%) rename src/{ => main/java}/com/fpghoti/classicswords/util/Storage.java (90%) rename src/{com/fpghoti/classicswords/util/Functions.java => main/java/com/fpghoti/classicswords/util/Util.java} (77%) rename src/{ => main/resources}/plugin.yml (60%) diff --git a/.classpath b/.classpath index 433af48..a6e7863 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,7 @@ - + + diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 0277f84..b68f370 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -23,7 +23,7 @@ 1.8 - me.ghotimayo*:* + com.fpghoti*:* de.tr7zw*:* @@ -46,7 +46,7 @@ org.spigotmc spigot-api - 1.13.2-R0.1-SNAPSHOT + 1.15.1-R0.1-SNAPSHOT provided @@ -58,13 +58,13 @@ org.bukkit craftbukkit - 1.13.2-R0.1-SNAPSHOT + 1.15.1-R0.1-SNAPSHOT provided org.bukkit bukkit - 1.13.2-R0.1-SNAPSHOT + 1.15.1-R0.1-SNAPSHOT compile diff --git a/pom.xml b/pom.xml index e2450a7..2ff077a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,80 +1,97 @@ - - 4.0.0 - me.ghotimayo - ClassicSwords - BETA-1.0 - ClassicSwords - Old combat for new minecraft - - 1.8 - 1.8 - UTF-8 - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - dmulloy2-repo - http://repo.dmulloy2.net/nexus/repository/public/ - - - - - org.spigotmc - spigot-api - 1.15.1-R0.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.15.1-R0.1-SNAPSHOT - provided - - - org.bukkit - bukkit - 1.15.1-R0.1-SNAPSHOT - - - de.tr7zw - item-nbt-parent - 1.7-SNAPSHOT - - - com.comphenix.protocol - ProtocolLib-API - 4.3.0 - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.0.0 - - 1.8 - - - me.ghotimayo*:* - de.tr7zw*:* - - - - - - - package - - shade - - - - - - + + 4.0.0 + me.ghotimayo + ClassicSwords + BETA-1.0.1 + ClassicSwords + Old combat for new minecraft + + 1.8 + 1.8 + UTF-8 + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + dmulloy2-repo + http://repo.dmulloy2.net/nexus/repository/public/ + + + + + org.spigotmc + spigot-api + 1.15.2-R0.1-SNAPSHOT + provided + + + org.bukkit + craftbukkit + 1.15.2-R0.1-SNAPSHOT + provided + + + org.bukkit + bukkit + 1.15.2-R0.1-SNAPSHOT + + + de.tr7zw + item-nbt-parent + 1.7-SNAPSHOT + + + com.comphenix.protocol + ProtocolLib-API + 4.3.0 + + + + src/main/java + + + src/main/resources + true + + + + + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + UTF-8 + + + + org.apache.maven.plugins + maven-shade-plugin + 3.0.0 + + 1.8 + + + com.fpghoti*:* + + + + + + + package + + shade + + + + + + \ No newline at end of file diff --git a/src/com/fpghoti/classicswords/ClassicSwordsMain.java b/src/main/java/com/fpghoti/classicswords/ClassicSwordsMain.java similarity index 87% rename from src/com/fpghoti/classicswords/ClassicSwordsMain.java rename to src/main/java/com/fpghoti/classicswords/ClassicSwordsMain.java index 2bf14e6..f578903 100644 --- a/src/com/fpghoti/classicswords/ClassicSwordsMain.java +++ b/src/main/java/com/fpghoti/classicswords/ClassicSwordsMain.java @@ -10,15 +10,18 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import com.fpghoti.classicswords.commands.CSwordCommand; -import com.fpghoti.classicswords.event.BlockingListener; -import com.fpghoti.classicswords.event.InventoryListener; -import com.fpghoti.classicswords.event.RegenListener; -import com.fpghoti.classicswords.event.SwingListener; import com.fpghoti.classicswords.item.CItemType; import com.fpghoti.classicswords.item.ClassicSword; import com.fpghoti.classicswords.item.SetAttributes; +import com.fpghoti.classicswords.listener.BlockingListener; +import com.fpghoti.classicswords.listener.InventoryListener; +import com.fpghoti.classicswords.listener.PlayerListener; +import com.fpghoti.classicswords.listener.RegenListener; +import com.fpghoti.classicswords.listener.SwingListener; import com.fpghoti.classicswords.util.Storage; +import net.md_5.bungee.api.ChatColor; + /** For 1.13 */ public class ClassicSwordsMain extends JavaPlugin{ @@ -63,6 +66,7 @@ public class ClassicSwordsMain extends JavaPlugin{ pm.registerEvents(ie, this); pm.registerEvents(new BlockingListener(), this); pm.registerEvents(new RegenListener(this), this); + pm.registerEvents(new PlayerListener(), this); } FileConfiguration config = this.getConfig(); @@ -91,7 +95,7 @@ public class ClassicSwordsMain extends JavaPlugin{ ItemStack newitem = ClassicSword.toShield(p.getInventory().getItemInMainHand(), CItemType.getSwordType(p.getInventory().getItemInMainHand().getType())); Integer dur = ClassicSword.getCShieldDurability(newitem); p.getInventory().setItemInMainHand(newitem); - ClassicSword.sendActionbar(p, "§eDurability: " + dur); + ClassicSword.sendActionbar(p, ChatColor.YELLOW + "Durability: " + dur); } } diff --git a/src/com/fpghoti/classicswords/commands/CSwordCommand.java b/src/main/java/com/fpghoti/classicswords/commands/CSwordCommand.java similarity index 100% rename from src/com/fpghoti/classicswords/commands/CSwordCommand.java rename to src/main/java/com/fpghoti/classicswords/commands/CSwordCommand.java diff --git a/src/com/fpghoti/classicswords/item/CItemManager.java b/src/main/java/com/fpghoti/classicswords/item/CItemManager.java similarity index 100% rename from src/com/fpghoti/classicswords/item/CItemManager.java rename to src/main/java/com/fpghoti/classicswords/item/CItemManager.java diff --git a/src/com/fpghoti/classicswords/item/CItemType.java b/src/main/java/com/fpghoti/classicswords/item/CItemType.java similarity index 100% rename from src/com/fpghoti/classicswords/item/CItemType.java rename to src/main/java/com/fpghoti/classicswords/item/CItemType.java diff --git a/src/com/fpghoti/classicswords/item/ClassicSword.java b/src/main/java/com/fpghoti/classicswords/item/ClassicSword.java similarity index 95% rename from src/com/fpghoti/classicswords/item/ClassicSword.java rename to src/main/java/com/fpghoti/classicswords/item/ClassicSword.java index 3fb815d..352ccf9 100644 --- a/src/com/fpghoti/classicswords/item/ClassicSword.java +++ b/src/main/java/com/fpghoti/classicswords/item/ClassicSword.java @@ -3,6 +3,7 @@ package com.fpghoti.classicswords.item; import java.lang.reflect.Constructor; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; @@ -430,11 +431,11 @@ public class ClassicSword { int dur = ClassicSword.getCShieldDurability(item); dur = dur - amount; if(dur <= 0) { - sendActionbar(p, "§eDurability: 0"); + sendActionbar(p, ChatColor.YELLOW + "Durability: 0"); breakHeldItem(p); }else { if(isCItem(item)) { - sendActionbar(p, "§eDurability: " + dur); + sendActionbar(p, ChatColor.YELLOW + "Durability: " + dur); setCShieldDurability(p, item, dur); } } diff --git a/src/com/fpghoti/classicswords/item/SetAttributes.java b/src/main/java/com/fpghoti/classicswords/item/SetAttributes.java similarity index 100% rename from src/com/fpghoti/classicswords/item/SetAttributes.java rename to src/main/java/com/fpghoti/classicswords/item/SetAttributes.java diff --git a/src/com/fpghoti/classicswords/event/BlockingListener.java b/src/main/java/com/fpghoti/classicswords/listener/BlockingListener.java similarity index 90% rename from src/com/fpghoti/classicswords/event/BlockingListener.java rename to src/main/java/com/fpghoti/classicswords/listener/BlockingListener.java index e49a1bf..53b5a79 100644 --- a/src/com/fpghoti/classicswords/event/BlockingListener.java +++ b/src/main/java/com/fpghoti/classicswords/listener/BlockingListener.java @@ -1,4 +1,4 @@ -package com.fpghoti.classicswords.event; +package com.fpghoti.classicswords.listener; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -8,6 +8,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; +import com.fpghoti.classicswords.util.Util; + public class BlockingListener implements Listener{ @SuppressWarnings("deprecation") @@ -16,6 +18,9 @@ public class BlockingListener implements Listener{ if(event.getEntity() instanceof Player) { Player p = (Player) event.getEntity(); + if(!Util.usingPack(p)) { + return; + } if(p.isHandRaised() || p.isBlocking()){ double newdamage = event.getDamage() * 0.5; if(newdamage < 0) { diff --git a/src/com/fpghoti/classicswords/event/InventoryListener.java b/src/main/java/com/fpghoti/classicswords/listener/InventoryListener.java similarity index 83% rename from src/com/fpghoti/classicswords/event/InventoryListener.java rename to src/main/java/com/fpghoti/classicswords/listener/InventoryListener.java index cfd8cd2..90b56f5 100644 --- a/src/com/fpghoti/classicswords/event/InventoryListener.java +++ b/src/main/java/com/fpghoti/classicswords/listener/InventoryListener.java @@ -1,4 +1,4 @@ -package com.fpghoti.classicswords.event; +package com.fpghoti.classicswords.listener; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; @@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack; import com.fpghoti.classicswords.item.CItemType; import com.fpghoti.classicswords.item.ClassicSword; import com.fpghoti.classicswords.util.Storage; +import com.fpghoti.classicswords.util.Util; public class InventoryListener implements Listener{ @@ -30,7 +31,10 @@ public class InventoryListener implements Listener{ @EventHandler public void onInvClose(InventoryCloseEvent event){ - if(event.getPlayer() != null){ + if(event.getPlayer() != null && event.getPlayer() instanceof Player){ + if(!Util.usingPack((Player)event.getPlayer())) { + return; + } Storage.inInv.remove((Player)event.getPlayer()); ClassicSword.toShieldInv(((Player)event.getPlayer()).getInventory()); ClassicSword.blockToShieldInv(((Player)event.getPlayer()).getInventory()); @@ -41,6 +45,9 @@ public class InventoryListener implements Listener{ public void onExp(PlayerExpChangeEvent event){ if(event.getPlayer() != null){ Player p = event.getPlayer(); + if(!Util.usingPack(p)) { + return; + } if(ClassicSword.isCShield(p.getInventory().getItemInMainHand())) { ItemStack csword = p.getInventory().getItemInMainHand(); if(csword.containsEnchantment(Enchantment.MENDING)) { @@ -67,6 +74,9 @@ public class InventoryListener implements Listener{ @EventHandler public void onInvClick(InventoryClickEvent event){ Player p = (Player) event.getWhoClicked(); + if(!Util.usingPack(p)) { + return; + } if(event.getInventory() != null && p != null){ if(!event.isShiftClick()) { ClassicSword.toSwordInv(p.getInventory()); @@ -85,12 +95,21 @@ public class InventoryListener implements Listener{ } public static void handleDisconnect(Player p) { + if(!Util.usingPack(p)) { + return; + } Storage.inInv.remove(p); } @EventHandler public void onItemClick(InventoryDragEvent event){ + if(event.getWhoClicked() instanceof Player) { + Player p = (Player)event.getWhoClicked(); + if(!Util.usingPack(p)) { + return; + } + } if(event.getClass() != null){ if(ClassicSword.isCShield(event.getCursor())) { ItemStack newsword = ClassicSword.toSword(event.getCursor(), CItemType.getType(ClassicSword.getCShieldShortName(event.getCursor()))); @@ -102,6 +121,9 @@ public class InventoryListener implements Listener{ @EventHandler public void onHold(PlayerItemHeldEvent event){ + if(!Util.usingPack(event.getPlayer())) { + return; + } if(event.getPlayer() != null && ClassicSword.isCShield(event.getPlayer().getInventory().getItem(event.getNewSlot()))){ Integer dur = ClassicSword.getCShieldDurability(event.getPlayer().getInventory().getItem(event.getNewSlot())); ClassicSword.sendActionbar(event.getPlayer(), "§eDurability: " + dur); diff --git a/src/main/java/com/fpghoti/classicswords/listener/PlayerListener.java b/src/main/java/com/fpghoti/classicswords/listener/PlayerListener.java new file mode 100644 index 0000000..76dcaec --- /dev/null +++ b/src/main/java/com/fpghoti/classicswords/listener/PlayerListener.java @@ -0,0 +1,39 @@ +package com.fpghoti.classicswords.listener; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; + +import com.fpghoti.classicswords.util.Storage; + +public class PlayerListener implements Listener{ + + @EventHandler + public void onResourcePack(PlayerResourcePackStatusEvent event){ + if(event.getPlayer() != null){ + Player p = event.getPlayer(); + if(event.getStatus() == PlayerResourcePackStatusEvent.Status.ACCEPTED) { + Storage.usingPack.add(p); + } + } + } + + @EventHandler (priority = EventPriority.NORMAL) + public void onPlayerQuit(PlayerQuitEvent event) { + handleQuit(event.getPlayer()); + } + + @EventHandler (priority = EventPriority.NORMAL) + public void onPlayerKick(PlayerKickEvent event) { + handleQuit(event.getPlayer()); + } + + private static void handleQuit(Player p) { + Storage.usingPack.remove(p); + } + +} diff --git a/src/com/fpghoti/classicswords/event/RegenListener.java b/src/main/java/com/fpghoti/classicswords/listener/RegenListener.java similarity index 87% rename from src/com/fpghoti/classicswords/event/RegenListener.java rename to src/main/java/com/fpghoti/classicswords/listener/RegenListener.java index f404218..ab82abb 100644 --- a/src/com/fpghoti/classicswords/event/RegenListener.java +++ b/src/main/java/com/fpghoti/classicswords/listener/RegenListener.java @@ -1,4 +1,4 @@ -package com.fpghoti.classicswords.event; +package com.fpghoti.classicswords.listener; import org.bukkit.Bukkit; import org.bukkit.attribute.Attribute; @@ -11,6 +11,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; import com.fpghoti.classicswords.ClassicSwordsMain; import com.fpghoti.classicswords.util.Storage; +import com.fpghoti.classicswords.util.Util; public class RegenListener implements Listener{ @@ -23,6 +24,9 @@ public class RegenListener implements Listener{ @EventHandler(priority = EventPriority.HIGHEST) public void onRegen(EntityRegainHealthEvent event){ if(event.getEntityType() == EntityType.PLAYER || event.getRegainReason() == EntityRegainHealthEvent.RegainReason.SATIATED) { + if(!Util.usingPack((Player) event.getEntity())) { + return; + } event.setCancelled(true); Player p = (Player) event.getEntity(); double max = p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); diff --git a/src/com/fpghoti/classicswords/event/SwingListener.java b/src/main/java/com/fpghoti/classicswords/listener/SwingListener.java similarity index 82% rename from src/com/fpghoti/classicswords/event/SwingListener.java rename to src/main/java/com/fpghoti/classicswords/listener/SwingListener.java index 110bee4..c34089d 100644 --- a/src/com/fpghoti/classicswords/event/SwingListener.java +++ b/src/main/java/com/fpghoti/classicswords/listener/SwingListener.java @@ -1,4 +1,4 @@ -package com.fpghoti.classicswords.event; +package com.fpghoti.classicswords.listener; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -18,6 +18,9 @@ import com.fpghoti.classicswords.ClassicSwordsMain; import com.fpghoti.classicswords.item.CItemType; import com.fpghoti.classicswords.item.ClassicSword; import com.fpghoti.classicswords.util.Storage; +import com.fpghoti.classicswords.util.Util; + +import net.md_5.bungee.api.ChatColor; public class SwingListener implements Listener{ @@ -29,6 +32,9 @@ public class SwingListener implements Listener{ @EventHandler public void onSwingAtBlock(BlockDamageEvent event){ + if(!Util.usingPack(event.getPlayer())) { + return; + } if(event.getBlock() != null){ if(event.getPlayer().getGameMode() != GameMode.CREATIVE && event.getInstaBreak()) { Storage.instabreaks.add(event.getBlock().getType()); @@ -40,6 +46,9 @@ public class SwingListener implements Listener{ public void onSwingAtBlock(BlockBreakEvent event){ if(event.getPlayer() != null){ Player p = event.getPlayer(); + if(!Util.usingPack(p)) { + return; + } if(p.getInventory().getItemInMainHand() != null){ if(p.getInventory().getItemInMainHand().hasItemMeta()){ if(ClassicSword.isCShield(p.getInventory().getItemInMainHand())){ @@ -62,6 +71,9 @@ public class SwingListener implements Listener{ if(event.getEntity() != null){ if(event.getDamager() instanceof Player) { Player p = (Player)event.getDamager(); + if(!Util.usingPack(p)) { + return; + } if(event.getEntity() instanceof Player) { Player damaged = (Player) event.getEntity(); @@ -70,11 +82,6 @@ public class SwingListener implements Listener{ ClassicSwordsMain.runRecent(p, damaged); } - // if(Storage.blockers.contains(p)) { - // System.out.println("B"); - // p.playSound(p.getLocation(), Sound.BLOCK_NOTE_CHIME, 10.0F, 1.0F); - // } - ItemStack csword = p.getInventory().getItemInMainHand(); if(ClassicSword.isCShield(csword) && p.getGameMode() != GameMode.CREATIVE) { ClassicSword.damageCItem(p, csword, 1); @@ -87,6 +94,9 @@ public class SwingListener implements Listener{ public void onHit(PlayerInteractEvent event){ if(event.getPlayer() != null){ Player p = event.getPlayer(); + if(!Util.usingPack(p)) { + return; + } if((event.getAction() == Action.LEFT_CLICK_BLOCK) || (event.getAction() == Action.LEFT_CLICK_AIR)) { if(ClassicSword.isCShield(event.getPlayer().getInventory().getItemInMainHand())) { Storage.swingers.add(event.getPlayer()); @@ -101,16 +111,12 @@ public class SwingListener implements Listener{ if(Storage.swingers.contains(p) && ClassicSword.isCShield(p.getInventory().getItemInMainHand())) { p.getInventory().setItemInMainHand(ClassicSword.toBlockShield(p.getInventory().getItemInMainHand(), CItemType.getType(ClassicSword.getCShieldShortName(p.getInventory().getItemInMainHand())))); - //p.playSound(p.getLocation(), Sound.ENTITY_IRONGOLEM_STEP, 10.0F, 1.0F); p.playSound(p.getLocation(), Sound.ENTITY_IRON_GOLEM_STEP, 10.0F, 1.0F); if(Storage.recent.containsKey(p)) { final Player damaged = Storage.recent.get(p); Double health = Storage.recenthealth.get(damaged); if(damaged != null && damaged.getHealth() != health && !Storage.kb.contains(damaged)) { - //damaged.getLocation().getY() + 0.5 - - //damaged.setVelocity(p.getEyeLocation().getDirection().setY(p.getEyeLocation().getDirection().getY() + 0.5).multiply(1.005)); double kb = p.getEyeLocation().getDirection().getY(); @@ -124,19 +130,18 @@ public class SwingListener implements Listener{ kb = kb/2; damaged.setVelocity(p.getEyeLocation().getDirection().setY(kb).multiply(0.25)); }else { - //damaged.setVelocity(p.getEyeLocation().getDirection().setY(kb).multiply(1.001)); damaged.setVelocity(p.getEyeLocation().getDirection().setY(kb).multiply(0.75)); } if(Storage.perfect.contains(p)) { - ClassicSword.sendActionbar(p, "§aPerfect!"); + ClassicSword.sendActionbar(p, ChatColor.GREEN + "Perfect!"); Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { @Override public void run() { - ClassicSword.sendActionbar(p, "§fPe§arfe§act!"); + ClassicSword.sendActionbar(p, ChatColor.WHITE + "Pe" + ChatColor.GREEN + "rfe" + ChatColor.GREEN + "ct!"); } }, 3L); @@ -144,7 +149,7 @@ public class SwingListener implements Listener{ Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { @Override public void run() { - ClassicSword.sendActionbar(p, "§aPe§frfe§act!"); + ClassicSword.sendActionbar(p, ChatColor.GREEN + "Pe" + ChatColor.WHITE + "rfe" + ChatColor.GREEN + "ct!"); } }, 6L); @@ -152,7 +157,7 @@ public class SwingListener implements Listener{ Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { @Override public void run() { - ClassicSword.sendActionbar(p, "§aPe§arfe§fct!"); + ClassicSword.sendActionbar(p, ChatColor.GREEN + "Pe" + ChatColor.GREEN + "rfe" + ChatColor.WHITE + "ct!"); } }, 9L); @@ -160,13 +165,13 @@ public class SwingListener implements Listener{ Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { @Override public void run() { - ClassicSword.sendActionbar(p, "§aPerfect!"); + ClassicSword.sendActionbar(p, ChatColor.GREEN + "Perfect!"); } }, 12L); Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { @Override public void run() { - ClassicSword.sendActionbar(p, "§a§lPerfect!"); + ClassicSword.sendActionbar(p, ChatColor.GREEN + "" + ChatColor.BOLD + "Perfect!"); } }, 14L); @@ -177,13 +182,13 @@ public class SwingListener implements Listener{ Storage.kb.add(damaged); ClassicSwordsMain.runKB(damaged); }else if(Storage.great.contains(p)) { - ClassicSword.sendActionbar(p, "§eGreat!"); + ClassicSword.sendActionbar(p, ChatColor.GREEN + "Great!"); p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0F, 1.2F); Storage.perfect.add(p); Storage.kb.add(damaged); ClassicSwordsMain.runKB(damaged); }else { - ClassicSword.sendActionbar(p, "§cGood!"); + ClassicSword.sendActionbar(p, ChatColor.YELLOW + "Good!"); p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0F, 1.0F); ClassicSwordsMain.streakTimer(p); Storage.great.add(p); @@ -198,14 +203,14 @@ public class SwingListener implements Listener{ ClassicSwordsMain.blockToShieldTimer(p); }else { - //ClassicSword.sendActionbar(p, "§aBlock hit!"); + //ClassicSword.sendActionbar(p, ChatColor.GREEN + "Block hit!"); } // System.out.println("A"); // Storage.blockers.add(p); // ClassicSwordsMain.runBlock(p); }else { - //ClassicSword.sendActionbar(p, "§aBlock hit!"); + //ClassicSword.sendActionbar(p, ChatColor.GREEN + "Block hit!"); } try{ diff --git a/src/com/fpghoti/classicswords/util/Storage.java b/src/main/java/com/fpghoti/classicswords/util/Storage.java similarity index 90% rename from src/com/fpghoti/classicswords/util/Storage.java rename to src/main/java/com/fpghoti/classicswords/util/Storage.java index d252a6a..1a8e1f1 100644 --- a/src/com/fpghoti/classicswords/util/Storage.java +++ b/src/main/java/com/fpghoti/classicswords/util/Storage.java @@ -14,6 +14,8 @@ import org.bukkit.entity.Player; import io.netty.util.internal.ConcurrentSet; import net.minecraft.server.v1_15_R1.NBTTagCompound; +// TODO rework plugin to get rid of this mess + public class Storage { public static ConcurrentHashMap bools = new ConcurrentHashMap<>(); public static HashMap damagetag = new HashMap<>(); @@ -29,4 +31,5 @@ public class Storage { public static ConcurrentSet kb = new ConcurrentSet<>(); public static ConcurrentSet great = new ConcurrentSet<>(); public static ConcurrentSet perfect = new ConcurrentSet<>(); + public static ConcurrentSet usingPack = new ConcurrentSet<>(); } diff --git a/src/com/fpghoti/classicswords/util/Functions.java b/src/main/java/com/fpghoti/classicswords/util/Util.java similarity index 77% rename from src/com/fpghoti/classicswords/util/Functions.java rename to src/main/java/com/fpghoti/classicswords/util/Util.java index 4cf3827..719ae8a 100644 --- a/src/com/fpghoti/classicswords/util/Functions.java +++ b/src/main/java/com/fpghoti/classicswords/util/Util.java @@ -5,18 +5,18 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -public class Functions { +public class Util { + + - public Player playerGet(String uuid){ + public static Player playerGet(String uuid){ UUID id = UUID.fromString(uuid); Player p = Bukkit.getPlayer(id); return p; } - public Boolean cModeEnabled(Player p) { - Boolean enabled = false; - //TO DO Work on resource pack detection - return enabled; + public static Boolean usingPack(Player p) { + return Storage.usingPack.contains(p); } public static Player getEP(String playername){ diff --git a/src/plugin.yml b/src/main/resources/plugin.yml similarity index 60% rename from src/plugin.yml rename to src/main/resources/plugin.yml index 0c051eb..f350764 100644 --- a/src/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: com.fpghoti.classicswords.ClassicSwordsMain -version: BETA-1.0 -api-version: 1.13 +version: ${project.version} +api-version: 1.15 name: ClassicSwords descripion: Bring back the old combat! commands: