mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Cleanup & refactoring, part 1.
This commit is contained in:
@ -19,8 +19,8 @@ import com.gmail.nossr50.skills.Skills;
|
||||
public class AddlevelsCommand implements CommandExecutor{
|
||||
private final mcMMO plugin;
|
||||
|
||||
public AddlevelsCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
public AddlevelsCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,8 +17,8 @@ import com.gmail.nossr50.skills.Skills;
|
||||
public class AddxpCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public AddxpCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
public AddxpCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,8 +17,8 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
public class InspectCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public InspectCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
public InspectCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,8 +19,8 @@ import com.gmail.nossr50.skills.Skills;
|
||||
public class MmoeditCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public MmoeditCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
public MmoeditCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -8,11 +7,17 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.runnables.SQLConversionTask;
|
||||
|
||||
public class MmoupdateCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public MmoupdateCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@ -24,7 +29,7 @@ public class MmoupdateCommand implements CommandExecutor {
|
||||
Users.clearUsers();
|
||||
convertToMySQL();
|
||||
|
||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
Users.addUser(x);
|
||||
}
|
||||
|
||||
@ -41,6 +46,6 @@ public class MmoupdateCommand implements CommandExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getPluginManager().getPlugin("mcMMO"), new SQLConversionTask(), 1);
|
||||
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new SQLConversionTask(plugin), 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,25 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class XprateCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
private static int oldrate = LoadProperties.xpGainMultiplier;
|
||||
public static boolean xpevent = false;
|
||||
|
||||
public XprateCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage1 = mcLocale.getString("Commands.xprate.proper");
|
||||
@ -29,7 +34,7 @@ public class XprateCommand implements CommandExecutor {
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("reset")) {
|
||||
if (xpevent) {
|
||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
|
||||
}
|
||||
|
||||
@ -63,7 +68,7 @@ public class XprateCommand implements CommandExecutor {
|
||||
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
|
||||
|
||||
if (xpevent) {
|
||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
x.sendMessage(mcLocale.getString("Commands.xprate.started"));
|
||||
x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier}));
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class MccCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
player.sendMessage("/invite " + mcLocale.getString("Commands.Party.Invite"));
|
||||
player.sendMessage("/invite " + mcLocale.getString("Commands.Party.Accept"));
|
||||
player.sendMessage("/accept " + mcLocale.getString("Commands.Party.Accept"));
|
||||
|
||||
if (mcPermissions.getInstance().partyTeleport(player)) {
|
||||
player.sendMessage("/ptp " + mcLocale.getString("Commands.Party.Teleport"));
|
||||
|
@ -4,7 +4,6 @@ import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -19,6 +18,11 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class McremoveCommand implements CommandExecutor {
|
||||
private final String LOCATION = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||
private final mcMMO plugin;
|
||||
|
||||
public McremoveCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@ -89,7 +93,7 @@ public class McremoveCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
//Force PlayerProfile stuff to update
|
||||
Player player = Bukkit.getServer().getPlayer(playerName);
|
||||
Player player = plugin.getServer().getPlayer(playerName);
|
||||
|
||||
if (player != null && Users.players.containsKey(playerName.toLowerCase())) {
|
||||
Users.removeUser(player);
|
||||
@ -129,7 +133,7 @@ public class McremoveCommand implements CommandExecutor {
|
||||
return worked;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while reading " + LOCATION + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
plugin.getLogger().severe("Exception while reading " + LOCATION + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
return worked;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -8,83 +7,87 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class ACommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public ACommand() {}
|
||||
public ACommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
// Console message?
|
||||
if (!(sender instanceof Player) && args.length >= 1) {
|
||||
String aMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
// Console message?
|
||||
if (!(sender instanceof Player) && args.length >= 1) {
|
||||
String aMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", aMessage);
|
||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", aMessage);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if(chatEvent.isCancelled()) return true;
|
||||
if(chatEvent.isCancelled()) return true;
|
||||
|
||||
aMessage = chatEvent.getMessage();
|
||||
aMessage = chatEvent.getMessage();
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
|
||||
|
||||
Bukkit.getLogger().info("[A]<*Console*> " + aMessage);
|
||||
plugin.getLogger().info("[A]<*Console*> " + aMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
for (Player herp : plugin.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = null;
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not a toggle, a message
|
||||
// Not a toggle, a message
|
||||
|
||||
if (args.length >= 1) {
|
||||
String aMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
|
||||
if (args.length >= 1) {
|
||||
String aMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
|
||||
Users.getProfile(player).toggleAdminChat();
|
||||
player.chat(aMessage);
|
||||
Users.getProfile(player).toggleAdminChat();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.getPartyChatMode())
|
||||
PP.togglePartyChat();
|
||||
|
||||
PP.toggleAdminChat();
|
||||
|
||||
if (PP.getAdminChatMode()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(player != null)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.getPartyChatMode())
|
||||
PP.togglePartyChat();
|
||||
|
||||
PP.toggleAdminChat();
|
||||
|
||||
if (PP.getAdminChatMode()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
@ -16,50 +15,55 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class AcceptCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
private final mcMMO plugin;
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
|
||||
return true;
|
||||
}
|
||||
public AcceptCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!mcPermissions.getInstance().party(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PP.hasPartyInvite()) {
|
||||
Party Pinstance = Party.getInstance();
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PP.inParty()) {
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.hasPartyInvite()) {
|
||||
Party partyInstance = Party.getInstance();
|
||||
|
||||
if (PP.inParty()) {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), PP.getInvite(), EventReason.CHANGED_PARTIES);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Pinstance.removeFromParty(player, PP);
|
||||
}
|
||||
else {
|
||||
partyInstance.removeFromParty(player, PP);
|
||||
}
|
||||
else {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, PP.getInvite(), EventReason.JOINED_PARTY);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
PP.acceptInvite();
|
||||
Pinstance.addToParty(player, PP, PP.getParty(), true, null);
|
||||
partyInstance.addToParty(player, PP, PP.getParty(), true, null);
|
||||
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("mcMMO.NoInvites"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -8,13 +7,18 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class PCommand implements CommandExecutor {
|
||||
public PCommand() {}
|
||||
private final mcMMO plugin;
|
||||
|
||||
public PCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@ -29,7 +33,7 @@ public class PCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent("Console", args[0], pMessage);
|
||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if(chatEvent.isCancelled()) return true;
|
||||
|
||||
@ -37,9 +41,9 @@ public class PCommand implements CommandExecutor {
|
||||
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
|
||||
|
||||
Bukkit.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + pMessage);
|
||||
plugin.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
for (Player herp : plugin.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(herp).inParty()) {
|
||||
if (Users.getProfile(herp).getParty().equalsIgnoreCase(args[0])) {
|
||||
herp.sendMessage(pPrefix + pMessage);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -8,6 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
@ -16,6 +16,12 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class PartyCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public PartyCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
@ -46,7 +52,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
} else if (args.length == 0 && PP.inParty()) {
|
||||
String tempList = "";
|
||||
int x = 0;
|
||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
||||
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
|
||||
if (p != null && x + 1 >= Pinstance.partyCount(player)) {
|
||||
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
|
||||
@ -113,7 +119,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
if (args[0].equals("q") && PP.inParty()) {
|
||||
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), null, EventReason.LEFT_PARTY);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
@ -159,7 +165,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
} else {
|
||||
if (PP.inParty()) {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
@ -169,7 +175,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
}
|
||||
else {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
@ -194,8 +200,8 @@ public class PartyCommand implements CommandExecutor {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
if (Pinstance.isPartyLocked(PP.getParty())) {
|
||||
Player tPlayer = null;
|
||||
if (Bukkit.getServer().getPlayer(args[1]) != null)
|
||||
tPlayer = Bukkit.getServer().getPlayer(args[1]);
|
||||
if (plugin.getServer().getPlayer(args[1]) != null)
|
||||
tPlayer = plugin.getServer().getPlayer(args[1]);
|
||||
if (tPlayer == null) {
|
||||
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] }));
|
||||
}
|
||||
@ -212,7 +218,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
PlayerProfile tPP = Users.getProfile(tPlayer);
|
||||
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, tPP.getParty(), null, EventReason.KICKED_FROM_PARTY);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
@ -231,8 +237,8 @@ public class PartyCommand implements CommandExecutor {
|
||||
} else if (args[0].equalsIgnoreCase("owner")) {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
Player tPlayer = null;
|
||||
if (Bukkit.getServer().getPlayer(args[1]) != null)
|
||||
tPlayer = Bukkit.getServer().getPlayer(args[1]);
|
||||
if (plugin.getServer().getPlayer(args[1]) != null)
|
||||
tPlayer = plugin.getServer().getPlayer(args[1]);
|
||||
if (tPlayer == null) {
|
||||
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { args[1] }));
|
||||
}
|
||||
@ -246,7 +252,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
}
|
||||
} else {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
@ -256,7 +262,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
}
|
||||
} else if (args.length == 2 && !PP.inParty()) {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -71,7 +70,7 @@ public class PtpCommand implements CommandExecutor {
|
||||
|
||||
if (PP.getParty().equals(PPt.getParty())) {
|
||||
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, PP.getParty());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
player.teleport(target);
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.HUDType;
|
||||
import com.gmail.nossr50.datatypes.HUDmmo;
|
||||
@ -13,6 +14,12 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class MchudCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public MchudCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!LoadProperties.spoutEnabled) {
|
||||
@ -39,7 +46,7 @@ public class MchudCommand implements CommandExecutor {
|
||||
SpoutStuff.playerHUDs.get(player).resetHUD();
|
||||
SpoutStuff.playerHUDs.remove(player);
|
||||
PP.setHUDType(x);
|
||||
SpoutStuff.playerHUDs.put(player, new HUDmmo(player));
|
||||
SpoutStuff.playerHUDs.put(player, new HUDmmo(player, plugin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user