Skip to content

Commit

Permalink
remove some silly hyperconcurrency that doesn't belong
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 12, 2020
1 parent 4c52a6d commit 666f6c5
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 34 deletions.
Expand Up @@ -20,7 +20,6 @@
import org.bukkit.event.vehicle.VehicleMoveEvent;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -92,7 +91,7 @@ public void breakDown() {
///////////

private boolean broad_detection = false;
private Map<String, List<CuboidTag>> player_cuboids = new ConcurrentHashMap<>();
private Map<String, List<CuboidTag>> player_cuboids = new HashMap<>();

// <--[event]
// @Events
Expand Down
Expand Up @@ -19,12 +19,11 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

public class ConstantsTrait extends Trait {

// Saved to C2 saves.yml
@Persist(value = "", collectionType = ConcurrentHashMap.class)
@Persist(value = "", collectionType = HashMap.class)
private Map<String, String> constants = new HashMap<>();

// Used internally
Expand Down
Expand Up @@ -21,18 +21,17 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

public class TriggerTrait extends Trait implements Listener {

@Persist(value = "enabled", collectionType = ConcurrentHashMap.class)
private Map<String, Boolean> enabled = new ConcurrentHashMap<>(8, 0.9f, 1);
@Persist(value = "duration", collectionType = ConcurrentHashMap.class)
private Map<String, Double> duration = new ConcurrentHashMap<>(8, 0.9f, 1);
@Persist(value = "cooldowntype", collectionType = ConcurrentHashMap.class)
private Map<String, TriggerRegistry.CooldownType> type = new ConcurrentHashMap<>(8, 0.9f, 1);
@Persist(value = "radius", collectionType = ConcurrentHashMap.class)
private Map<String, Integer> radius = new ConcurrentHashMap<>(8, 0.9f, 1);
@Persist(value = "enabled", collectionType = HashMap.class)
private Map<String, Boolean> enabled = new HashMap<>();
@Persist(value = "duration", collectionType = HashMap.class)
private Map<String, Double> duration = new HashMap<>();
@Persist(value = "cooldowntype", collectionType = HashMap.class)
private Map<String, TriggerRegistry.CooldownType> type = new HashMap<>();
@Persist(value = "radius", collectionType = HashMap.class)
private Map<String, Integer> radius = new HashMap<>();

public void report() {
Debug.log("enabled: " + enabled.entrySet().toString());
Expand Down
Expand Up @@ -78,7 +78,7 @@ public class FlagCommand extends AbstractCommand implements Listener {
// - flag server cool_people:->:<[player]>
//
// @Usage
// Use to add both multiple items as individual new values to a server flag.
// Use to add multiple items as individual new values to a server flag.
// - flag server cool_people:|:<[player]>|<[someplayer]>
//
// @Usage
Expand Down
Expand Up @@ -13,8 +13,8 @@
import com.denizenscript.denizencore.scripts.commands.AbstractCommand;
import org.bukkit.event.Listener;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ZapCommand extends AbstractCommand implements Listener {

Expand Down Expand Up @@ -100,7 +100,7 @@ else if (!scriptEntry.hasObject("duration")
}

//"PlayerName,ScriptName", TaskID
private static Map<String, Integer> durations = new ConcurrentHashMap<>(8, 0.9f, 1);
private static Map<String, Integer> durations = new HashMap<>();

@Override
public void execute(final ScriptEntry scriptEntry) {
Expand Down
Expand Up @@ -12,8 +12,8 @@
import com.denizenscript.denizencore.scripts.commands.AbstractCommand;
import net.citizensnpcs.trait.waypoint.Waypoints;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class PauseCommand extends AbstractCommand {

Expand Down Expand Up @@ -73,7 +73,7 @@ public class PauseCommand extends AbstractCommand {
// - resume waypoints
// -->

private Map<String, Integer> durations = new ConcurrentHashMap<>(8, 0.9f, 1);
private Map<String, Integer> durations = new HashMap<>();

enum PauseType {ACTIVITY, WAYPOINTS, NAVIGATION}

Expand Down
Expand Up @@ -25,11 +25,10 @@
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CommandScriptHelper implements Listener {

public static Map<String, DenizenCommand> denizenCommands = new ConcurrentHashMap<>(8, 0.9f, 1);
public static Map<String, DenizenCommand> denizenCommands = new HashMap<>();
public static Map<String, Command> overriddenCommands = new HashMap<>();
public static Map<String, HelpTopic> overriddenHelpTopics = new HashMap<>();
public static Map<String, Command> knownCommands = null;
Expand Down
Expand Up @@ -14,11 +14,10 @@
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

public class InventoryScriptHelper implements Listener {

public static Map<String, InventoryScriptContainer> inventory_scripts = new ConcurrentHashMap<>(8, 0.9f, 1);
public static Map<String, InventoryScriptContainer> inventory_scripts = new HashMap<>();
public static Map<String, InventoryTag> notableInventories = new HashMap<>();

public InventoryScriptHelper() {
Expand Down
Expand Up @@ -10,7 +10,6 @@

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class TriggerRegistry {

Expand Down Expand Up @@ -73,8 +72,8 @@ public void registerCoreMembers() {
// Trigger Cooldowns
///////

Map<Integer, Map<String, Long>> npcCooldown = new ConcurrentHashMap<>(8, 0.9f, 1);
Map<String, Map<String, Long>> playerCooldown = new ConcurrentHashMap<>(8, 0.9f, 1);
Map<Integer, Map<String, Long>> npcCooldown = new HashMap<>();
Map<String, Map<String, Long>> playerCooldown = new HashMap<>();

public enum CooldownType {NPC, PLAYER}

Expand Down
Expand Up @@ -17,7 +17,6 @@
import org.bukkit.event.Listener;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class ProximityTrigger extends AbstractTrigger implements Listener {

Expand Down Expand Up @@ -300,7 +299,7 @@ public void checkMaxProximities(ScriptReloadEvent event) {
//}
}

private static Map<UUID, Set<Integer>> proximityTracker = new ConcurrentHashMap<>(8, 0.9f, 1);
private static Map<UUID, Set<Integer>> proximityTracker = new HashMap<>();

//
// Ensures that a Player who has entered proximity of an NPC also fires Exit Proximity.
Expand Down
Expand Up @@ -17,11 +17,7 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.*;

public class PlayerTagBase implements Listener {

Expand All @@ -47,7 +43,7 @@ public void run(ReplaceableTagEvent event) {
// Player Chat History
/////////

public static Map<UUID, List<String>> playerChatHistory = new ConcurrentHashMap<>(8, 0.9f, 2);
public static Map<UUID, List<String>> playerChatHistory = new HashMap<>();

@EventHandler(priority = EventPriority.MONITOR)
public void addMessage(final AsyncPlayerChatEvent event) {
Expand Down
Expand Up @@ -394,7 +394,6 @@ public void scripts(CommandContext args, CommandSender sender) throws CommandExc
if (args.hasValueFlag("filter")) {
filter = args.getFlag("filter");
}
// Get script names from the scripts.yml in memory
Set<String> scripts = ScriptRegistry.scriptContainers.keySet();
// New Paginator to display script names
Paginator paginator = new Paginator().header("Scripts");
Expand Down

0 comments on commit 666f6c5

Please sign in to comment.