Skip to content

Commit

Permalink
obey java conventions
Browse files Browse the repository at this point in the history
camelCase rather than TitleCase for method names
  • Loading branch information
mcmonkey4eva committed Oct 5, 2014
1 parent a7acfb3 commit 4059e95
Show file tree
Hide file tree
Showing 30 changed files with 104 additions and 101 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -170,7 +170,7 @@ public void onEnable() {
versionTag = this.getDescription().getVersion();

// Load Denizen's core
DenizenCore.Init(this);
DenizenCore.init(this);

// Activate dependencies
depends.initialize();
Expand Down Expand Up @@ -359,6 +359,7 @@ public void onEnable() {
@Override
public void run() {
try {
DenizenCore.loadScripts();
ScriptHelper.reloadScripts();

// Reload notables from notables.yml into memory
Expand Down Expand Up @@ -622,7 +623,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String cmdName, Stri
return true;
}

if (Settings.ShowExHelp()) {
if (Settings.showExHelp()) {
if (dB.showDebug)
sender.sendMessage(ChatColor.YELLOW + "Executing dCommand... check the console for debug output!");
else
Expand Down
66 changes: 33 additions & 33 deletions src/main/java/net/aufdemrand/denizen/Settings.java
Expand Up @@ -28,12 +28,12 @@ public static String getAlternateScriptPath() {
*/

public static boolean ShowDebug() {
public static boolean showDebug() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Debug.Show", false);
}

public static int ConsoleWidth() {
public static int consoleWidth() {
return DenizenAPI.getCurrentInstance().getConfig()
.getInt("Debug.Console width", 60);
}
Expand All @@ -43,7 +43,7 @@ public static int trimLength() {
.getInt("Debug.trim length", 512);
}

public static boolean ShowExHelp() {
public static boolean showExHelp() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Debug.Ex command help", true);
}
Expand All @@ -54,7 +54,7 @@ public static boolean ShowExHelp() {
*/

public static String ScriptQueueSpeed() {
public static String scriptQueueSpeed() {
String delay = DenizenAPI.getCurrentInstance().getConfig()
.getString("Scripts.Queue speed", "0.5s");

Expand All @@ -71,7 +71,7 @@ public static String ScriptQueueSpeed() {
*/

public static boolean LoadScriptsInSubfolders() {
public static boolean loadScriptsInSubfolders() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Scripts.Load scripts in subfolders", true);
}
Expand All @@ -82,7 +82,7 @@ public static boolean LoadScriptsInSubfolders() {
*/

public static boolean HealthTraitEnabledByDefault() {
public static boolean healthTraitEnabledByDefault() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Traits.Health.Enabled", false);
}
Expand All @@ -93,7 +93,7 @@ public static boolean HealthTraitEnabledByDefault() {
*/

public static boolean HealthTraitRespawnEnabled() {
public static boolean healthTraitRespawnEnabled() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Traits.Health.Respawn.Enabled", true);
}
Expand All @@ -104,7 +104,7 @@ public static boolean HealthTraitRespawnEnabled() {
*/

public static boolean HealthTraitAnimatedDeathEnabled() {
public static boolean healthTraitAnimatedDeathEnabled() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Traits.Health.Animated death.Enabled", true);
}
Expand All @@ -115,7 +115,7 @@ public static boolean HealthTraitAnimatedDeathEnabled() {
*/

public static String HealthTraitRespawnDelay() {
public static String healthTraitRespawnDelay() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Traits.Health.Respawn.Delay", "10s");
}
Expand All @@ -126,7 +126,7 @@ public static String HealthTraitRespawnDelay() {
*/

public static boolean TriggerEnabled(String triggerName) {
public static boolean triggerEnabled(String triggerName) {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase() + triggerName.substring(1).toLowerCase() + ".Enabled", true);
}
Expand All @@ -138,7 +138,7 @@ public static boolean TriggerEnabled(String triggerName) {
*/

public static double TriggerDefaultCooldown(String triggerName) {
public static double triggerDefaultCooldown(String triggerName) {
return Duration.valueOf(DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase() + triggerName.substring(1).toLowerCase() + ".Cooldown", "5s")).getSeconds();
}
Expand All @@ -151,7 +151,7 @@ public static double TriggerDefaultCooldown(String triggerName) {
*/

public static double TriggerDefaultRange(String triggerName) {
public static double triggerDefaultRange(String triggerName) {
return DenizenAPI.getCurrentInstance().getConfig()
.getDouble("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase() + triggerName.substring(1).toLowerCase() + ".Range", -1);
}
Expand All @@ -163,7 +163,7 @@ public static double TriggerDefaultRange(String triggerName) {
*/

public static String TriggerDefaultCooldownType(String triggerName) {
public static String triggerDefaultCooldownType(String triggerName) {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers." + String.valueOf(triggerName.charAt(0)).toUpperCase() + triggerName.substring(1).toLowerCase() + ".Cooldown Type", "Player");
}
Expand All @@ -181,7 +181,7 @@ public static String TriggerDefaultCooldownType(String triggerName) {
*/

public static boolean ClickTriggerAllowsLeftClick() { // TODO: Remove?
public static boolean clickTriggerAllowsLeftClick() { // TODO: Remove?
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Click.Allows left click", false);
}
Expand All @@ -194,42 +194,42 @@ public static boolean ClickTriggerAllowsLeftClick() { // TODO: Remove?
*/

public static String EngageTimeoutInSeconds() {
public static String engageTimeoutInSeconds() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Commands.Engage.Timeout", "150s");
}

public static int WhileMaxLoops() {
public static int whileMaxLoops() {
return DenizenAPI.getCurrentInstance().getConfig()
.getInt("Commands.While.Max loops", 10000);
}

public static String ChatMultipleTargetsFormat() {
public static String chatMultipleTargetsFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Commands.Chat.Options.Multiple targets format", "%target%, %target%, %target%, and others");
}

public static double ChatBystandersRange() {
public static double chatBystandersRange() {
return DenizenAPI.getCurrentInstance().getConfig()
.getDouble("Commands.Chat.Options.Range for bystanders", 5.0);
}

public static String ChatNoTargetFormat() {
public static String chatNoTargetFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Commands.Chat.Formats.No target", "[<def[talker].name>]: <def[message]>");
}

public static String ChatToTargetFormat() {
public static String chatToTargetFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Commands.Chat.Formats.To target", "[<def[talker].name>] -> You: <def[message]>");
}

public static String ChatWithTargetToBystandersFormat() {
public static String chatWithTargetToBystandersFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Commands.Chat.Formats.With target to bystanders", "[<def[talker].name>] -> <def[target].name>: <def[message]>");
}

public static String ChatWithTargetsToBystandersFormat() {
public static String chatWithTargetsToBystandersFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Commands.Chat.Formats.With targets to bystanders", "[<def[talker].name>] -> [<def[targets]>]: <def[message]>");
}
Expand All @@ -241,7 +241,7 @@ public static String ChatWithTargetsToBystandersFormat() {
*/

public static boolean ChatAsynchronous() {
public static boolean chatAsynchronous() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Use asynchronous event", false);
}
Expand All @@ -253,12 +253,12 @@ public static boolean ChatAsynchronous() {
*/

public static String ChatToNpcFormat() {
public static String chatToNpcFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers.Chat.Formats.Player to NPC", "You -> <npc.name.nickname>: <text>");
}

public static String ChatToNpcOverheardFormat() {
public static String chatToNpcOverheardFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers.Chat.Formats.Player to NPC overheard", "<player.name> -> <npc.name.nickname>: <text>");
}
Expand All @@ -270,7 +270,7 @@ public static String ChatToNpcOverheardFormat() {
*/

public static double ChatToNpcOverhearingRange() {
public static double chatToNpcOverhearingRange() {
return DenizenAPI.getCurrentInstance().getConfig()
.getDouble("Triggers.Chat.Overhearing range", 4);
}
Expand All @@ -282,12 +282,12 @@ public static double ChatToNpcOverhearingRange() {
*/


public static boolean ChatMustSeeNPC() {
public static boolean chatMustSeeNPC() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Prerequisites.Must be able to see NPC", true);
}

public static boolean ChatMustLookAtNPC() {
public static boolean chatMustLookAtNPC() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Prerequisites.Must be looking in direction of NPC", true);
}
Expand All @@ -299,17 +299,17 @@ public static boolean ChatMustLookAtNPC() {
*/

public static boolean ChatGloballyIfFailedChatTriggers() {
public static boolean chatGloballyIfFailedChatTriggers() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Appears globally.If triggers failed", false);
}

public static boolean ChatGloballyIfNoChatTriggers() {
public static boolean chatGloballyIfNoChatTriggers() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Appears globally.If triggers missing", true);
}

public static boolean ChatGloballyIfUninteractable() {
public static boolean chatGloballyIfUninteractable() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Appears globally.If NPC uninteractable", true);
}
Expand All @@ -326,7 +326,7 @@ public static boolean ChatGloballyIfUninteractable() {
*/

public static boolean WorldScriptChatEventAsynchronous() {
public static boolean worldScriptChatEventAsynchronous() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Scripts.World.Events.On player chats.Use asynchronous event", false);
}
Expand All @@ -338,7 +338,7 @@ public static boolean WorldScriptChatEventAsynchronous() {
*/

public static Duration WorldScriptTimeEventFrequency() {
public static Duration worldScriptTimeEventFrequency() {
return Duration.valueOf(DenizenAPI.getCurrentInstance().getConfig()
.getString("Scripts.World.Events.On time changes.Frequency of check", "250t"));

Expand Down
Expand Up @@ -184,7 +184,7 @@ public static List<String> trimEvents(List<String> original) {
}


public static boolean EventExists(String original) {
public static boolean eventExists(String original) {
return events.containsKey("ON " + original.toUpperCase());
}

Expand Down
Expand Up @@ -256,7 +256,7 @@ public String getValue() {
if (value_tagged)
return value;
value_tagged = true;
value = TagManager.CleanOutputFully(TagManager.tag(
value = TagManager.cleanOutputFully(TagManager.tag(
getPlayer(), getNPC(), value, false, getScriptEntry()));
return value;
}
Expand All @@ -271,7 +271,7 @@ public String getAlternative() {
if (alternative_tagged)
return alternative;
alternative_tagged = true;
alternative = TagManager.CleanOutputFully(TagManager.tag(
alternative = TagManager.cleanOutputFully(TagManager.tag(
getPlayer(), getNPC(), alternative, false, getScriptEntry()));
return alternative;
}
Expand Down
Expand Up @@ -38,7 +38,7 @@ public class AsyncChatSmartEvent implements SmartEvent, Listener {
public boolean shouldInitialize(Set<String> events) {

// Fail if "Use asynchronous event" is false in config file
if (!Settings.WorldScriptChatEventAsynchronous()) return false;
if (!Settings.worldScriptChatEventAsynchronous()) return false;

// Loop through event names from loaded world script events
for (String event : events) {
Expand Down
Expand Up @@ -34,7 +34,7 @@ public class SyncChatSmartEvent implements SmartEvent, Listener {
public boolean shouldInitialize(Set<String> events) {

// Fail if "Use asynchronous event" is true in config file
if (Settings.WorldScriptChatEventAsynchronous()) return false;
if (Settings.worldScriptChatEventAsynchronous()) return false;

// Loop through event names from loaded world script events
for (String event : events) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/net/aufdemrand/denizen/npc/speech/DenizenChat.java
Expand Up @@ -51,14 +51,14 @@ public void talk(SpeechContext speechContext) {

// Chat to the world using Denizen chat settings
if (!context.hasRecipients()) {
String text = TagManager.tag(entry.getPlayer(), entry.getNPC(), Settings.ChatNoTargetFormat(), false, entry);
String text = TagManager.tag(entry.getPlayer(), entry.getNPC(), Settings.chatNoTargetFormat(), false, entry);
talkToBystanders(talker, text, context);
}

// Single recipient
else if (context.size() <= 1) {
// Send chat to target
String text = TagManager.tag(entry.getPlayer(), entry.getNPC(), Settings.ChatToTargetFormat(), false, entry);
String text = TagManager.tag(entry.getPlayer(), entry.getNPC(), Settings.chatToTargetFormat(), false, entry);
for (Talkable entity : context) {
entity.talkTo(context, text, this);
}
Expand All @@ -69,7 +69,7 @@ else if (context.size() <= 1) {
defTarget = queue.getDefinition("target");
queue.addDefinition("target", new dEntity(context.iterator().next().getEntity()).identify());
String bystanderText = TagManager.tag(entry.getPlayer(), entry.getNPC(),
Settings.ChatWithTargetToBystandersFormat(), false, entry);
Settings.chatWithTargetToBystandersFormat(), false, entry);
talkToBystanders(talker, bystanderText, context);
if (defTarget != null)
queue.addDefinition("target", defTarget);
Expand All @@ -79,12 +79,12 @@ else if (context.size() <= 1) {
// Multiple recipients
else {
// Send chat to targets
String text = TagManager.tag(entry.getPlayer(), entry.getNPC(), Settings.ChatToTargetFormat(), false, entry);
String text = TagManager.tag(entry.getPlayer(), entry.getNPC(), Settings.chatToTargetFormat(), false, entry);
for (Talkable entity : context) {
entity.talkTo(context, text, this);
}
if (context.isBystandersEnabled()) {
String[] format = Settings.ChatMultipleTargetsFormat().split("%target%");
String[] format = Settings.chatMultipleTargetsFormat().split("%target%");
if (format.length <= 1)
dB.echoError("Invalid 'Commands.Chat.Options.Multiple targets format' in config.yml! Must have at least 1 %target%");
StringBuilder parsed = new StringBuilder();
Expand All @@ -106,7 +106,7 @@ else if (context.size() <= 1) {
queue.addDefinition("targets", targets);

String bystanderText = TagManager.tag(entry.getPlayer(), entry.getNPC(),
Settings.ChatWithTargetsToBystandersFormat(), false, entry);
Settings.chatWithTargetsToBystandersFormat(), false, entry);
talkToBystanders(talker, bystanderText, context);

if (defTargets != null)
Expand Down
Expand Up @@ -72,7 +72,7 @@ public boolean setAssignment(String assignment, dPlayer player) {
// Add Constants/Trigger trait if not already added to the NPC.
if (!npc.hasTrait(ConstantsTrait.class)) npc.addTrait(ConstantsTrait.class);
if (!npc.hasTrait(TriggerTrait.class)) npc.addTrait(TriggerTrait.class);
if (Settings.HealthTraitEnabledByDefault())
if (Settings.healthTraitEnabledByDefault())
if (!npc.hasTrait(HealthTrait.class)) npc.addTrait(HealthTrait.class);
// Reset Constants
npc.getTrait(ConstantsTrait.class).rebuildAssignmentConstants();
Expand Down

0 comments on commit 4059e95

Please sign in to comment.