mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
These commands cannot work for online players, period.
This commit is contained in:
parent
1c328e7ac7
commit
ea32cb9e12
@ -52,8 +52,6 @@ public class McgodCommand implements CommandExecutor {
|
|||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||||
|
|
||||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and
|
|
||||||
// check if it's present in the database. If it's not, abort the process.
|
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
profile = new PlayerProfile(args[0], false);
|
profile = new PlayerProfile(args[0], false);
|
||||||
|
|
||||||
@ -61,21 +59,25 @@ public class McgodCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
profile = mcMMOPlayer.getProfile();
|
profile = mcMMOPlayer.getProfile();
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
// Check if the player is online before we try to send them a message.
|
if (!player.isOnline()) {
|
||||||
if (player.isOnline()) {
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (profile.getGodMode()) {
|
if (profile.getGodMode()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
profile.toggleGodMode();
|
profile.toggleGodMode();
|
||||||
return true;
|
return true;
|
||||||
|
@ -28,8 +28,14 @@ public class McrefreshCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
profile = Users.getPlayer(sender.getName()).getProfile();
|
profile = Users.getPlayer(sender.getName()).getProfile();
|
||||||
|
|
||||||
|
profile.setRecentlyHurt(0);
|
||||||
|
profile.resetCooldowns();
|
||||||
|
profile.resetToolPrepMode();
|
||||||
|
profile.resetAbilityMode();
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||||
break;
|
return true;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (!Permissions.hasPermission(sender, "mcmmo.commands.mcrefresh.others")) {
|
if (!Permissions.hasPermission(sender, "mcmmo.commands.mcrefresh.others")) {
|
||||||
@ -39,7 +45,6 @@ public class McrefreshCommand implements CommandExecutor {
|
|||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||||
|
|
||||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
profile = new PlayerProfile(args[0], false);
|
profile = new PlayerProfile(args[0], false);
|
||||||
|
|
||||||
@ -47,28 +52,29 @@ public class McrefreshCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
profile = mcMMOPlayer.getProfile();
|
profile = mcMMOPlayer.getProfile();
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
// Check if the player is online before we try to send them a message.
|
if (!player.isOnline()) {
|
||||||
if (player.isOnline()) {
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.setRecentlyHurt(0);
|
profile.setRecentlyHurt(0);
|
||||||
profile.resetCooldowns();
|
profile.resetCooldowns();
|
||||||
profile.resetToolPrepMode();
|
profile.resetToolPrepMode();
|
||||||
profile.resetAbilityMode();
|
profile.resetAbilityMode();
|
||||||
|
|
||||||
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,16 +50,24 @@ public class McabilityCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
profile = mcMMOPlayer.getProfile();
|
profile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
|
if (!player.isOnline()) {
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (profile.getAbilityUse()) {
|
if (profile.getAbilityUse()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
player.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
player.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.toggleAbilityUse();
|
profile.toggleAbilityUse();
|
||||||
|
@ -437,6 +437,7 @@ Commands.mmoupdate.Start=[[GRAY]]Starting conversion...
|
|||||||
Commands.mmoupdate.Finish=[[GREEN]]Conversion finished!
|
Commands.mmoupdate.Finish=[[GREEN]]Conversion finished!
|
||||||
Commands.ModDescription=[[RED]]- Read brief mod description
|
Commands.ModDescription=[[RED]]- Read brief mod description
|
||||||
Commands.NoConsole=This command does not support console usage.
|
Commands.NoConsole=This command does not support console usage.
|
||||||
|
Commands.Offline=[[RED]]This command does not work for offline players.
|
||||||
Commands.Other=[[GREEN]]--OTHER COMMANDS--
|
Commands.Other=[[GREEN]]--OTHER COMMANDS--
|
||||||
Commands.Party.Header=[[RED]]-----[][[GREEN]]PARTY[[RED]][]-----
|
Commands.Party.Header=[[RED]]-----[][[GREEN]]PARTY[[RED]][]-----
|
||||||
Commands.Party.Status=[[DARK_GRAY]]NAME: [[WHITE]]{0} {1}
|
Commands.Party.Status=[[DARK_GRAY]]NAME: [[WHITE]]{0} {1}
|
||||||
|
Loading…
Reference in New Issue
Block a user