mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Command format & permission changes, other minor cleanup.
This commit is contained in:
parent
67de70432c
commit
064fc0a8e2
@ -8,7 +8,9 @@ Key:
|
||||
- Removal
|
||||
|
||||
Version 1.3.07
|
||||
+ Added a permission node for Archery bonus damage
|
||||
! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server
|
||||
- Removed some unused permission nodes
|
||||
|
||||
Version 1.3.06
|
||||
+ Added Iron Golem XP for aggressive golems
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -82,25 +84,27 @@ public class AcrobaticsCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void dataCalculations(float skillValue) {
|
||||
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
|
||||
if (skillValue >= 1000) {
|
||||
dodgeChance = "20";
|
||||
rollChance = "100";
|
||||
gracefulRollChance = "100";
|
||||
dodgeChance = "20.00%";
|
||||
rollChance = "100.00%";
|
||||
gracefulRollChance = "100.00%";
|
||||
}
|
||||
else if (skillValue >= 800) {
|
||||
dodgeChance = "20";
|
||||
rollChance = String.valueOf(skillValue / 10);
|
||||
gracefulRollChance = "100";
|
||||
dodgeChance = "20.00%";
|
||||
rollChance = percent.format(skillValue / 1000);
|
||||
gracefulRollChance = "100.00%";
|
||||
}
|
||||
else if (skillValue >= 500) {
|
||||
dodgeChance = String.valueOf(skillValue / 40);
|
||||
rollChance = String.valueOf(skillValue / 10);
|
||||
gracefulRollChance = "100";
|
||||
dodgeChance = percent.format(skillValue / 4000);
|
||||
rollChance = percent.format(skillValue / 1000);
|
||||
gracefulRollChance = "100.00%";
|
||||
}
|
||||
else {
|
||||
dodgeChance = String.valueOf(skillValue / 40);
|
||||
rollChance = String.valueOf(skillValue / 10);
|
||||
gracefulRollChance = String.valueOf(skillValue / 5);
|
||||
dodgeChance = percent.format(skillValue / 4000);
|
||||
rollChance = percent.format(skillValue / 1000);
|
||||
gracefulRollChance = percent.format(skillValue / 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -10,6 +12,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ArcheryCommand implements CommandExecutor {
|
||||
@ -18,6 +21,10 @@ public class ArcheryCommand implements CommandExecutor {
|
||||
private String dazeChance;
|
||||
private String retrieveChance;
|
||||
|
||||
private boolean canSkillShot;
|
||||
private boolean canDaze;
|
||||
private boolean canRetrieve;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
@ -33,20 +40,43 @@ public class ArcheryCommand implements CommandExecutor {
|
||||
|
||||
skillValue = (float) PP.getSkillLevel(SkillType.ARCHERY);
|
||||
dataCalculations(skillValue);
|
||||
permissionsCheck(player);
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Archery.SkillName") }));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Archery") }));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") }));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") }));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") }));
|
||||
if (canSkillShot || canDaze || canRetrieve) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
|
||||
if (canSkillShot) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canDaze) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canRetrieve) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") }));
|
||||
}
|
||||
|
||||
if (canSkillShot || canDaze || canRetrieve) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
|
||||
}
|
||||
|
||||
if (canSkillShot) {
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
|
||||
}
|
||||
|
||||
if (canDaze) {
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
|
||||
}
|
||||
|
||||
if (canRetrieve) {
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
|
||||
}
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.ARCHERY, player, args);
|
||||
|
||||
@ -54,15 +84,24 @@ public class ArcheryCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void dataCalculations(float skillValue) {
|
||||
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
|
||||
if (skillValue >= 1000) {
|
||||
skillShotBonus = "200";
|
||||
dazeChance = "50";
|
||||
retrieveChance = "100";
|
||||
skillShotBonus = "200.00%";
|
||||
dazeChance = "50.00%";
|
||||
retrieveChance = "100.00%";
|
||||
}
|
||||
else {
|
||||
skillShotBonus = String.valueOf((int) skillValue / 5);
|
||||
dazeChance = String.valueOf(skillValue / 20);
|
||||
retrieveChance = String.valueOf(skillValue / 10);
|
||||
skillShotBonus = percent.format(((int) skillValue / 50) * 0.1D); //TODO: Not sure if this is the best way to calculate this or not...
|
||||
dazeChance = percent.format(skillValue / 2000);
|
||||
retrieveChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private void permissionsCheck(Player player) {
|
||||
Permissions permInstance = Permissions.getInstance();
|
||||
canSkillShot = permInstance.archeryBonus(player);
|
||||
canDaze = permInstance.daze(player);
|
||||
canRetrieve = permInstance.trackArrows(player);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class Config extends ConfigLoader {
|
||||
* GENERAL SETTINGS
|
||||
*/
|
||||
|
||||
|
||||
/* General Settings */
|
||||
public String getLocale() { return config.getString("General.Locale", "en_us"); }
|
||||
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
|
||||
@ -33,7 +34,8 @@ public class Config extends ConfigLoader {
|
||||
public String getMySQLUserName() { return config.getString("MySQL.Database.User_Name", "UserName"); } //Really should be labeled under MySQL.User_Name instead...
|
||||
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
|
||||
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
|
||||
public String getMySQLUserPassword() {
|
||||
|
||||
public String getMySQLUserPassword() {
|
||||
if (config.getString("MySQL.Database.User_Password", null) != null) {
|
||||
return config.getString("MySQL.Database.User_Password", null);
|
||||
}
|
||||
|
@ -5,16 +5,15 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ProfileSaveTask implements Runnable {
|
||||
|
||||
Player player = null;
|
||||
|
||||
|
||||
public ProfileSaveTask(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(player != null) {
|
||||
if (player != null) {
|
||||
Users.getProfileByName(player.getName()).save();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SaveTimer implements Runnable {
|
||||
private final mcMMO plugin;
|
||||
@ -17,8 +15,9 @@ public class SaveTimer implements Runnable {
|
||||
public void run() {
|
||||
//All player data will be saved periodically through this
|
||||
int count = 1;
|
||||
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProfileSaveTask(player), count);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new ProfileSaveTask(player), count);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Combat;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class Archery {
|
||||
@ -61,7 +60,7 @@ public class Archery {
|
||||
loc.setPitch(-90);
|
||||
}
|
||||
|
||||
if (random.nextInt(2000) <= skillCheck && Permissions.getInstance().daze(attacker)) {
|
||||
if (random.nextInt(2000) <= skillCheck) {
|
||||
defender.teleport(loc);
|
||||
Combat.dealDamage(defender, 4);
|
||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||
|
@ -181,7 +181,7 @@ public class Combat {
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (Permissions.getInstance().unarmed(defender) && defender.getItemInHand().getType().equals(Material.AIR)) {
|
||||
if (defender.getItemInHand().getType().equals(Material.AIR)) {
|
||||
Unarmed.deflectCheck(defender, event);
|
||||
}
|
||||
}
|
||||
@ -193,20 +193,24 @@ public class Combat {
|
||||
|
||||
if (Permissions.getInstance().archery(attacker) && damage > 0) {
|
||||
|
||||
/*Archery needs a damage bonus to be viable in PVP*/
|
||||
int skillLvl = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
|
||||
double dmgBonusPercent = ((skillLvl / 50) * 0.1D);
|
||||
|
||||
/* Cap maximum bonus at 200% */
|
||||
if(dmgBonusPercent > 2)
|
||||
dmgBonusPercent = 2;
|
||||
if (Permissions.getInstance().archeryBonus(attacker)) {
|
||||
|
||||
/*Archery needs a damage bonus to be viable in PVP*/
|
||||
int skillLvl = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
|
||||
double dmgBonusPercent = ((skillLvl / 50) * 0.1D);
|
||||
|
||||
/* Cap maximum bonus at 200% */
|
||||
if (dmgBonusPercent > 2) {
|
||||
dmgBonusPercent = 2;
|
||||
}
|
||||
|
||||
/* Every 100 skill levels Archery gains 20% damage bonus, set that here */
|
||||
//TODO: Work in progress for balancing out Archery, will work on it more later...
|
||||
//TODO: Right now this is calculating a 10% bonus every 50 levels, not 20% every 100. Is this intended?
|
||||
int archeryBonus = (int)(event.getDamage() * dmgBonusPercent);
|
||||
event.setDamage(event.getDamage() + archeryBonus);
|
||||
}
|
||||
|
||||
/* Every 100 skill levels Archery gains 20% damage bonus, set that here */
|
||||
//TODO: Work in progress for balancing out Archery, will work on it more later...
|
||||
//TODO: Right now this is calculating a 10% bonus every 50 levels, not 20% every 100. Is this intended?
|
||||
int archeryBonus = (int)(event.getDamage() * dmgBonusPercent);
|
||||
event.setDamage(event.getDamage() + archeryBonus);
|
||||
|
||||
if (Permissions.getInstance().trackArrows(attacker)) {
|
||||
Archery.trackArrows(pluginx, target, PPa);
|
||||
}
|
||||
@ -222,7 +226,9 @@ public class Combat {
|
||||
return;
|
||||
}
|
||||
|
||||
Archery.dazeCheck(defender, attacker);
|
||||
if (Permissions.getInstance().daze(attacker)) {
|
||||
Archery.dazeCheck(defender, attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,14 +212,14 @@ public class Permissions {
|
||||
return player.hasPermission("mcmmo.ability.archery.trackarrows");
|
||||
}
|
||||
|
||||
public boolean ignition(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.archery.ignition");
|
||||
}
|
||||
|
||||
public boolean daze(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.archery.daze");
|
||||
}
|
||||
|
||||
public boolean archeryBonus(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.archery.bonusdamage");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.HERBALISM.*
|
||||
*/
|
||||
|
@ -18,7 +18,7 @@
|
||||
# ACROBATICS
|
||||
Acrobatics.Ability.Proc=[[GREEN]]**Graceful Landing**
|
||||
Acrobatics.Combat.Proc=[[GREEN]]**Dodged**
|
||||
Acrobatics.DodgeChance=[[RED]]Dodge Chance: [[YELLOW]]{0}%
|
||||
Acrobatics.DodgeChance=[[RED]]Dodge Chance: [[YELLOW]]{0}
|
||||
Acrobatics.Effect.0=Roll
|
||||
Acrobatics.Effect.1=Reduces or Negates fall damage
|
||||
Acrobatics.Effect.2=Graceful Roll
|
||||
@ -26,16 +26,16 @@ Acrobatics.Effect.3=Twice as effective as a normal Roll
|
||||
Acrobatics.Effect.4=Dodge
|
||||
Acrobatics.Effect.5=Reduce attack damage by half
|
||||
Acrobatics.Listener=Acrobatics:
|
||||
Acrobatics.Roll.Chance=[[RED]]Roll Chance: [[YELLOW]]{0}%
|
||||
Acrobatics.Roll.GraceChance=[[RED]]Graceful Roll Chance: [[YELLOW]]{0}%
|
||||
Acrobatics.Roll.Chance=[[RED]]Roll Chance: [[YELLOW]]{0}
|
||||
Acrobatics.Roll.GraceChance=[[RED]]Graceful Roll Chance: [[YELLOW]]{0}
|
||||
Acrobatics.Roll.Text=**Rolled**
|
||||
Acrobatics.SkillName=ACROBATICS
|
||||
Acrobatics.Skillup=[[YELLOW]]Acrobatics skill increased by {0}. Total ({1})
|
||||
|
||||
#ARCHERY
|
||||
Archery.Combat.DazeChance=[[RED]]Chance to Daze: [[YELLOW]]{0}%
|
||||
Archery.Combat.RetrieveChance=[[RED]]Chance to Retrieve Arrows: [[YELLOW]]{0}%
|
||||
Archery.Combat.SkillshotBonus=[[RED]]Skill Shot Bonus Damage: [[YELLOW]]{0}%
|
||||
Archery.Combat.DazeChance=[[RED]]Chance to Daze: [[YELLOW]]{0}
|
||||
Archery.Combat.RetrieveChance=[[RED]]Chance to Retrieve Arrows: [[YELLOW]]{0}
|
||||
Archery.Combat.SkillshotBonus=[[RED]]Skill Shot Bonus Damage: [[YELLOW]]{0}
|
||||
Archery.Effect.0=Skill Shot
|
||||
Archery.Effect.1=Increases damage done with bows
|
||||
Archery.Effect.2=Daze (Players)
|
||||
|
@ -291,14 +291,14 @@ permissions:
|
||||
description: Allows access to all Archery abilities
|
||||
children:
|
||||
mcmmo.ability.archery.trackarrows: true
|
||||
mcmmo.ability.archery.ignition: true
|
||||
mcmmo.ability.archery.daze: true
|
||||
mcmmo.ability.archery.bonusdamage : true
|
||||
mcmmo.ability.archery.trackarrows:
|
||||
description: Allows tracking & retrieval of arrows
|
||||
mcmmo.ability.archery.ignition:
|
||||
description: Allows access to the Ignition ability
|
||||
mcmmo.ability.archery.daze:
|
||||
description: Allows access to the Daze ability
|
||||
mcmmo.ability.archery.bonusdamage:
|
||||
description: Allows bonus damage from Archery
|
||||
mcmmo.ability.herbalism.*:
|
||||
description: Allows access to all Herbalism abilities
|
||||
children:
|
||||
|
Loading…
Reference in New Issue
Block a user