Some changes and fixes (#510)

* Various Fixes

• Added Java version to debug.txt file
• Added Probending to the debug.txt file (and added PB methods)
• Changed layout of debug.txt file
• Fixed AddonAbilities with the same name as Stock abilities always
being disabled
• Fixed AcrobatStance and WarriorStance effects still being applied when
the user is no longer a chiblocker

* Changed all ConcurrentHashMaps to use generic map types

• As the title says, it's an attempt to fix a Java 7/8 error in
ConcurrentHashMaps. All Maps are still concurrent but their type is just
a generic map, not a concurrent one.
• Fixed FireBlast damage being slightly off

* Fixed Java 7 Compile Errors
This commit is contained in:
StrangeOne101 2016-06-30 08:12:45 +12:00 committed by OmniCypher
parent cb8278130d
commit ff64cf9ca2
38 changed files with 201 additions and 150 deletions

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@ -40,7 +41,7 @@ public class BendingPlayer {
/**
* ConcurrentHashMap that contains all instances of BendingPlayer, with UUID key.
*/
private static final ConcurrentHashMap<UUID, BendingPlayer> PLAYERS = new ConcurrentHashMap<>();
private static final Map<UUID, BendingPlayer> PLAYERS = new ConcurrentHashMap<>();
private boolean permaRemoved;
private boolean toggled;
@ -54,8 +55,8 @@ public class BendingPlayer {
private ArrayList<Element> elements;
private ArrayList<SubElement> subelements;
private HashMap<Integer, String> abilities;
private ConcurrentHashMap<String, Long> cooldowns;
private ConcurrentHashMap<Element, Boolean> toggledElements;
private Map<String, Long> cooldowns;
private Map<Element, Boolean> toggledElements;
/**
* Creates a new {@link BendingPlayer}.
@ -423,7 +424,7 @@ public class BendingPlayer {
*
* @return map of cooldowns
*/
public ConcurrentHashMap<String, Long> getCooldowns() {
public Map<String, Long> getCooldowns() {
return cooldowns;
}
@ -735,7 +736,7 @@ public class BendingPlayer {
*
* @return {@link #PLAYERS}
*/
public static ConcurrentHashMap<UUID, BendingPlayer> getPlayers() {
public static Map<UUID, BendingPlayer> getPlayers() {
return PLAYERS;
}
}

View file

@ -136,7 +136,7 @@ public class GeneralMethods {
Material.WOOD_BUTTON, Material.WOOD_DOOR, Material.WORKBENCH };
// Represents PlayerName, previously checked blocks, and whether they were true or false
private static final ConcurrentHashMap<String, ConcurrentHashMap<Block, BlockCacheElement>> BLOCK_CACHE = new ConcurrentHashMap<>();
private static final Map<String, Map<Block, BlockCacheElement>> BLOCK_CACHE = new ConcurrentHashMap<>();
private static final ArrayList<Ability> INVINCIBLE = new ArrayList<>();
private static ProjectKorra plugin;
@ -893,6 +893,13 @@ public class GeneralMethods {
return location.clone().subtract(new Vector(Math.cos(angle), 0, Math.sin(angle)).normalize().multiply(distance));
}
public static Plugin getProbending() {
if (hasProbending()) {
return Bukkit.getServer().getPluginManager().getPlugin("Probending");
}
return null;
}
public static Plugin getRPG() {
if (hasRPG()) {
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraRPG");
@ -1004,6 +1011,10 @@ public class GeneralMethods {
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraItems") != null;
}
public static boolean hasProbending() {
return Bukkit.getServer().getPluginManager().getPlugin("Probending") != null;
}
public static boolean hasRPG() {
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraRPG") != null;
}
@ -1073,7 +1084,7 @@ public class GeneralMethods {
BLOCK_CACHE.put(player.getName(), new ConcurrentHashMap<Block, BlockCacheElement>());
}
ConcurrentHashMap<Block, BlockCacheElement> blockMap = BLOCK_CACHE.get(player.getName());
Map<Block, BlockCacheElement> blockMap = BLOCK_CACHE.get(player.getName());
Block block = loc.getBlock();
if (blockMap.containsKey(block)) {
BlockCacheElement elem = blockMap.get(block);
@ -1425,57 +1436,35 @@ public class GeneralMethods {
writeToDebug("");
writeToDebug("");
writeToDebug("Date Created: " + getCurrentDate());
writeToDebug("Java Version: " + Runtime.class.getPackage().getImplementationVersion());
writeToDebug("Bukkit Version: " + Bukkit.getServer().getVersion());
writeToDebug("");
writeToDebug("ProjectKorra (Core) Information");
writeToDebug("====================");
writeToDebug("Version: " + plugin.getDescription().getVersion());
writeToDebug("Author: " + plugin.getDescription().getAuthors());
List<String> officialSidePlugins = new ArrayList<String>();
if (hasRPG()) {
writeToDebug("");
writeToDebug("ProjectKorra (RPG) Information");
writeToDebug("====================");
writeToDebug("Version: " + getRPG().getDescription().getVersion());
writeToDebug("Author: " + getRPG().getDescription().getAuthors());
officialSidePlugins.add("ProjectKorra RPG v" + getRPG().getDescription().getVersion());
}
if (hasItems()) {
writeToDebug("");
writeToDebug("ProjectKorra (Items) Information");
writeToDebug("====================");
writeToDebug("Version: " + getItems().getDescription().getVersion());
writeToDebug("Author: " + getItems().getDescription().getAuthors());
officialSidePlugins.add("ProjectKorra Items v" + getItems().getDescription().getVersion());
}
if (hasSpirits()) {
officialSidePlugins.add("ProjectKorra Spirits v" + getSpirits().getDescription().getVersion());
}
if (hasProbending()) {
officialSidePlugins.add("Probending v" + getProbending().getDescription().getVersion());
}
if (!officialSidePlugins.isEmpty()) {
writeToDebug("");
writeToDebug("ProjectKorra (Spirits) Information");
writeToDebug("ProjectKorra (Side Plugin) Information");
writeToDebug("====================");
writeToDebug("Version: " + getSpirits().getDescription().getVersion());
writeToDebug("Author: " + getSpirits().getDescription().getAuthors());
}
writeToDebug("");
writeToDebug("Ability Information");
writeToDebug("====================");
ArrayList<String> stockAbils = new ArrayList<String>();
ArrayList<String> unofficialAbils = new ArrayList<String>();
for (CoreAbility ability : CoreAbility.getAbilities()) {
if (ability.getClass().getPackage().getName().startsWith("com.projectkorra")) {
stockAbils.add(ability.getName());
} else {
unofficialAbils.add(ability.getName());
}
}
if (!stockAbils.isEmpty()) {
Collections.sort(stockAbils);
for (String ability : stockAbils) {
writeToDebug(ability + " - STOCK");
}
}
if (!unofficialAbils.isEmpty()) {
Collections.sort(unofficialAbils);
for (String ability : unofficialAbils) {
writeToDebug(ability + " - UNOFFICAL");
for (String line : officialSidePlugins) {
writeToDebug(line);
}
}
writeToDebug("");
writeToDebug("Supported Plugins");
writeToDebug("====================");
@ -1527,6 +1516,31 @@ public class GeneralMethods {
}
}
writeToDebug("");
writeToDebug("Ability Information");
writeToDebug("====================");
ArrayList<String> stockAbils = new ArrayList<String>();
ArrayList<String> unofficialAbils = new ArrayList<String>();
for (CoreAbility ability : CoreAbility.getAbilities()) {
if (ability.getClass().getPackage().getName().startsWith("com.projectkorra")) {
stockAbils.add(ability.getName());
} else {
unofficialAbils.add(ability.getName());
}
}
if (!stockAbils.isEmpty()) {
Collections.sort(stockAbils);
for (String ability : stockAbils) {
writeToDebug(ability + " - STOCK");
}
}
if (!unofficialAbils.isEmpty()) {
Collections.sort(unofficialAbils);
for (String ability : unofficialAbils) {
writeToDebug(ability + " - UNOFFICAL");
}
}
writeToDebug("");
writeToDebug("Collection Sizes");
writeToDebug("====================");
@ -1558,7 +1572,10 @@ public class GeneralMethods {
writeToDebug("");
writeToDebug("CoreAbility Debugger");
writeToDebug("====================");
writeToDebug(CoreAbility.getDebugString());
for (String line : CoreAbility.getDebugString().split("\\n")) {
writeToDebug(line);
}
}
public static void saveAbility(BendingPlayer bPlayer, int slot, String ability) {
@ -1717,7 +1734,7 @@ public class GeneralMethods {
new BukkitRunnable() {
@Override
public void run() {
for (ConcurrentHashMap<Block, BlockCacheElement> map : BLOCK_CACHE.values()) {
for (Map<Block, BlockCacheElement> map : BLOCK_CACHE.values()) {
for (Iterator<Block> i = map.keySet().iterator(); i.hasNext();) {
Block key = i.next();
BlockCacheElement value = map.get(key);

View file

@ -10,6 +10,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@ -51,9 +52,9 @@ import sun.reflect.ReflectionFactory;
*/
public abstract class CoreAbility implements Ability {
private static final ConcurrentHashMap<Class<? extends CoreAbility>, ConcurrentHashMap<UUID, ConcurrentHashMap<Integer, CoreAbility>>> INSTANCES = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<Class<? extends CoreAbility>, Set<CoreAbility>> INSTANCES_BY_CLASS = new ConcurrentHashMap<>();
private static final ConcurrentSkipListMap<String, CoreAbility> ABILITIES_BY_NAME = new ConcurrentSkipListMap<>();
private static final Map<Class<? extends CoreAbility>, Map<UUID, Map<Integer, CoreAbility>>> INSTANCES = new ConcurrentHashMap<>();
private static final Map<Class<? extends CoreAbility>, Set<CoreAbility>> INSTANCES_BY_CLASS = new ConcurrentHashMap<>();
private static final Map<String, CoreAbility> ABILITIES_BY_NAME = new ConcurrentSkipListMap<>();
private static int idCounter;
@ -129,7 +130,7 @@ public abstract class CoreAbility implements Ability {
UUID uuid = player.getUniqueId();
if (!INSTANCES.containsKey(clazz)) {
INSTANCES.put(clazz, new ConcurrentHashMap<UUID, ConcurrentHashMap<Integer, CoreAbility>>());
INSTANCES.put(clazz, new ConcurrentHashMap<UUID, Map<Integer, CoreAbility>>());
}
if (!INSTANCES.get(clazz).containsKey(uuid)) {
INSTANCES.get(clazz).put(uuid, new ConcurrentHashMap<Integer, CoreAbility>());
@ -159,9 +160,9 @@ public abstract class CoreAbility implements Ability {
Bukkit.getServer().getPluginManager().callEvent(new AbilityEndEvent(this));
removed = true;
ConcurrentHashMap<UUID, ConcurrentHashMap<Integer, CoreAbility>> classMap = INSTANCES.get(getClass());
Map<UUID, Map<Integer, CoreAbility>> classMap = INSTANCES.get(getClass());
if (classMap != null) {
ConcurrentHashMap<Integer, CoreAbility> playerMap = classMap.get(player.getUniqueId());
Map<Integer, CoreAbility> playerMap = classMap.get(player.getUniqueId());
if (playerMap != null) {
playerMap.remove(this.id);
if (playerMap.size() == 0) {
@ -324,7 +325,7 @@ public abstract class CoreAbility implements Ability {
public static Set<Player> getPlayers(Class<? extends CoreAbility> clazz) {
HashSet<Player> players = new HashSet<>();
if (clazz != null) {
ConcurrentHashMap<UUID, ConcurrentHashMap<Integer, CoreAbility>> uuidMap = INSTANCES.get(clazz);
Map<UUID, Map<Integer, CoreAbility>> uuidMap = INSTANCES.get(clazz);
if (uuidMap != null) {
for (UUID uuid : uuidMap.keySet()) {
Player uuidPlayer = Bukkit.getPlayer(uuid);
@ -478,7 +479,7 @@ public abstract class CoreAbility implements Ability {
plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!");
e.printStackTrace();
addon.stop();
ABILITIES_BY_NAME.remove(coreAbil.getName(), coreAbil);
ABILITIES_BY_NAME.remove(name.toLowerCase());
}
}
}
@ -510,6 +511,10 @@ public abstract class CoreAbility implements Ability {
@Override
public boolean isEnabled() {
if (this instanceof AddonAbility) {
return true;
}
String elementName = getElement().getName();
if (getElement() instanceof SubElement) {
elementName = ((SubElement) getElement()).getParentElement().getName();
@ -566,9 +571,9 @@ public abstract class CoreAbility implements Ability {
int playerCounter = 0;
HashMap<String, Integer> classCounter = new HashMap<>();
for (ConcurrentHashMap<UUID, ConcurrentHashMap<Integer, CoreAbility>> map1 : INSTANCES.values()) {
for (Map<UUID, Map<Integer, CoreAbility>> map1 : INSTANCES.values()) {
playerCounter++;
for (ConcurrentHashMap<Integer, CoreAbility> map2 : map1.values()) {
for (Map<Integer, CoreAbility> map2 : map1.values()) {
for (CoreAbility coreAbil : map2.values()) {
String simpleName = coreAbil.getClass().getSimpleName();

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.ability;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.ChatColor;
@ -32,8 +33,8 @@ import com.projectkorra.projectkorra.util.TempBlock;
public abstract class EarthAbility extends ElementalAbility {
private static final HashSet<Block> PREVENT_EARTHBENDING = new HashSet<Block>();
private static final ConcurrentHashMap<Block, Information> MOVED_EARTH = new ConcurrentHashMap<Block, Information>();
private static final ConcurrentHashMap<Integer, Information> TEMP_AIR_LOCATIONS = new ConcurrentHashMap<Integer, Information>();
private static final Map<Block, Information> MOVED_EARTH = new ConcurrentHashMap<Block, Information>();
private static final Map<Integer, Information> TEMP_AIR_LOCATIONS = new ConcurrentHashMap<Integer, Information>();
private static final ArrayList<Block> PREVENT_PHYSICS = new ArrayList<Block>();
public EarthAbility(Player player) {
@ -352,7 +353,7 @@ public abstract class EarthAbility extends ElementalAbility {
return value * getConfig().getDouble("Properties.Earth.MetalPowerFactor");
}
public static ConcurrentHashMap<Block, Information> getMovedEarth() {
public static Map<Block, Information> getMovedEarth() {
return MOVED_EARTH;
}
@ -403,7 +404,7 @@ public abstract class EarthAbility extends ElementalAbility {
return player.getTargetBlock(getTransparentMaterialSet(), range);
}
public static ConcurrentHashMap<Integer, Information> getTempAirLocations() {
public static Map<Integer, Information> getTempAirLocations() {
return TEMP_AIR_LOCATIONS;
}
@ -431,7 +432,7 @@ public abstract class EarthAbility extends ElementalAbility {
byte full = 0x0;
if (TempBlock.isTempBlock(block)) {
TempBlock tblock = TempBlock.instances.get(block);
if (tblock == null || !LavaFlow.getTempLavaBlocks().contains(tblock)) {
if (tblock == null || !LavaFlow.getTempLavaBlocks().values().contains(tblock)) {
return false;
}
}

View file

@ -21,12 +21,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
public abstract class FireAbility extends ElementalAbility {
private static final ConcurrentHashMap<Location, Information> TEMP_FIRE = new ConcurrentHashMap<Location, Information>();
private static final Map<Location, Information> TEMP_FIRE = new ConcurrentHashMap<Location, Information>();
private static final Material[] IGNITABLE_MATERIALS = { Material.BEDROCK, Material.BOOKSHELF, Material.BRICK, Material.CLAY, Material.CLAY_BRICK,
Material.COAL_ORE, Material.COBBLESTONE, Material.DIAMOND_ORE, Material.DIAMOND_BLOCK, Material.DIRT,
Material.ENDER_STONE, Material.GLOWING_REDSTONE_ORE, Material.GOLD_BLOCK, Material.GRAVEL, Material.GRASS,

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.ability.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.entity.Player;
@ -24,7 +25,7 @@ import com.projectkorra.projectkorra.waterbending.WaterCombo;
public class ComboManager {
private static final long CLEANUP_DELAY = 20 * 600;
private static final ConcurrentHashMap<String, ArrayList<AbilityInformation>> RECENTLY_USED = new ConcurrentHashMap<>();
private static final Map<String, ArrayList<AbilityInformation>> RECENTLY_USED = new ConcurrentHashMap<>();
private static final HashMap<String, ComboAbilityInfo> COMBO_ABILITIES = new HashMap<>();
private static final HashMap<String, String> AUTHORS = new HashMap<>();
private static final HashMap<String, String> DESCRIPTIONS = new HashMap<>();

View file

@ -14,13 +14,14 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class MultiAbilityManager {
public static ConcurrentHashMap<Player, HashMap<Integer, String>> playerAbilities = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, Integer> playerSlot = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, String> playerBoundAbility = new ConcurrentHashMap<>();
public static Map<Player, HashMap<Integer, String>> playerAbilities = new ConcurrentHashMap<>();
public static Map<Player, Integer> playerSlot = new ConcurrentHashMap<>();
public static Map<Player, String> playerBoundAbility = new ConcurrentHashMap<>();
public static ArrayList<MultiAbilityInfo> multiAbilityList = new ArrayList<MultiAbilityInfo>();
public MultiAbilityManager() {

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.airbending;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -34,7 +35,7 @@ import com.projectkorra.projectkorra.util.Flight;
public class AirBlast extends AirAbility {
private static final int MAX_TICKS = 10000;
private static final ConcurrentHashMap<Player, Location> ORIGINS = new ConcurrentHashMap<>();
private static final Map<Player, Location> ORIGINS = new ConcurrentHashMap<>();
private boolean canFlickLevers;
private boolean canOpenDoors;
@ -170,11 +171,8 @@ public class AirBlast extends AirAbility {
return;
}
if (ORIGINS.containsKey(player)) {
ORIGINS.replace(player, location);
} else {
ORIGINS.put(player, location);
}
ORIGINS.put(player, location);
}
private void advanceLocation() {

View file

@ -14,6 +14,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class AirBubble extends AirAbility {
@ -22,7 +23,7 @@ public class AirBubble extends AirAbility {
private double radius;
private double airRadius;
private double waterRadius;
private ConcurrentHashMap<Block, BlockState> waterOrigins;
private Map<Block, BlockState> waterOrigins;
public AirBubble(Player player) {
super(player);
@ -200,7 +201,7 @@ public class AirBubble extends AirAbility {
this.waterRadius = waterRadius;
}
public ConcurrentHashMap<Block, BlockState> getWaterOrigins() {
public Map<Block, BlockState> getWaterOrigins() {
return waterOrigins;
}

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.airbending;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -22,7 +23,7 @@ import com.projectkorra.projectkorra.waterbending.WaterSpout;
public class AirSuction extends AirAbility {
private static final int MAX_TICKS = 10000;
private static final ConcurrentHashMap<Player, Location> ORIGINS = new ConcurrentHashMap<>();
private static final Map<Player, Location> ORIGINS = new ConcurrentHashMap<>();
private boolean hasOtherOrigin;
private int ticks;
@ -114,8 +115,6 @@ public class AirSuction extends AirAbility {
return;
} else if (GeneralMethods.isRegionProtectedFromBuild(player, "AirSuction", location)) {
return;
} else if (ORIGINS.containsKey(player)) {
ORIGINS.replace(player, location);
} else {
ORIGINS.put(player, location);
}
@ -335,7 +334,7 @@ public class AirSuction extends AirAbility {
this.cooldown = cooldown;
}
public static ConcurrentHashMap<Player, Location> getOrigins() {
public static Map<Player, Location> getOrigins() {
return ORIGINS;
}

View file

@ -26,6 +26,7 @@ import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -50,7 +51,7 @@ public class AirSwipe extends AirAbility {
private Location origin;
private Random random;
private AirSwipe ability;
private ConcurrentHashMap<Vector, Location> elements;
private Map<Vector, Location> elements;
private ArrayList<Entity> affectedEntities;
public AirSwipe(Player player) {
@ -117,7 +118,7 @@ public class AirSwipe extends AirAbility {
Location location = elements.get(direction);
if (direction != null && location != null) {
location = location.clone().add(direction.clone().multiply(speed));
elements.replace(direction, location);
elements.put(direction, location);
if (location.distanceSquared(origin) > range * range
|| GeneralMethods.isRegionProtectedFromBuild(this, location)) {
@ -409,7 +410,7 @@ public class AirSwipe extends AirAbility {
this.maxChargeFactor = maxChargeFactor;
}
public ConcurrentHashMap<Vector, Location> getElements() {
public Map<Vector, Location> getElements() {
return elements;
}

View file

@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -31,7 +32,7 @@ public class Tornado extends AirAbility {
private Flight flight;
private Location origin;
private Random random;
private ConcurrentHashMap<Integer, Integer> angles;
private Map<Integer, Integer> angles;
public Tornado(Player player) {
super(player);
@ -297,7 +298,7 @@ public class Tornado extends AirAbility {
this.currentRadius = currentRadius;
}
public ConcurrentHashMap<Integer, Integer> getAngles() {
public Map<Integer, Integer> getAngles() {
return angles;
}
}

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ability.ChiAbility;
import org.bukkit.Location;
@ -39,7 +40,7 @@ public class AcrobatStance extends ChiAbility {
@Override
public void progress() {
if (!bPlayer.canBendIgnoreBindsCooldowns(this)) {
if (!bPlayer.canBendIgnoreBindsCooldowns(this) || !bPlayer.hasElement(Element.CHI)) {
remove();
return;
}

View file

@ -10,6 +10,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/*
@ -23,7 +24,7 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
* a Map containing every entity which is paralyzed, and the time in
* milliseconds at which they will be unparalyzed.
*/
private static final ConcurrentHashMap<Entity, Long> PARALYZED_ENTITIES = new ConcurrentHashMap<>();
private static final Map<Entity, Long> PARALYZED_ENTITIES = new ConcurrentHashMap<>();
private long duration;
private long cooldown;
@ -177,7 +178,7 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
this.target = target;
}
public static ConcurrentHashMap<Entity, Long> getParalyzedEntities() {
public static Map<Entity, Long> getParalyzedEntities() {
return PARALYZED_ENTITIES;
}

View file

@ -10,12 +10,13 @@ import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Paralyze extends ChiAbility {
private static final ConcurrentHashMap<Entity, Long> ENTITIES = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<Entity, Long> COOLDOWNS = new ConcurrentHashMap<>();
private static final Map<Entity, Long> ENTITIES = new ConcurrentHashMap<>();
private static final Map<Entity, Long> COOLDOWNS = new ConcurrentHashMap<>();
private long cooldown;
private Entity target;
@ -121,11 +122,11 @@ public class Paralyze extends ChiAbility {
this.target = target;
}
public static ConcurrentHashMap<Entity, Long> getEntities() {
public static Map<Entity, Long> getEntities() {
return ENTITIES;
}
public static ConcurrentHashMap<Entity, Long> getCooldowns() {
public static Map<Entity, Long> getCooldowns() {
return COOLDOWNS;
}

View file

@ -12,13 +12,14 @@ import org.bukkit.entity.Snowball;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Smokescreen extends ChiAbility {
private static final ConcurrentHashMap<Integer, Smokescreen> SNOWBALLS = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, Long> BLINDED_TIMES = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, Smokescreen> BLINDED_TO_ABILITY = new ConcurrentHashMap<>();
private static final Map<Integer, Smokescreen> SNOWBALLS = new ConcurrentHashMap<>();
private static final Map<String, Long> BLINDED_TIMES = new ConcurrentHashMap<>();
private static final Map<String, Smokescreen> BLINDED_TO_ABILITY = new ConcurrentHashMap<>();
private int duration;
private long cooldown;
@ -136,15 +137,15 @@ public class Smokescreen extends ChiAbility {
this.radius = radius;
}
public static ConcurrentHashMap<Integer, Smokescreen> getSnowballs() {
public static Map<Integer, Smokescreen> getSnowballs() {
return SNOWBALLS;
}
public static ConcurrentHashMap<String, Long> getBlindedTimes() {
public static Map<String, Long> getBlindedTimes() {
return BLINDED_TIMES;
}
public static ConcurrentHashMap<String, Smokescreen> getBlindedToAbility() {
public static Map<String, Smokescreen> getBlindedToAbility() {
return BLINDED_TO_ABILITY;
}

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ability.ChiAbility;
import org.bukkit.Location;
@ -34,7 +35,7 @@ public class WarriorStance extends ChiAbility {
@Override
public void progress() {
if (!bPlayer.canBendIgnoreBindsCooldowns(this)) {
if (!bPlayer.canBendIgnoreBindsCooldowns(this) || !bPlayer.hasElement(Element.CHI)) {
remove();
return;
}

View file

@ -212,7 +212,7 @@ public class ConfigManager {
config.addDefault("Abilities.Avatar.AvatarState.Description", "The signature ability of the Avatar, this is a toggle. Click to activate to become " + "nearly unstoppable. While in the Avatar State, the user takes severely reduced damage from " + "all sources, regenerates health rapidly, and is granted extreme speed. Nearly all abilities " + "are incredibly amplified in this state. Additionally, AirShield and FireJet become toggle-able " + "abilities and last until you deactivate them or the Avatar State. Click again with the Avatar " + "State selected to deactivate it.");
config.addDefault("Commands.Help.Elements.Air", "Air is the element of freedom. Airbenders are natural pacifists and great explorers. There is nothing stopping them from scaling the tallest of mountains and walls easily. They specialize in redirection, from blasting things away with gusts of winds, to forming a shield around them to prevent damage. Easy to get across flat terrains, such as oceans, there is practically no terrain off limits to Airbenders. They lack much raw damage output, but make up for it with with their ridiculous amounts of utility and speed.\nAirbenders can chain their abilities into combos, type /b help AirCombos for more information.");
config.addDefault("Abilities.Air.Description", "Air is the element of freedom. Airbenders are natural pacifists and great explorers. There is nothing stopping them from scaling the tallest of mountains and walls easily. They specialize in redirection, from blasting things away with gusts of winds, to forming a shield around them to prevent damage. Easy to get across flat terrains, such as oceans, there is practically no terrain off limits to Airbenders. They lack much raw damage output, but make up for it with with their ridiculous amounts of utility and speed.\nAirbenders can chain their abilities into combos, type /b help AirCombos for more information.");
config.addDefault("Abilities.Air.AirBlast.Description", "AirBlast is the most fundamental bending technique of an airbender." + " To use, simply left-click in a direction. A gust of wind will be" + " created at your fingertips, launching anything in its path harmlessly back." + " A gust of air can extinguish fires on the ground or on a player, can cool lava, and " + "can flip levers and activate buttons. Additionally, tapping sneak will change the " + "origin of your next AirBlast to your targeted location.");
config.addDefault("Abilities.Air.AirBlast.DeathMessage", "{victim} was flung by {attacker}'s {ability}");
config.addDefault("Abilities.Air.AirBlast.HorizontalVelocityDeath","{victim} experienced kinetic damage by {attacker}'s {ability}");
@ -236,7 +236,7 @@ public class ConfigManager {
config.addDefault("Abilities.Air.Combo.AirSweep.Description", "Sweep the air in front of you hitting multiple enemies, causing moderate damage and a large knockback. The radius and direction of AirSweep is controlled by moving your mouse in a sweeping motion. For example, if you want to AirSweep upward, then move your mouse upward right after you left click AirBurst");
config.addDefault("Abilities.Air.Combo.AirSweep.DeathMessage", "{victim} was swept away by {attacker}'s {ability}");
config.addDefault("Commands.Help.Elements.Water", "Water is the element of change. Waterbending focuses on using your opponents own force against them. Using redirection and various dodging tactics, you can be made practically untouchable by an opponent. Waterbending provides agility, along with strong offensive skills while in or near water.\nWaterbenders can chain their abilities into combos, type /b help WaterCombos for more information.");
config.addDefault("Abilities.Water.Description", "Water is the element of change. Waterbending focuses on using your opponents own force against them. Using redirection and various dodging tactics, you can be made practically untouchable by an opponent. Waterbending provides agility, along with strong offensive skills while in or near water.\nWaterbenders can chain their abilities into combos, type /b help WaterCombos for more information.");
config.addDefault("Abilities.Water.Bloodbending.Description", "This ability was made illegal for a reason. With this ability selected, sneak while " + "targetting something and you will bloodbend that target. Bloodbent targets cannot move, " + "bend or attack. You are free to control their actions by looking elsewhere - they will " + "be forced to move in that direction. Additionally, clicking while bloodbending will " + "launch that target off in the direction you're looking. " + "People who are capable of bloodbending are immune to your technique, and you are immune to theirs.");
config.addDefault("Abilities.Water.Bloodbending.DeathMessage", "{victim} was destroyed by {attacker}'s {ability}");
config.addDefault("Abilities.Water.Bloodbending.HorizontalVelocityDeath","{victim} experienced kinetic damage by {attacker}'s {ability}");
@ -266,7 +266,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.Combo.IceWave.Description", "PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
config.addDefault("Abilities.Water.Combo.IceWave.DeathMessage", "{victim} was frozen solid by {attacker}'s {ability}");
config.addDefault("Commands.Help.Elements.Earth", "Earth is the element of substance. Earthbenders share many of the same fundamental techniques as Waterbenders, but their domain is quite different and more readily accessible. Earthbenders dominate the ground and subterranean, having abilities to pull columns of rock straight up from the earth or drill their way through the mountain. They can also launch themselves through the air using pillars of rock, and will not hurt themselves assuming they land on something they can bend. The more skilled Earthbenders can even bend metal.");
config.addDefault("Abilities.Earth.Description", "Earth is the element of substance. Earthbenders share many of the same fundamental techniques as Waterbenders, but their domain is quite different and more readily accessible. Earthbenders dominate the ground and subterranean, having abilities to pull columns of rock straight up from the earth or drill their way through the mountain. They can also launch themselves through the air using pillars of rock, and will not hurt themselves assuming they land on something they can bend. The more skilled Earthbenders can even bend metal.");
config.addDefault("Abilities.Earth.Catapult.Description", "To use, left-click while looking in the direction you want to be launched. " + "A pillar of earth will jut up from under you and launch you in that direction - " + "if and only if there is enough earth behind where you're looking to launch you. " + "Skillful use of this ability takes much time and work, and it does result in the " + "death of certain gung-ho earthbenders. If you plan to use this ability, be sure " + "you've read about your passive ability you innately have as an earthbender.");
config.addDefault("Abilities.Earth.Collapse.Description", " To use, simply left-click on an earthbendable block. " + "That block and the earthbendable blocks above it will be shoved " + "back into the earth below them, if they can. " + "This ability does have the capacity to trap something inside of it, " + "although it is incredibly difficult to do so. " + "Additionally, press sneak with this ability to affect an area around your targetted location - " + "all earth that can be moved downwards will be moved downwards. " + "This ability is especially risky or deadly in caves, depending on the " + "earthbender's goal and technique.");
config.addDefault("Abilities.Earth.Collapse.DeathMessage", "{victim} was suffocated by {attacker}'s {ability}");
@ -288,7 +288,7 @@ public class ConfigManager {
config.addDefault("Abilities.Earth.SandSpout.Description", "SandSpout is a core move for travelling, evasion, and mobility for sandbenders. To use, simply left click while over sand or sandstone, and a column of sand will form at your feet, enabling you to levitate. Any mobs or players that touch your column will receive damage and be blinded. Beware, as the spout will stop working when no longer over sand!");
config.addDefault("Abilities.Earth.Tremorsense.Description", "This is a pure utility ability for earthbenders. If you are in an area of low-light and are standing on top of an earthbendable block, this ability will automatically turn that block into glowstone, visible *only by you*. If you lose contact with a bendable block, the light will go out as you have lost contact with the earth and cannot 'see' until you can touch earth again. Additionally, if you click with this ability selected, smoke will appear above nearby earth with pockets of air beneath them.");
config.addDefault("Commands.Help.Elements.Fire", "Fire is the element of power. Firebenders focus on destruction and incineration. Their abilities are pretty straight forward: set things on fire. They do have a bit of utility however, being able to make themselves un-ignitable, extinguish large areas, cook food in their hands, extinguish large areas, small bursts of flight, and then comes the abilities to shoot fire from your hands.\nFirebenders can chain their abilities into combos, type /b help FireCombos for more information.");
config.addDefault("Abilities.Fire.Description", "Fire is the element of power. Firebenders focus on destruction and incineration. Their abilities are pretty straight forward: set things on fire. They do have a bit of utility however, being able to make themselves un-ignitable, extinguish large areas, cook food in their hands, extinguish large areas, small bursts of flight, and then comes the abilities to shoot fire from your hands.\nFirebenders can chain their abilities into combos, type /b help FireCombos for more information.");
config.addDefault("Abilities.Fire.Blaze.Description", "To use, simply left-click in any direction. An arc of fire will flow from your location, igniting anything in its path. Additionally, tap sneak to engulf the area around you in roaring flames.");
config.addDefault("Abilities.Fire.Blaze.DeathMessage", "{victim} was burned alive by {attacker}'s {ability}");
config.addDefault("Abilities.Fire.Combustion.Description", "Combustion is a powerful ability only known by a few skilled Firebenders. It allows the bender to Firebend with their mind, concentrating energy to create a powerful blast. To use, simply tap sneak (Default: Shift) to launch the blast. This technique is highly destructive and very effective, it also comes with a long cooldown.");
@ -316,7 +316,7 @@ public class ConfigManager {
config.addDefault("Abilities.Fire.Combo.FireWheel.Description", "A high-speed wheel of fire that travels along the ground for long distances dealing high damage.");
config.addDefault("Abilities.Fire.Combo.FireWheel.DeathMessage", "{victim} was incinerated by {attacker}'s {ability}");
config.addDefault("Commands.Help.Elements.Chi", "Chiblockers focus on bare handed combat, utilizing their agility and speed to stop any bender right in their path. Although they lack the ability to bend any of the other elements, they are great in combat, and a serious threat to any bender. Chiblocking was first shown to be used by Ty Lee in Avatar: The Last Airbender, then later by members of the Equalists in The Legend of Korra.\nChiblockers can chain their abilities into combos, type /b help ChiCombos for more information.");
config.addDefault("Abilities.Chi.Description", "Chiblockers focus on bare handed combat, utilizing their agility and speed to stop any bender right in their path. Although they lack the ability to bend any of the other elements, they are great in combat, and a serious threat to any bender. Chiblocking was first shown to be used by Ty Lee in Avatar: The Last Airbender, then later by members of the Equalists in The Legend of Korra.\nChiblockers can chain their abilities into combos, type /b help ChiCombos for more information.");
config.addDefault("Abilities.Chi.AcrobatStance.Description", "AcrobatStance gives a Chiblocker a higher probability of blocking a Bender's Chi while granting them a Speed and Jump Boost. It also increases the rate at which the hunger bar depletes. To use, simply left click. Left clicking again will de-activate the stance.");
config.addDefault("Abilities.Chi.HighJump.Description", "To use this ability, simply click. You will jump quite high. This ability has a short cooldown.");
config.addDefault("Abilities.Chi.Paralyze.Description", "Paralyzes the target, making them unable to do anything for a short " + "period of time. This ability has a long cooldown.");

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.earthbending;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location;
@ -23,7 +24,7 @@ public class Collapse extends EarthAbility {
private Location location;
private Vector direction;
private Block block;
private ConcurrentHashMap<Block, Block> affectedBlocks;
private Map<Block, Block> affectedBlocks;
public Collapse(Player player) {
super(player);
@ -219,7 +220,7 @@ public class Collapse extends EarthAbility {
this.speed = speed;
}
public ConcurrentHashMap<Block, Block> getAffectedBlocks() {
public Map<Block, Block> getAffectedBlocks() {
return affectedBlocks;
}

View file

@ -17,12 +17,13 @@ import org.bukkit.entity.Player;
import org.bukkit.material.MaterialData;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class EarthPassive {
private static final ConcurrentHashMap<Block, Long> SAND_BLOCKS = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<Block, MaterialData> SAND_ID_ENTITIES = new ConcurrentHashMap<>();
private static final Map<Block, Long> SAND_BLOCKS = new ConcurrentHashMap<>();
private static final Map<Block, MaterialData> SAND_ID_ENTITIES = new ConcurrentHashMap<>();
@SuppressWarnings("deprecation")
public static boolean softenLanding(Player player) {
@ -64,7 +65,7 @@ public class EarthPassive {
affectedBlock.setType(Material.SAND);
}
if (!SAND_BLOCKS.containsKey(affectedBlock)) {
SAND_ID_ENTITIES.putIfAbsent(affectedBlock, type);
SAND_ID_ENTITIES.put(affectedBlock, type);
SAND_BLOCKS.put(affectedBlock, System.currentTimeMillis());
}
}
@ -171,11 +172,11 @@ public class EarthPassive {
return true;
}
public static ConcurrentHashMap<Block, Long> getSandBlocks() {
public static Map<Block, Long> getSandBlocks() {
return SAND_BLOCKS;
}
public static ConcurrentHashMap<Block, MaterialData> getSandIdEntities() {
public static Map<Block, MaterialData> getSandIdEntities() {
return SAND_ID_ENTITIES;
}

View file

@ -18,6 +18,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -27,8 +28,8 @@ public class LavaFlow extends LavaAbility {
SHIFT, CLICK
}
private static final ConcurrentHashMap<Block, TempBlock> TEMP_LAVA_BLOCKS = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<Block, TempBlock> TEMP_LAND_BLOCKS = new ConcurrentHashMap<>();
private static final Map<Block, TempBlock> TEMP_LAVA_BLOCKS = new ConcurrentHashMap<>();
private static final Map<Block, TempBlock> TEMP_LAND_BLOCKS = new ConcurrentHashMap<>();
private boolean removing;
private boolean makeLava;
@ -452,11 +453,11 @@ public class LavaFlow extends LavaAbility {
}
}.runTaskLater(ProjectKorra.plugin, (long) (i / shiftRemoveSpeed));
if (TEMP_LAVA_BLOCKS.contains(tblock)) {
if (TEMP_LAVA_BLOCKS.values().contains(tblock)) {
affectedBlocks.remove(tblock);
TEMP_LAVA_BLOCKS.remove(tblock);
}
if (TEMP_LAND_BLOCKS.contains(tblock)) {
if (TEMP_LAND_BLOCKS.values().contains(tblock)) {
affectedBlocks.remove(tblock);
TEMP_LAND_BLOCKS.remove(tblock);
}
@ -476,11 +477,11 @@ public class LavaFlow extends LavaAbility {
for (int i = affectedBlocks.size() - 1; i > -1; i--) {
final TempBlock tblock = affectedBlocks.get(i);
tblock.revertBlock();
if (TEMP_LAVA_BLOCKS.contains(tblock)) {
if (TEMP_LAVA_BLOCKS.values().contains(tblock)) {
affectedBlocks.remove(tblock);
TEMP_LAVA_BLOCKS.remove(tblock);
}
if (TEMP_LAND_BLOCKS.contains(tblock)) {
if (TEMP_LAND_BLOCKS.values().contains(tblock)) {
affectedBlocks.remove(tblock);
TEMP_LAND_BLOCKS.remove(tblock);
}
@ -577,11 +578,11 @@ public class LavaFlow extends LavaAbility {
return m;
}
public static ConcurrentHashMap<Block, TempBlock> getTempLandBlocks() {
public static Map<Block, TempBlock> getTempLandBlocks() {
return TEMP_LAND_BLOCKS;
}
public static ConcurrentHashMap<Block, TempBlock> getTempLavaBlocks() {
public static Map<Block, TempBlock> getTempLavaBlocks() {
return TEMP_LAVA_BLOCKS;
}

View file

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -51,7 +52,7 @@ public class LavaSurge extends LavaAbility {
private ArrayList<Block> fracture;
private ArrayList<TempBlock> fractureTempBlocks;
private ArrayList<TempBlock> movingLava;
private ConcurrentHashMap<FallingBlock, TempBlock> lavaBlocks;
private Map<FallingBlock, TempBlock> lavaBlocks;
private ListIterator<Block> listIterator;
public LavaSurge(Player player) {
@ -457,7 +458,7 @@ public class LavaSurge extends LavaAbility {
return movingLava;
}
public ConcurrentHashMap<FallingBlock, TempBlock> getLavaBlocks() {
public Map<FallingBlock, TempBlock> getLavaBlocks() {
return lavaBlocks;
}

View file

@ -19,12 +19,13 @@ import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class MetalClips extends MetalAbility {
private static final ConcurrentHashMap<Entity, Integer> ENTITY_CLIPS_COUNT = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<Entity, MetalClips> TARGET_TO_ABILITY = new ConcurrentHashMap<>();
private static final Map<Entity, Integer> ENTITY_CLIPS_COUNT = new ConcurrentHashMap<>();
private static final Map<Entity, MetalClips> TARGET_TO_ABILITY = new ConcurrentHashMap<>();
private static final Material[] METAL_ITEMS = {
Material.IRON_INGOT, Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS,
Material.IRON_BOOTS, Material.IRON_BLOCK, Material.IRON_AXE, Material.IRON_PICKAXE,
@ -458,11 +459,11 @@ public class MetalClips extends MetalAbility {
return clips != null && player.isSneaking() && clips.targetEntity != null;
}
public static ConcurrentHashMap<Entity, Integer> getEntityClipsCount() {
public static Map<Entity, Integer> getEntityClipsCount() {
return ENTITY_CLIPS_COUNT;
}
public static ConcurrentHashMap<Entity, MetalClips> getTargetToAbility() {
public static Map<Entity, MetalClips> getTargetToAbility() {
return TARGET_TO_ABILITY;
}

View file

@ -16,11 +16,12 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Ripple extends EarthAbility {
private static final ConcurrentHashMap<Integer[], Block> BLOCKS = new ConcurrentHashMap<Integer[], Block>();
private static final Map<Integer[], Block> BLOCKS = new ConcurrentHashMap<Integer[], Block>();
private int step;
private int maxStep;
@ -297,7 +298,7 @@ public class Ripple extends EarthAbility {
BLOCKS.clear();
}
public static ConcurrentHashMap<Integer[], Block> getBlocks() {
public static Map<Integer[], Block> getBlocks() {
return BLOCKS;
}

View file

@ -12,11 +12,12 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Tremorsense extends EarthAbility {
private static final ConcurrentHashMap<Block, Player> BLOCKS = new ConcurrentHashMap<Block, Player>();
private static final Map<Block, Player> BLOCKS = new ConcurrentHashMap<Block, Player>();
private byte lightThreshold;
private int maxDepth;
@ -139,7 +140,7 @@ public class Tremorsense extends EarthAbility {
}
}
public static ConcurrentHashMap<Block, Player> getBlocks() {
public static Map<Block, Player> getBlocks() {
return BLOCKS;
}

View file

@ -126,7 +126,7 @@ public class FireBlast extends FireAbility {
}
if (entity instanceof LivingEntity) {
entity.setFireTicks((int) (fireTicks * 20));
DamageHandler.damageEntity(entity, (int) getDayFactor(damage), this);
DamageHandler.damageEntity(entity, damage, this);
AirAbility.breakBreathbendingHold(entity);
new FireDamageTimer(entity, player);
remove();

View file

@ -9,11 +9,12 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Illumination extends FireAbility {
private static final ConcurrentHashMap<Block, Player> BLOCKS = new ConcurrentHashMap<>();
private static final Map<Block, Player> BLOCKS = new ConcurrentHashMap<>();
private byte normalData;
private long cooldown;
@ -162,7 +163,7 @@ public class Illumination extends FireAbility {
this.block = block;
}
public static ConcurrentHashMap<Block, Player> getBlocks() {
public static Map<Block, Player> getBlocks() {
return BLOCKS;
}

View file

@ -1,6 +1,7 @@
package com.projectkorra.projectkorra.object;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location;
@ -24,7 +25,7 @@ import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
*/
public class HorizontalVelocityTracker {
public static ConcurrentHashMap<Entity, HorizontalVelocityTracker> instances = new ConcurrentHashMap<Entity, HorizontalVelocityTracker>();
public static Map<Entity, HorizontalVelocityTracker> instances = new ConcurrentHashMap<Entity, HorizontalVelocityTracker>();
public boolean hasBeenDamaged = false;
public boolean barrier = ConfigManager.defaultConfig.get().getBoolean("Properties.HorizontalCollisionPhysics.DamageOnBarrierBlock");
private long delay;

View file

@ -6,6 +6,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@ -31,7 +32,7 @@ public class Preset {
* ConcurrentHashMap that stores a list of every Player's {@link Preset
* presets}, keyed to their UUID
*/
public static ConcurrentHashMap<UUID, List<Preset>> presets = new ConcurrentHashMap<UUID, List<Preset>>();
public static Map<UUID, List<Preset>> presets = new ConcurrentHashMap<UUID, List<Preset>>();
public static FileConfiguration config = ConfigManager.presetConfig.get();
public static HashMap<String, ArrayList<String>> externalPresets = new HashMap<String, ArrayList<String>>();
static String loadQuery = "SELECT * FROM pk_presets WHERE uuid = ?";

View file

@ -1,6 +1,7 @@
package com.projectkorra.projectkorra.util;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@ -19,7 +20,7 @@ import com.projectkorra.projectkorra.waterbending.WaterSpout;
public class Flight {
private static ConcurrentHashMap<Player, Flight> instances = new ConcurrentHashMap<Player, Flight>();
private static Map<Player, Flight> instances = new ConcurrentHashMap<Player, Flight>();
private static long duration = 5000;
private Player player;
@ -125,7 +126,7 @@ public class Flight {
private void refresh(Player source) {
this.source = source;
time = System.currentTimeMillis();
instances.replace(player, this);
instances.put(player, this);
}
public void remove() {

View file

@ -8,11 +8,12 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class TempBlock {
public static ConcurrentHashMap<Block, TempBlock> instances = new ConcurrentHashMap<Block, TempBlock>();
public static Map<Block, TempBlock> instances = new ConcurrentHashMap<Block, TempBlock>();
private Block block;
private Material newtype;
@ -35,7 +36,7 @@ public class TempBlock {
temp.newdata = newdata;
}
state = temp.state;
instances.replace(block, temp);
instances.put(block, temp);
} else {
state = block.getState();
block.setType(newtype);

View file

@ -3,15 +3,16 @@ package com.projectkorra.projectkorra.util;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class TempPotionEffect {
private static ConcurrentHashMap<LivingEntity, TempPotionEffect> instances = new ConcurrentHashMap<LivingEntity, TempPotionEffect>();
private static Map<LivingEntity, TempPotionEffect> instances = new ConcurrentHashMap<LivingEntity, TempPotionEffect>();
private static final long tick = 21;
private int ID = Integer.MIN_VALUE;
private ConcurrentHashMap<Integer, PotionInfo> infos = new ConcurrentHashMap<Integer, PotionInfo>();
private Map<Integer, PotionInfo> infos = new ConcurrentHashMap<Integer, PotionInfo>();
private LivingEntity entity;
public TempPotionEffect(LivingEntity entity, PotionEffect effect) {
@ -24,7 +25,7 @@ public class TempPotionEffect {
TempPotionEffect instance = instances.get(entity);
instance.infos.put(instance.ID++, new PotionInfo(starttime, effect));
// instance.effects.put(starttime, effect);
instances.replace(entity, instance);
instances.put(entity, instance);
} else {
// effects.put(starttime, effect);
infos.put(ID++, new PotionInfo(starttime, effect));

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location;
@ -24,7 +25,7 @@ import com.projectkorra.projectkorra.util.TempPotionEffect;
public class Bloodbending extends BloodAbility {
private static final ConcurrentHashMap<Entity, Location> TARGETED_ENTITIES = new ConcurrentHashMap<Entity, Location>();
private static final Map<Entity, Location> TARGETED_ENTITIES = new ConcurrentHashMap<Entity, Location>();
private boolean canOnlyBeUsedAtNight;
private boolean canBeUsedOnUndeadMobs;

View file

@ -21,13 +21,14 @@ import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
public class Torrent extends WaterAbility {
private static final double CLEANUP_RANGE = 50;
private static final ConcurrentHashMap<TempBlock, Player> FROZEN_BLOCKS = new ConcurrentHashMap<>();
private static final Map<TempBlock, Player> FROZEN_BLOCKS = new ConcurrentHashMap<>();
private boolean sourceSelected;
private boolean settingUp;
@ -831,7 +832,7 @@ public class Torrent extends WaterAbility {
return CLEANUP_RANGE;
}
public static ConcurrentHashMap<TempBlock, Player> getFrozenBlocks() {
public static Map<TempBlock, Player> getFrozenBlocks() {
return FROZEN_BLOCKS;
}

View file

@ -22,6 +22,7 @@ import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class WaterArms extends WaterAbility {
@ -33,7 +34,7 @@ public class WaterArms extends WaterAbility {
RIGHT, LEFT;
}
private static final ConcurrentHashMap<Block, Long> BLOCK_REVERT_TIMES = new ConcurrentHashMap<Block, Long>();
private static final Map<Block, Long> BLOCK_REVERT_TIMES = new ConcurrentHashMap<Block, Long>();
private static final Integer[] UNBREAKABLES = { 7, 8, 9, 10, 11, 49, 54, 90, 119, 120, 130, 146 };
private boolean cooldownLeft;
@ -720,7 +721,7 @@ public class WaterArms extends WaterAbility {
this.sneakMsg = sneakMsg;
}
public static ConcurrentHashMap<Block, Long> getBlockRevertTimes() {
public static Map<Block, Long> getBlockRevertTimes() {
return BLOCK_REVERT_TIMES;
}

View file

@ -18,11 +18,12 @@ import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class WaterArmsSpear extends WaterAbility {
private static final ConcurrentHashMap<Block, Long> ICE_BLOCKS = new ConcurrentHashMap<Block, Long>();
private static final Map<Block, Long> ICE_BLOCKS = new ConcurrentHashMap<Block, Long>();
private boolean hitEntity;
private boolean canFreeze;
@ -466,7 +467,7 @@ public class WaterArmsSpear extends WaterAbility {
this.location = location;
}
public static ConcurrentHashMap<Block, Long> getIceBlocks() {
public static Map<Block, Long> getIceBlocks() {
return ICE_BLOCKS;
}

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -30,7 +31,7 @@ import com.projectkorra.projectkorra.util.TempBlock;
public class WaterManipulation extends WaterAbility {
private static final ConcurrentHashMap<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<>();
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<>();
private boolean progressing;
private boolean falling;
@ -761,7 +762,7 @@ public class WaterManipulation extends WaterAbility {
this.targetDirection = targetDirection;
}
public static ConcurrentHashMap<Block, Block> getAffectedBlocks() {
public static Map<Block, Block> getAffectedBlocks() {
return AFFECTED_BLOCKS;
}

View file

@ -15,12 +15,13 @@ import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
public class WaterSpout extends WaterAbility {
private static final ConcurrentHashMap<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>();
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>();
private List<TempBlock> blocks = new ArrayList<TempBlock>();
private boolean canBendOnPackedIce;
@ -398,7 +399,7 @@ public class WaterSpout extends WaterAbility {
this.baseBlock = baseBlock;
}
public static ConcurrentHashMap<Block, Block> getAffectedBlocks() {
public static Map<Block, Block> getAffectedBlocks() {
return AFFECTED_BLOCKS;
}