mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
mmoedit now works on offline players
This commit is contained in:
parent
d401a69560
commit
b6a1188bc7
@ -10,6 +10,7 @@ Key:
|
|||||||
Version 2.0.00-dev
|
Version 2.0.00-dev
|
||||||
+ Added Ocelots to Taming XP tables
|
+ Added Ocelots to Taming XP tables
|
||||||
+ Added ability to summon Ocelots with Call of the Wild
|
+ Added ability to summon Ocelots with Call of the Wild
|
||||||
|
+ Added offline user functionality to mmoedit
|
||||||
= Fixed ClassCastException from Taming preventDamage checks
|
= Fixed ClassCastException from Taming preventDamage checks
|
||||||
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
|
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
|
||||||
! Changed Call of the Wild to activate on left-click rather than right-click
|
! Changed Call of the Wild to activate on left-click rather than right-click
|
||||||
|
@ -24,7 +24,8 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = null;
|
Player player = null;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player)
|
||||||
|
{
|
||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,47 +33,73 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
sender.sendMessage("This command requires permissions.");
|
sender.sendMessage("This command requires permissions.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerProfile PPt = Users.getOfflineProfile(args[0]);
|
||||||
|
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player))
|
||||||
if (args.length < 2) {
|
{
|
||||||
|
if (args.length < 2)
|
||||||
|
{
|
||||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||||
return true;
|
return true;
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3)
|
||||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
{
|
||||||
|
if(!PPt.isLoaded())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Player does not exist in the database!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
|
||||||
|
{
|
||||||
int newvalue = Integer.valueOf(args[2]);
|
int newvalue = Integer.valueOf(args[2]);
|
||||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
Users.getOfflineProfile(args[0]).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||||
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
|
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
if (!mcPermissions.getInstance().mmoedit(player))
|
||||||
|
{
|
||||||
if (!mcPermissions.getInstance().mmoedit(player)) {
|
|
||||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length < 2) {
|
|
||||||
|
if (args.length < 2)
|
||||||
|
{
|
||||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length == 3) {
|
if (args.length == 3)
|
||||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
{
|
||||||
|
if(!PPt.isLoaded())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Player does not exist in the database!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
|
||||||
|
{
|
||||||
int newvalue = Integer.valueOf(args[2]);
|
int newvalue = Integer.valueOf(args[2]);
|
||||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
Users.getOfflineProfile(args[0]).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||||
player.sendMessage(ChatColor.RED + args[1] + " has been modified.");
|
player.sendMessage(ChatColor.RED + args[1] + " has been modified for "+args[0]);
|
||||||
}
|
}
|
||||||
} else if (args.length == 2) {
|
} else if (args.length == 2)
|
||||||
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
|
{
|
||||||
|
if (m.isInt(args[1]) && Skills.isSkill(args[0]))
|
||||||
|
{
|
||||||
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
int newvalue = Integer.valueOf(args[1]);
|
int newvalue = Integer.valueOf(args[1]);
|
||||||
PP.modifyskill(Skills.getSkillType(args[0]), newvalue);
|
PP.modifyskill(Skills.getSkillType(args[0]), newvalue);
|
||||||
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user