mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-28 03:27:39 +01:00
Preliminary level caps implementation
Also with an option to choose name/displayname for a and p commands, as well as enable/disable them
This commit is contained in:
parent
c95d2a9b84
commit
b8f4b6e2da
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
@ -59,8 +60,9 @@ public class ACommand implements CommandExecutor {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getDisplayName() + ChatColor.AQUA + "} ";
|
||||
log.log(Level.INFO, "[A]<" + player.getDisplayName() + "> " + aMessage);
|
||||
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} ";
|
||||
log.log(Level.INFO, "[A]<" + name + "> " + aMessage);
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
|
@ -69,9 +69,10 @@ public class PCommand implements CommandExecutor {
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
pMessage = pMessage + " " + args[i];
|
||||
}
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getDisplayName() + ChatColor.GREEN + ") ";
|
||||
|
||||
log.log(Level.INFO, "[P](" + PP.getParty() + ")" + "<" + player.getDisplayName() + "> " + pMessage);
|
||||
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") ";
|
||||
log.log(Level.INFO, "[P](" + PP.getParty() + ")" + "<" + name + "> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(herp).inParty()) {
|
||||
|
@ -33,8 +33,8 @@ public class LoadProperties {
|
||||
mcmmoEnable, partyEnable, inviteEnable, acceptEnable, whoisEnable,
|
||||
statsEnable, addxpEnable, ptpEnable, mmoeditEnable,
|
||||
clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable,
|
||||
mcrefreshEnable, enableMotd, enableMySpawn, enableRegen,
|
||||
enableCobbleToMossy, useMySQL, cocoabeans, mushrooms,
|
||||
mcrefreshEnable, aEnable, pEnable, enableMotd, enableMySpawn,
|
||||
enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, mushrooms,
|
||||
toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe,
|
||||
excavationRequiresShovel, woodcuttingrequiresaxe, eggs, apples,
|
||||
cake, music, diamond, glowstone, slowsand, sulphur, netherrack,
|
||||
@ -42,7 +42,7 @@ public class LoadProperties {
|
||||
mayLoseEnchants, fishingDrops, leatherArmor, ironArmor, goldArmor,
|
||||
diamondArmor, woodenTools, stoneTools, ironTools, goldTools,
|
||||
diamondTools, enderPearl, blazeRod, records, glowstoneDust,
|
||||
fishingDiamonds;
|
||||
fishingDiamonds, aDisplayNames, pDisplayNames;
|
||||
|
||||
public static String MySQLtablePrefix, MySQLuserName,
|
||||
MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone,
|
||||
@ -66,7 +66,11 @@ public class LoadProperties {
|
||||
keepEnchantsRank3, keepEnchantsRank4, fishingDropChanceTier1,
|
||||
fishingDropChanceTier2, fishingDropChanceTier3,
|
||||
fishingDropChanceTier4, fishingDropChanceTier5, mnetherwart,
|
||||
mvines, mlilypad, mnetherbrick, mendstone, mmossstone, mstonebrick;
|
||||
mvines, mlilypad, mnetherbrick, mendstone, mmossstone, mstonebrick,
|
||||
|
||||
levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
|
||||
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
|
||||
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting;
|
||||
|
||||
public static double xpbackground_r, xpbackground_g, xpbackground_b,
|
||||
xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g,
|
||||
@ -339,6 +343,19 @@ public class LoadProperties {
|
||||
nString = readString("Skills.Repair.String.Name", "String");
|
||||
rLeather = readInteger("Skills.Repair.Leather.ID", 334);
|
||||
nLeather = readString("Skills.Repair.String.Name", "Leather");
|
||||
|
||||
levelCapAcrobatics = readInteger("Skills.Acrobatics.Level_Cap", 0);
|
||||
levelCapArchery = readInteger("Skills.Archery.Level_Cap", 0);
|
||||
levelCapAxes = readInteger("Skills.Axes.Level_Cap", 0);
|
||||
levelCapExcavation = readInteger("Skills.Excavation.Level_Cap", 0);
|
||||
levelCapFishing = readInteger("Skills.Fishing.Level_Cap", 0);
|
||||
levelCapHerbalism = readInteger("Skills.Herbalism.Level_Cap", 0);
|
||||
levelCapMining = readInteger("Skills.Mining.Level_Cap", 0);
|
||||
levelCapRepair = readInteger("Skills.Repair.Level_Cap", 0);
|
||||
levelCapSwords = readInteger("Skills.Swords.Level_Cap", 0);
|
||||
levelCapTaming = readInteger("Skills.Taming.Level_Cap", 0);
|
||||
levelCapUnarmed = readInteger("Skills.Unarmed.Level_Cap", 0);
|
||||
levelCapWoodcutting = readInteger("Skills.Woodcutting.Level_Cap", 0);
|
||||
|
||||
mayDowngradeEnchants = readBoolean("Arcane_Forging.Downgrades.Enabled", true);
|
||||
downgradeRank1 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_1", 75);
|
||||
@ -408,5 +425,10 @@ public class LoadProperties {
|
||||
inviteEnable = readBoolean("Commands.invite.Enabled", true);
|
||||
acceptEnable = readBoolean("Commands.accept.Enabled", true);
|
||||
clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true);
|
||||
aEnable = readBoolean("Commands.a.Enabled", true);
|
||||
pEnable = readBoolean("Commands.p.Enabled", true);
|
||||
|
||||
aDisplayNames = readBoolean("Commands.a.Display_Names", true);
|
||||
pDisplayNames = readBoolean("Commands.p.Display_Names", true);
|
||||
}
|
||||
}
|
@ -315,7 +315,8 @@ public class mcPlayerListener implements Listener
|
||||
if(PP.getPartyChatMode())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
String format = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getDisplayName() + ChatColor.GREEN + ") "+event.getMessage();
|
||||
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String format = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") "+event.getMessage();
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(Party.getInstance().inSameParty(player, x))
|
||||
@ -328,7 +329,8 @@ public class mcPlayerListener implements Listener
|
||||
}
|
||||
} else if (PP.getAdminChatMode()) {
|
||||
event.setCancelled(true);
|
||||
String format = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getDisplayName() + ChatColor.AQUA + "} "+event.getMessage();
|
||||
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String format = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} "+event.getMessage();
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(x.isOp() || mcPermissions.getInstance().adminChat(x))
|
||||
|
@ -301,10 +301,10 @@ public class mcMMO extends JavaPlugin
|
||||
|
||||
//Party commands
|
||||
if(LoadProperties.acceptEnable) getCommand("accept").setExecutor(new AcceptCommand());
|
||||
getCommand("a").setExecutor(new ACommand());
|
||||
if(LoadProperties.aEnable) getCommand("a").setExecutor(new ACommand());
|
||||
if(LoadProperties.inviteEnable) getCommand("invite").setExecutor(new InviteCommand(this));
|
||||
if(LoadProperties.partyEnable) getCommand("party").setExecutor(new PartyCommand());
|
||||
getCommand("p").setExecutor(new PCommand());
|
||||
if(LoadProperties.pEnable) getCommand("p").setExecutor(new PCommand());
|
||||
if(LoadProperties.ptpEnable) getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||
|
||||
//Other commands
|
||||
|
@ -315,6 +315,11 @@ public class Skills
|
||||
|
||||
public static void XpCheckSkill(SkillType skillType, Player player)
|
||||
{
|
||||
if(skillType == SkillType.ALL) {
|
||||
XpCheckAll(player);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
|
||||
@ -323,12 +328,14 @@ public class Skills
|
||||
|
||||
while(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
|
||||
{
|
||||
skillups++;
|
||||
if(getSkillMaxLevel(skillType) >= PP.getSkillLevel(skillType) + 1) {
|
||||
skillups++;
|
||||
PP.skillUp(skillType, 1);
|
||||
|
||||
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
||||
Bukkit.getPluginManager().callEvent(eventToFire);
|
||||
}
|
||||
PP.removeXP(skillType, PP.getXpToLevel(skillType));
|
||||
PP.skillUp(skillType, 1);
|
||||
|
||||
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
||||
Bukkit.getPluginManager().callEvent(eventToFire);
|
||||
}
|
||||
|
||||
if(!LoadProperties.useMySQL)
|
||||
@ -376,6 +383,36 @@ public class Skills
|
||||
XpCheckSkill(x, player);
|
||||
}
|
||||
}
|
||||
public static int getSkillMaxLevel(SkillType skillType) {
|
||||
switch(skillType) {
|
||||
case ACROBATICS:
|
||||
return (LoadProperties.levelCapAcrobatics > 0) ? LoadProperties.levelCapAcrobatics : Integer.MAX_VALUE;
|
||||
case ARCHERY:
|
||||
return (LoadProperties.levelCapArchery > 0) ? LoadProperties.levelCapArchery : Integer.MAX_VALUE;
|
||||
case AXES:
|
||||
return (LoadProperties.levelCapAxes > 0) ? LoadProperties.levelCapAxes : Integer.MAX_VALUE;
|
||||
case EXCAVATION:
|
||||
return (LoadProperties.levelCapExcavation > 0) ? LoadProperties.levelCapExcavation : Integer.MAX_VALUE;
|
||||
case FISHING:
|
||||
return (LoadProperties.levelCapFishing > 0) ? LoadProperties.levelCapFishing : Integer.MAX_VALUE;
|
||||
case HERBALISM:
|
||||
return (LoadProperties.levelCapHerbalism > 0) ? LoadProperties.levelCapHerbalism : Integer.MAX_VALUE;
|
||||
case MINING:
|
||||
return (LoadProperties.levelCapMining > 0) ? LoadProperties.levelCapMining : Integer.MAX_VALUE;
|
||||
case REPAIR:
|
||||
return (LoadProperties.levelCapRepair > 0) ? LoadProperties.levelCapRepair : Integer.MAX_VALUE;
|
||||
case SWORDS:
|
||||
return (LoadProperties.levelCapSwords > 0) ? LoadProperties.levelCapSwords : Integer.MAX_VALUE;
|
||||
case TAMING:
|
||||
return (LoadProperties.levelCapTaming > 0) ? LoadProperties.levelCapTaming : Integer.MAX_VALUE;
|
||||
case UNARMED:
|
||||
return (LoadProperties.levelCapUnarmed > 0) ? LoadProperties.levelCapUnarmed : Integer.MAX_VALUE;
|
||||
case WOODCUTTING:
|
||||
return (LoadProperties.levelCapWoodcutting > 0) ? LoadProperties.levelCapWoodcutting : Integer.MAX_VALUE;
|
||||
default:
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
public static SkillType getSkillType(String skillName)
|
||||
{
|
||||
for(SkillType x : SkillType.values())
|
||||
|
@ -106,19 +106,26 @@ Fishing:
|
||||
Ender_Pearl: true
|
||||
Wooden_Tools: true
|
||||
Skills:
|
||||
Taming:
|
||||
Call_Of_The_Wild:
|
||||
Bones_Required: 10
|
||||
Acrobatics:
|
||||
Level_Cap: 0 #Level cap of 0 for no limit
|
||||
Archery:
|
||||
Level_Cap: 0
|
||||
Axes:
|
||||
Level_Cap: 0
|
||||
Excavation:
|
||||
Level_Cap: 0
|
||||
Requires_Shovel: true
|
||||
Woodcutting:
|
||||
Requires_Axe: true
|
||||
Fishing:
|
||||
Level_Cap: 0
|
||||
Herbalism:
|
||||
Level_Cap: 0
|
||||
Green_Thumb:
|
||||
Cobble_To_Mossy: true
|
||||
Mining:
|
||||
Level_Cap: 0
|
||||
Requires_Pickaxe: true
|
||||
Repair:
|
||||
Level_Cap: 0
|
||||
Leather:
|
||||
ID: 334
|
||||
String:
|
||||
@ -141,6 +148,17 @@ Skills:
|
||||
Iron:
|
||||
Name: Iron Bars
|
||||
ID: 265
|
||||
Swords:
|
||||
Level_Cap: 0
|
||||
Taming:
|
||||
Level_Cap: 0
|
||||
Call_Of_The_Wild:
|
||||
Bones_Required: 10
|
||||
Unarmed:
|
||||
Level_Cap: 0
|
||||
Woodcutting:
|
||||
Level_Cap: 0
|
||||
Requires_Axe: true
|
||||
Experience:
|
||||
Fishing:
|
||||
Base: 800
|
||||
@ -327,4 +345,10 @@ Commands:
|
||||
clearmyspawn:
|
||||
Enabled: true
|
||||
ptp:
|
||||
Enabled: true
|
||||
Enabled: true
|
||||
p:
|
||||
Enabled: true
|
||||
Display_Names: true
|
||||
a:
|
||||
Enabled: true
|
||||
Display_Names: true
|
Loading…
Reference in New Issue
Block a user