mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Cleanup & refactoring, part 1.
This commit is contained in:
parent
153ecf4d13
commit
f94a617d94
@ -9,7 +9,6 @@ import java.util.HashMap;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
@ -33,10 +32,10 @@ public class Database {
|
|||||||
DriverManager.getConnection(connectionString);
|
DriverManager.getConnection(connectionString);
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e) {
|
catch (ClassNotFoundException e) {
|
||||||
Bukkit.getLogger().warning(e.getLocalizedMessage());
|
plugin.getLogger().warning(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
Bukkit.getLogger().warning(ex.getLocalizedMessage());
|
plugin.getLogger().warning(ex.getLocalizedMessage());
|
||||||
printErrors(ex);
|
printErrors(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,7 +249,7 @@ public class Database {
|
|||||||
{
|
{
|
||||||
System.out.println("[mcMMO] Connection to MySQL was lost! Attempting to reconnect in 60 seconds...");
|
System.out.println("[mcMMO] Connection to MySQL was lost! Attempting to reconnect in 60 seconds...");
|
||||||
reconnectTimestamp = System.currentTimeMillis();
|
reconnectTimestamp = System.currentTimeMillis();
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
@ -260,7 +259,7 @@ public class Database {
|
|||||||
x.save(); //Save all profiles
|
x.save(); //Save all profiles
|
||||||
}
|
}
|
||||||
Users.players.clear(); //Clear the profiles
|
Users.players.clear(); //Clear the profiles
|
||||||
for(Player x : Bukkit.getOnlinePlayers()) {
|
for(Player x : plugin.getServer().getOnlinePlayers()) {
|
||||||
Users.addUser(x); //Add in new profiles, forcing them to 'load' again from MySQL
|
Users.addUser(x); //Add in new profiles, forcing them to 'load' again from MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public class Metrics {
|
|||||||
+ encodeDataPair("authors", authors)
|
+ encodeDataPair("authors", authors)
|
||||||
+ encodeDataPair("version", description.getVersion())
|
+ encodeDataPair("version", description.getVersion())
|
||||||
+ encodeDataPair("server", Bukkit.getVersion())
|
+ encodeDataPair("server", Bukkit.getVersion())
|
||||||
+ encodeDataPair("players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length))
|
+ encodeDataPair("players", Integer.toString(plugin.getServer().getOnlinePlayers().length))
|
||||||
+ encodeDataPair("revision", String.valueOf(REVISION));
|
+ encodeDataPair("revision", String.valueOf(REVISION));
|
||||||
|
|
||||||
// If we're pinging, append it
|
// If we're pinging, append it
|
||||||
|
@ -19,8 +19,8 @@ import com.gmail.nossr50.skills.Skills;
|
|||||||
public class AddlevelsCommand implements CommandExecutor{
|
public class AddlevelsCommand implements CommandExecutor{
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public AddlevelsCommand(mcMMO instance) {
|
public AddlevelsCommand (mcMMO plugin) {
|
||||||
this.plugin = instance;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,8 +17,8 @@ import com.gmail.nossr50.skills.Skills;
|
|||||||
public class AddxpCommand implements CommandExecutor {
|
public class AddxpCommand implements CommandExecutor {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public AddxpCommand(mcMMO instance) {
|
public AddxpCommand (mcMMO plugin) {
|
||||||
this.plugin = instance;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,8 +17,8 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
public class InspectCommand implements CommandExecutor {
|
public class InspectCommand implements CommandExecutor {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public InspectCommand(mcMMO instance) {
|
public InspectCommand (mcMMO plugin) {
|
||||||
this.plugin = instance;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,8 +19,8 @@ import com.gmail.nossr50.skills.Skills;
|
|||||||
public class MmoeditCommand implements CommandExecutor {
|
public class MmoeditCommand implements CommandExecutor {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public MmoeditCommand(mcMMO instance) {
|
public MmoeditCommand (mcMMO plugin) {
|
||||||
this.plugin = instance;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.general;
|
package com.gmail.nossr50.commands.general;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,11 +7,17 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.commands.CommandHelper;
|
import com.gmail.nossr50.commands.CommandHelper;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.runnables.SQLConversionTask;
|
import com.gmail.nossr50.runnables.SQLConversionTask;
|
||||||
|
|
||||||
public class MmoupdateCommand implements CommandExecutor {
|
public class MmoupdateCommand implements CommandExecutor {
|
||||||
|
private final mcMMO plugin;
|
||||||
|
|
||||||
|
public MmoupdateCommand (mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
@ -24,7 +29,7 @@ public class MmoupdateCommand implements CommandExecutor {
|
|||||||
Users.clearUsers();
|
Users.clearUsers();
|
||||||
convertToMySQL();
|
convertToMySQL();
|
||||||
|
|
||||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||||
Users.addUser(x);
|
Users.addUser(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +46,6 @@ public class MmoupdateCommand implements CommandExecutor {
|
|||||||
return;
|
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;
|
package com.gmail.nossr50.commands.general;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.commands.CommandHelper;
|
import com.gmail.nossr50.commands.CommandHelper;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
|
||||||
public class XprateCommand implements CommandExecutor {
|
public class XprateCommand implements CommandExecutor {
|
||||||
|
private final mcMMO plugin;
|
||||||
private static int oldrate = LoadProperties.xpGainMultiplier;
|
private static int oldrate = LoadProperties.xpGainMultiplier;
|
||||||
public static boolean xpevent = false;
|
public static boolean xpevent = false;
|
||||||
|
|
||||||
|
public XprateCommand (mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
String usage1 = mcLocale.getString("Commands.xprate.proper");
|
String usage1 = mcLocale.getString("Commands.xprate.proper");
|
||||||
@ -29,7 +34,7 @@ public class XprateCommand implements CommandExecutor {
|
|||||||
case 1:
|
case 1:
|
||||||
if (args[0].equalsIgnoreCase("reset")) {
|
if (args[0].equalsIgnoreCase("reset")) {
|
||||||
if (xpevent) {
|
if (xpevent) {
|
||||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||||
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
|
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +68,7 @@ public class XprateCommand implements CommandExecutor {
|
|||||||
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
|
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
|
||||||
|
|
||||||
if (xpevent) {
|
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.started"));
|
||||||
x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier}));
|
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.Invite"));
|
||||||
player.sendMessage("/invite " + mcLocale.getString("Commands.Party.Accept"));
|
player.sendMessage("/accept " + mcLocale.getString("Commands.Party.Accept"));
|
||||||
|
|
||||||
if (mcPermissions.getInstance().partyTeleport(player)) {
|
if (mcPermissions.getInstance().partyTeleport(player)) {
|
||||||
player.sendMessage("/ptp " + mcLocale.getString("Commands.Party.Teleport"));
|
player.sendMessage("/ptp " + mcLocale.getString("Commands.Party.Teleport"));
|
||||||
|
@ -4,7 +4,6 @@ import java.io.BufferedReader;
|
|||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -19,6 +18,11 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
|
|
||||||
public class McremoveCommand implements CommandExecutor {
|
public class McremoveCommand implements CommandExecutor {
|
||||||
private final String LOCATION = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
private final String LOCATION = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||||
|
private final mcMMO plugin;
|
||||||
|
|
||||||
|
public McremoveCommand (mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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
|
//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())) {
|
if (player != null && Users.players.containsKey(playerName.toLowerCase())) {
|
||||||
Users.removeUser(player);
|
Users.removeUser(player);
|
||||||
@ -129,7 +133,7 @@ public class McremoveCommand implements CommandExecutor {
|
|||||||
return worked;
|
return worked;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
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;
|
return worked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,83 +7,87 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
|
||||||
public class ACommand implements CommandExecutor {
|
public class ACommand implements CommandExecutor {
|
||||||
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public ACommand() {}
|
public ACommand (mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
|
||||||
// Console message?
|
// Console message?
|
||||||
if (!(sender instanceof Player) && args.length >= 1) {
|
if (!(sender instanceof Player) && args.length >= 1) {
|
||||||
String aMessage = args[0];
|
String aMessage = args[0];
|
||||||
for (int i = 1; i <= args.length - 1; i++) {
|
for (int i = 1; i <= args.length - 1; i++) {
|
||||||
aMessage = aMessage + " " + args[i];
|
aMessage = aMessage + " " + args[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", aMessage);
|
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", aMessage);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
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()) {
|
for (Player herp : plugin.getServer().getOnlinePlayers()) {
|
||||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||||
herp.sendMessage(aPrefix + aMessage);
|
herp.sendMessage(aPrefix + aMessage);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = null;
|
Player player = null;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
|
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not a toggle, a message
|
// Not a toggle, a message
|
||||||
|
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
String aMessage = args[0];
|
String aMessage = args[0];
|
||||||
for (int i = 1; i <= args.length - 1; i++) {
|
for (int i = 1; i <= args.length - 1; i++) {
|
||||||
aMessage = aMessage + " " + args[i];
|
aMessage = aMessage + " " + args[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Users.getProfile(player).toggleAdminChat();
|
Users.getProfile(player).toggleAdminChat();
|
||||||
player.chat(aMessage);
|
player.chat(aMessage);
|
||||||
Users.getProfile(player).toggleAdminChat();
|
Users.getProfile(player).toggleAdminChat();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player != null)
|
if(player != null)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
|
||||||
if (PP.getPartyChatMode())
|
if (PP.getPartyChatMode())
|
||||||
PP.togglePartyChat();
|
PP.togglePartyChat();
|
||||||
|
|
||||||
PP.toggleAdminChat();
|
PP.toggleAdminChat();
|
||||||
|
|
||||||
if (PP.getAdminChatMode()) {
|
if (PP.getAdminChatMode()) {
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
|
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
|
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
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.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
@ -16,50 +15,55 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
import com.gmail.nossr50.party.Party;
|
import com.gmail.nossr50.party.Party;
|
||||||
|
|
||||||
public class AcceptCommand implements CommandExecutor {
|
public class AcceptCommand implements CommandExecutor {
|
||||||
@Override
|
private final mcMMO plugin;
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
|
|
||||||
if (!(sender instanceof Player)) {
|
public AcceptCommand (mcMMO plugin) {
|
||||||
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
|
this.plugin = plugin;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Player player = (Player) sender;
|
@Override
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
|
||||||
if (!mcPermissions.getInstance().party(player)) {
|
if (CommandHelper.noConsoleUsage(sender)) {
|
||||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (PP.hasPartyInvite()) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
|
||||||
Party Pinstance = Party.getInstance();
|
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);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), PP.getInvite(), EventReason.CHANGED_PARTIES);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pinstance.removeFromParty(player, PP);
|
partyInstance.removeFromParty(player, PP);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, PP.getInvite(), EventReason.JOINED_PARTY);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, PP.getInvite(), EventReason.JOINED_PARTY);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PP.acceptInvite();
|
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;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,13 +7,18 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
|
||||||
public class PCommand implements CommandExecutor {
|
public class PCommand implements CommandExecutor {
|
||||||
public PCommand() {}
|
private final mcMMO plugin;
|
||||||
|
|
||||||
|
public PCommand (mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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);
|
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent("Console", args[0], pMessage);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||||
|
|
||||||
if(chatEvent.isCancelled()) return true;
|
if(chatEvent.isCancelled()) return true;
|
||||||
|
|
||||||
@ -37,9 +41,9 @@ public class PCommand implements CommandExecutor {
|
|||||||
|
|
||||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
|
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).inParty()) {
|
||||||
if (Users.getProfile(herp).getParty().equalsIgnoreCase(args[0])) {
|
if (Users.getProfile(herp).getParty().equalsIgnoreCase(args[0])) {
|
||||||
herp.sendMessage(pPrefix + pMessage);
|
herp.sendMessage(pPrefix + pMessage);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,6 +7,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||||
@ -16,6 +16,12 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
import com.gmail.nossr50.party.Party;
|
import com.gmail.nossr50.party.Party;
|
||||||
|
|
||||||
public class PartyCommand implements CommandExecutor {
|
public class PartyCommand implements CommandExecutor {
|
||||||
|
private final mcMMO plugin;
|
||||||
|
|
||||||
|
public PartyCommand (mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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()) {
|
} else if (args.length == 0 && PP.inParty()) {
|
||||||
String tempList = "";
|
String tempList = "";
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
||||||
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
|
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
|
||||||
if (p != null && x + 1 >= Pinstance.partyCount(player)) {
|
if (p != null && x + 1 >= Pinstance.partyCount(player)) {
|
||||||
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
|
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
|
||||||
@ -113,7 +119,7 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
if (args[0].equals("q") && PP.inParty()) {
|
if (args[0].equals("q") && PP.inParty()) {
|
||||||
|
|
||||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), null, EventReason.LEFT_PARTY);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), null, EventReason.LEFT_PARTY);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@ -159,7 +165,7 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
} else {
|
} else {
|
||||||
if (PP.inParty()) {
|
if (PP.inParty()) {
|
||||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@ -169,7 +175,7 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@ -194,8 +200,8 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||||
if (Pinstance.isPartyLocked(PP.getParty())) {
|
if (Pinstance.isPartyLocked(PP.getParty())) {
|
||||||
Player tPlayer = null;
|
Player tPlayer = null;
|
||||||
if (Bukkit.getServer().getPlayer(args[1]) != null)
|
if (plugin.getServer().getPlayer(args[1]) != null)
|
||||||
tPlayer = Bukkit.getServer().getPlayer(args[1]);
|
tPlayer = plugin.getServer().getPlayer(args[1]);
|
||||||
if (tPlayer == null) {
|
if (tPlayer == null) {
|
||||||
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] }));
|
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] }));
|
||||||
}
|
}
|
||||||
@ -212,7 +218,7 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
PlayerProfile tPP = Users.getProfile(tPlayer);
|
PlayerProfile tPP = Users.getProfile(tPlayer);
|
||||||
|
|
||||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, tPP.getParty(), null, EventReason.KICKED_FROM_PARTY);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, tPP.getParty(), null, EventReason.KICKED_FROM_PARTY);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@ -231,8 +237,8 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
} else if (args[0].equalsIgnoreCase("owner")) {
|
} else if (args[0].equalsIgnoreCase("owner")) {
|
||||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||||
Player tPlayer = null;
|
Player tPlayer = null;
|
||||||
if (Bukkit.getServer().getPlayer(args[1]) != null)
|
if (plugin.getServer().getPlayer(args[1]) != null)
|
||||||
tPlayer = Bukkit.getServer().getPlayer(args[1]);
|
tPlayer = plugin.getServer().getPlayer(args[1]);
|
||||||
if (tPlayer == null) {
|
if (tPlayer == null) {
|
||||||
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { args[1] }));
|
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { args[1] }));
|
||||||
}
|
}
|
||||||
@ -246,7 +252,7 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@ -256,7 +262,7 @@ public class PartyCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
} else if (args.length == 2 && !PP.inParty()) {
|
} else if (args.length == 2 && !PP.inParty()) {
|
||||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -71,7 +70,7 @@ public class PtpCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (PP.getParty().equals(PPt.getParty())) {
|
if (PP.getParty().equals(PPt.getParty())) {
|
||||||
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, PP.getParty());
|
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, PP.getParty());
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
player.teleport(target);
|
player.teleport(target);
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.HUDType;
|
import com.gmail.nossr50.datatypes.HUDType;
|
||||||
import com.gmail.nossr50.datatypes.HUDmmo;
|
import com.gmail.nossr50.datatypes.HUDmmo;
|
||||||
@ -13,6 +14,12 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
|||||||
import com.gmail.nossr50.spout.SpoutStuff;
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
|
|
||||||
public class MchudCommand implements CommandExecutor {
|
public class MchudCommand implements CommandExecutor {
|
||||||
|
private final mcMMO plugin;
|
||||||
|
|
||||||
|
public MchudCommand (mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!LoadProperties.spoutEnabled) {
|
if (!LoadProperties.spoutEnabled) {
|
||||||
@ -39,7 +46,7 @@ public class MchudCommand implements CommandExecutor {
|
|||||||
SpoutStuff.playerHUDs.get(player).resetHUD();
|
SpoutStuff.playerHUDs.get(player).resetHUD();
|
||||||
SpoutStuff.playerHUDs.remove(player);
|
SpoutStuff.playerHUDs.remove(player);
|
||||||
PP.setHUDType(x);
|
PP.setHUDType(x);
|
||||||
SpoutStuff.playerHUDs.put(player, new HUDmmo(player));
|
SpoutStuff.playerHUDs.put(player, new HUDmmo(player, plugin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -278,7 +277,7 @@ public class LoadTreasures extends ConfigLoader{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (String issue : issues) {
|
for (String issue : issues) {
|
||||||
Bukkit.getLogger().warning(issue);
|
plugin.getLogger().warning(issue);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.datatypes;
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
import org.getspout.spoutapi.gui.Color;
|
import org.getspout.spoutapi.gui.Color;
|
||||||
@ -19,7 +18,8 @@ import com.gmail.nossr50.spout.SpoutStuff;
|
|||||||
public class HUDmmo {
|
public class HUDmmo {
|
||||||
private int center_x = 427 / 2;
|
private int center_x = 427 / 2;
|
||||||
|
|
||||||
private String playerName = null;
|
private String playerName;
|
||||||
|
private final mcMMO plugin;
|
||||||
|
|
||||||
private Widget xpbar = null;
|
private Widget xpbar = null;
|
||||||
private GenericGradient xpfill = null;
|
private GenericGradient xpfill = null;
|
||||||
@ -28,10 +28,9 @@ public class HUDmmo {
|
|||||||
private GenericGradient xpicon_border = null;
|
private GenericGradient xpicon_border = null;
|
||||||
private GenericTexture xpicon = null;
|
private GenericTexture xpicon = null;
|
||||||
|
|
||||||
private mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
|
public HUDmmo(Player player, mcMMO plugin) {
|
||||||
|
this.playerName = player.getName();
|
||||||
public HUDmmo(Player player) {
|
this.plugin = plugin;
|
||||||
playerName = player.getName();
|
|
||||||
initializeHUD(player);
|
initializeHUD(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,12 +1001,12 @@ public class PlayerProfile {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, x, newValue));
|
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, x, newValue));
|
||||||
skillsXp.put(x, skillsXp.get(x) + newValue);
|
skillsXp.put(x, skillsXp.get(x) + newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, newValue));
|
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, newValue));
|
||||||
skillsXp.put(skillType, skillsXp.get(skillType) + newValue);
|
skillsXp.put(skillType, skillsXp.get(skillType) + newValue);
|
||||||
lastgained = skillType;
|
lastgained = skillType;
|
||||||
}
|
}
|
||||||
@ -1031,7 +1031,7 @@ public class PlayerProfile {
|
|||||||
* @param player The player to add XP to
|
* @param player The player to add XP to
|
||||||
*/
|
*/
|
||||||
public void addXP(SkillType skillType, int newValue) {
|
public void addXP(SkillType skillType, int newValue) {
|
||||||
Player player = Bukkit.getPlayer(playerName);
|
Player player = mcMMO.p.getServer().getPlayer(playerName);
|
||||||
|
|
||||||
if (System.currentTimeMillis() < ((xpGainATS * 1000) + 250) || player.getGameMode().equals(GameMode.CREATIVE)) {
|
if (System.currentTimeMillis() < ((xpGainATS * 1000) + 250) || player.getGameMode().equals(GameMode.CREATIVE)) {
|
||||||
return;
|
return;
|
||||||
@ -1055,7 +1055,7 @@ public class PlayerProfile {
|
|||||||
xp += trueBonus;
|
xp += trueBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
|
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
|
||||||
skillsXp.put(skillType, skillsXp.get(skillType) + xp);
|
skillsXp.put(skillType, skillsXp.get(skillType) + xp);
|
||||||
lastgained = skillType;
|
lastgained = skillType;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.listeners;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -51,10 +50,10 @@ import com.gmail.nossr50.skills.Skills;
|
|||||||
import com.gmail.nossr50.skills.Taming;
|
import com.gmail.nossr50.skills.Taming;
|
||||||
|
|
||||||
public class mcPlayerListener implements Listener {
|
public class mcPlayerListener implements Listener {
|
||||||
private mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public mcPlayerListener(mcMMO instance) {
|
public mcPlayerListener(final mcMMO plugin) {
|
||||||
plugin = instance;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,11 +151,11 @@ public class mcPlayerListener implements Listener {
|
|||||||
|
|
||||||
//Bleed it out
|
//Bleed it out
|
||||||
if(PP.getBleedTicks() > 0) {
|
if(PP.getBleedTicks() > 0) {
|
||||||
Combat.dealDamage(player, PP.getBleedTicks()*2);
|
Combat.dealDamage(player, PP.getBleedTicks() * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Schedule PlayerProfile removal 2 minutes after quitting
|
//Schedule PlayerProfile removal 2 minutes after quitting
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new RemoveProfileFromMemoryTask(player), 2400);
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new RemoveProfileFromMemoryTask(player), 2400);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +38,7 @@ public class mcSpoutListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayer.isSpoutCraftEnabled()) {
|
if (sPlayer.isSpoutCraftEnabled()) {
|
||||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer)); //Setup Party HUD stuff
|
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer, plugin)); //Setup Party HUD stuff
|
||||||
|
|
||||||
PPs.toggleSpoutEnabled();
|
PPs.toggleSpoutEnabled();
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class mcSpoutScreenListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
|
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer, plugin));
|
||||||
SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP);
|
SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
@ -52,6 +51,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
|
public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
|
||||||
|
|
||||||
public static Database database = null;
|
public static Database database = null;
|
||||||
|
public static mcMMO p;
|
||||||
|
|
||||||
//Config file stuff
|
//Config file stuff
|
||||||
LoadProperties config;
|
LoadProperties config;
|
||||||
@ -64,7 +64,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
* Things to be run when the plugin is enabled.
|
* Things to be run when the plugin is enabled.
|
||||||
*/
|
*/
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
final Plugin thisPlugin = this;
|
p = this;
|
||||||
mcmmo = this.getFile();
|
mcmmo = this.getFile();
|
||||||
new File(maindirectory).mkdir();
|
new File(maindirectory).mkdir();
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
Metrics metrics = new Metrics();
|
Metrics metrics = new Metrics();
|
||||||
|
|
||||||
// 'this' in this context is the Plugin object
|
// 'this' in this context is the Plugin object
|
||||||
metrics.beginMeasuringPlugin(thisPlugin);
|
metrics.beginMeasuringPlugin(p);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
System.out.println("Failed to submit stats.");
|
System.out.println("Failed to submit stats.");
|
||||||
@ -243,7 +243,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
//mc* commands
|
//mc* commands
|
||||||
if (LoadProperties.mcremoveEnable) {
|
if (LoadProperties.mcremoveEnable) {
|
||||||
getCommand("mcremove").setExecutor(new McremoveCommand());
|
getCommand("mcremove").setExecutor(new McremoveCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadProperties.mcabilityEnable) {
|
if (LoadProperties.mcabilityEnable) {
|
||||||
@ -276,11 +276,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
//Party commands
|
//Party commands
|
||||||
if (LoadProperties.acceptEnable) {
|
if (LoadProperties.acceptEnable) {
|
||||||
getCommand("accept").setExecutor(new AcceptCommand());
|
getCommand("accept").setExecutor(new AcceptCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadProperties.aEnable) {
|
if (LoadProperties.aEnable) {
|
||||||
getCommand("a").setExecutor(new ACommand());
|
getCommand("a").setExecutor(new ACommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadProperties.inviteEnable) {
|
if (LoadProperties.inviteEnable) {
|
||||||
@ -288,11 +288,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (LoadProperties.partyEnable) {
|
if (LoadProperties.partyEnable) {
|
||||||
getCommand("party").setExecutor(new PartyCommand());
|
getCommand("party").setExecutor(new PartyCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadProperties.pEnable) {
|
if (LoadProperties.pEnable) {
|
||||||
getCommand("p").setExecutor(new PCommand());
|
getCommand("p").setExecutor(new PCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadProperties.ptpEnable) {
|
if (LoadProperties.ptpEnable) {
|
||||||
@ -317,17 +317,17 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (LoadProperties.xprateEnable) {
|
if (LoadProperties.xprateEnable) {
|
||||||
getCommand("xprate").setExecutor(new XprateCommand());
|
getCommand("xprate").setExecutor(new XprateCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
|
getCommand("mmoupdate").setExecutor(new MmoupdateCommand(this));
|
||||||
|
|
||||||
//Spout commands
|
//Spout commands
|
||||||
if (LoadProperties.xplockEnable) {
|
if (LoadProperties.xplockEnable) {
|
||||||
getCommand("xplock").setExecutor(new XplockCommand());
|
getCommand("xplock").setExecutor(new XplockCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommand("mchud").setExecutor(new MchudCommand());
|
getCommand("mchud").setExecutor(new MchudCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,6 @@ import java.io.ObjectInputStream;
|
|||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
@ -72,7 +71,7 @@ public class Party {
|
|||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
int partyMembers = 0;
|
int partyMembers = 0;
|
||||||
|
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
||||||
if (player != null && p != null) { //Is this even possible?
|
if (player != null && p != null) { //Is this even possible?
|
||||||
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
|
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
|
||||||
partyMembers++;
|
partyMembers++;
|
||||||
@ -86,7 +85,7 @@ public class Party {
|
|||||||
private void informPartyMembers(Player player) {
|
private void informPartyMembers(Player player) {
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
|
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
||||||
if (player != null && p != null) {
|
if (player != null && p != null) {
|
||||||
if (inSameParty(player, p) && !p.getName().equals(playerName)) {
|
if (inSameParty(player, p) && !p.getName().equals(playerName)) {
|
||||||
p.sendMessage(mcLocale.getString("Party.InformedOnJoin", new Object[] {playerName}));
|
p.sendMessage(mcLocale.getString("Party.InformedOnJoin", new Object[] {playerName}));
|
||||||
@ -104,7 +103,7 @@ public class Party {
|
|||||||
public ArrayList<Player> getPartyMembers(Player player) {
|
public ArrayList<Player> getPartyMembers(Player player) {
|
||||||
ArrayList<Player> players = new ArrayList<Player>();
|
ArrayList<Player> players = new ArrayList<Player>();
|
||||||
|
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
||||||
if (p.isOnline() && player != null && p != null) {
|
if (p.isOnline() && player != null && p != null) {
|
||||||
if (inSameParty(player, p) && !p.getName().equals(player.getName())) {
|
if (inSameParty(player, p) && !p.getName().equals(player.getName())) {
|
||||||
players.add(p);
|
players.add(p);
|
||||||
@ -122,7 +121,7 @@ public class Party {
|
|||||||
private void informPartyMembersOwnerChange(String newOwnerName) {
|
private void informPartyMembersOwnerChange(String newOwnerName) {
|
||||||
Player newOwner = plugin.getServer().getPlayer(newOwnerName);
|
Player newOwner = plugin.getServer().getPlayer(newOwnerName);
|
||||||
|
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()){
|
for (Player p : plugin.getServer().getOnlinePlayers()){
|
||||||
if (newOwner != null && p != null) {
|
if (newOwner != null && p != null) {
|
||||||
if (inSameParty(newOwner, p)) {
|
if (inSameParty(newOwner, p)) {
|
||||||
p.sendMessage(newOwnerName + " is the new party owner."); //TODO: Needs more locale
|
p.sendMessage(newOwnerName + " is the new party owner."); //TODO: Needs more locale
|
||||||
@ -139,7 +138,7 @@ public class Party {
|
|||||||
private void informPartyMembersQuit(Player player) {
|
private void informPartyMembersQuit(Player player) {
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
|
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()){
|
for (Player p : plugin.getServer().getOnlinePlayers()){
|
||||||
if (player != null && p != null){
|
if (player != null && p != null){
|
||||||
if (inSameParty(player, p) && !p.getName().equals(playerName)) {
|
if (inSameParty(player, p) && !p.getName().equals(playerName)) {
|
||||||
p.sendMessage(mcLocale.getString("Party.InformedOnQuit", new Object[] {playerName}));
|
p.sendMessage(mcLocale.getString("Party.InformedOnQuit", new Object[] {playerName}));
|
||||||
@ -458,7 +457,7 @@ public class Party {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
catch (EOFException e) {
|
catch (EOFException e) {
|
||||||
Bukkit.getLogger().info("partyPlayersFile empty.");
|
plugin.getLogger().info("partyPlayersFile empty.");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -477,7 +476,7 @@ public class Party {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
catch (EOFException e) {
|
catch (EOFException e) {
|
||||||
Bukkit.getLogger().info("partyLocksFile empty.");
|
plugin.getLogger().info("partyLocksFile empty.");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -496,7 +495,7 @@ public class Party {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
catch (EOFException e) {
|
catch (EOFException e) {
|
||||||
Bukkit.getLogger().info("partyPasswordsFile empty.");
|
plugin.getLogger().info("partyPasswordsFile empty.");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -3,13 +3,16 @@ package com.gmail.nossr50.runnables;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
|
|
||||||
public class SQLConversionTask implements Runnable {
|
public class SQLConversionTask implements Runnable {
|
||||||
|
private final mcMMO plugin;
|
||||||
|
|
||||||
|
public SQLConversionTask(mcMMO plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -273,7 +276,7 @@ public class SQLConversionTask implements Runnable {
|
|||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables;
|
package com.gmail.nossr50.runnables;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
import org.getspout.spoutapi.player.FileManager;
|
import org.getspout.spoutapi.player.FileManager;
|
||||||
|
|
||||||
@ -11,13 +10,13 @@ import com.gmail.nossr50.spout.SpoutStuff;
|
|||||||
public class SpoutStart implements Runnable{
|
public class SpoutStart implements Runnable{
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public SpoutStart(mcMMO m) {
|
public SpoutStart(final mcMMO plugin) {
|
||||||
this.plugin = m;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (Bukkit.getPluginManager().getPlugin("Spout") != null) {
|
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
|
||||||
LoadProperties.spoutEnabled = true;
|
LoadProperties.spoutEnabled = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.skills;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.CoalType;
|
import org.bukkit.CoalType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -14,6 +13,7 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.spout.SpoutSounds;
|
import com.gmail.nossr50.spout.SpoutSounds;
|
||||||
@ -254,7 +254,7 @@ public class Mining {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(armswing);
|
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
|
||||||
Skills.abilityDurabilityLoss(player.getItemInHand(), durabilityLoss);
|
Skills.abilityDurabilityLoss(player.getItemInHand(), durabilityLoss);
|
||||||
|
|
||||||
miningBlockCheck(player, block);
|
miningBlockCheck(player, block);
|
||||||
|
@ -18,6 +18,7 @@ import org.getspout.spoutapi.player.SpoutPlayer;
|
|||||||
import com.gmail.nossr50.ItemChecks;
|
import com.gmail.nossr50.ItemChecks;
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.spout.SpoutSounds;
|
import com.gmail.nossr50.spout.SpoutSounds;
|
||||||
@ -143,7 +144,7 @@ public class Repair {
|
|||||||
|
|
||||||
//CLANG CLANG
|
//CLANG CLANG
|
||||||
if (LoadProperties.spoutEnabled) {
|
if (LoadProperties.spoutEnabled) {
|
||||||
SpoutSounds.playRepairNoise(player);
|
SpoutSounds.playRepairNoise(player, mcMMO.p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||||
|
|
||||||
import com.gmail.nossr50.Leaderboard;
|
import com.gmail.nossr50.Leaderboard;
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.spout.SpoutStuff;
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
@ -193,7 +194,7 @@ public class Skills {
|
|||||||
PP.skillUp(skillType, 1);
|
PP.skillUp(skillType, 1);
|
||||||
|
|
||||||
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
||||||
Bukkit.getPluginManager().callEvent(eventToFire);
|
mcMMO.p.getServer().getPluginManager().callEvent(eventToFire);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PP.addLevels(skillType, 0);
|
PP.addLevels(skillType, 0);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.spout;
|
package com.gmail.nossr50.spout;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -9,6 +8,8 @@ import org.getspout.spoutapi.player.SpoutPlayer;
|
|||||||
import org.getspout.spoutapi.sound.SoundEffect;
|
import org.getspout.spoutapi.sound.SoundEffect;
|
||||||
import org.getspout.spoutapi.sound.SoundManager;
|
import org.getspout.spoutapi.sound.SoundManager;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
public class SpoutSounds {
|
public class SpoutSounds {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,12 +31,12 @@ public class SpoutSounds {
|
|||||||
*
|
*
|
||||||
* @param player The player who repaired an item
|
* @param player The player who repaired an item
|
||||||
*/
|
*/
|
||||||
public static void playRepairNoise(Player player) {
|
public static void playRepairNoise(Player player, mcMMO plugin) {
|
||||||
SoundManager SM = SpoutManager.getSoundManager();
|
SoundManager SM = SpoutManager.getSoundManager();
|
||||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||||
|
|
||||||
//If this is pulling from online, why have it in the jar?
|
//If this is pulling from online, why have it in the jar?
|
||||||
SM.playCustomSoundEffect(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "repair.wav", false);
|
SM.playCustomSoundEffect(plugin, sPlayer, "repair.wav", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,11 +44,11 @@ public class SpoutSounds {
|
|||||||
*
|
*
|
||||||
* @param player The player who leveled up
|
* @param player The player who leveled up
|
||||||
*/
|
*/
|
||||||
protected static void playLevelUpNoise(Player player) {
|
protected static void playLevelUpNoise(Player player, mcMMO plugin) {
|
||||||
SoundManager SM = SpoutManager.getSoundManager();
|
SoundManager SM = SpoutManager.getSoundManager();
|
||||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||||
|
|
||||||
//If this is pulling from online, why have it in the jar?
|
//If this is pulling from online, why have it in the jar?
|
||||||
SM.playCustomSoundEffect(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "level.wav", false);
|
SM.playCustomSoundEffect(plugin, sPlayer, "level.wav", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,7 @@ import com.gmail.nossr50.listeners.mcSpoutListener;
|
|||||||
import com.gmail.nossr50.listeners.mcSpoutScreenListener;
|
import com.gmail.nossr50.listeners.mcSpoutScreenListener;
|
||||||
|
|
||||||
public class SpoutStuff {
|
public class SpoutStuff {
|
||||||
|
static mcMMO plugin = mcMMO.p;
|
||||||
static mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
|
|
||||||
|
|
||||||
private final static mcSpoutListener spoutListener = new mcSpoutListener(plugin);
|
private final static mcSpoutListener spoutListener = new mcSpoutListener(plugin);
|
||||||
private final static mcSpoutInputListener spoutInputListener = new mcSpoutInputListener(plugin);
|
private final static mcSpoutInputListener spoutInputListener = new mcSpoutInputListener(plugin);
|
||||||
@ -548,7 +547,7 @@ public class SpoutStuff {
|
|||||||
|
|
||||||
//TODO: Use Locale
|
//TODO: Use Locale
|
||||||
sPlayer.sendNotification(ChatColor.GREEN + "Level Up!", ChatColor.YELLOW + m.getCapitalized(skillType.toString()) + ChatColor.DARK_AQUA + " (" + ChatColor.GREEN + PP.getSkillLevel(skillType) + ChatColor.DARK_AQUA + ")", mat);
|
sPlayer.sendNotification(ChatColor.GREEN + "Level Up!", ChatColor.YELLOW + m.getCapitalized(skillType.toString()) + ChatColor.DARK_AQUA + " (" + ChatColor.GREEN + PP.getSkillLevel(skillType) + ChatColor.DARK_AQUA + ")", mat);
|
||||||
SpoutSounds.playLevelUpNoise(sPlayer);
|
SpoutSounds.playLevelUpNoise(sPlayer, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -405,6 +405,7 @@ Commands.Party.Toggle=[[RED]]- Toggle Party Chat
|
|||||||
Commands.Party=<partyname> [[RED]]- Create/Join designated party
|
Commands.Party=<partyname> [[RED]]- Create/Join designated party
|
||||||
Commands.PowerLevel.Leaderboard=[[YELLOW]]--mcMMO[[BLUE]] Power Level [[YELLOW]]Leaderboard--
|
Commands.PowerLevel.Leaderboard=[[YELLOW]]--mcMMO[[BLUE]] Power Level [[YELLOW]]Leaderboard--
|
||||||
Commands.PowerLevel=[[DARK_RED]]POWER LEVEL: [[GREEN]]{0}
|
Commands.PowerLevel=[[DARK_RED]]POWER LEVEL: [[GREEN]]{0}
|
||||||
|
Commands.Skill.Leaderboard=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Leaderboard--
|
||||||
Commands.SkillInfo=/<skillname> [[RED]]- View detailed information about a skill
|
Commands.SkillInfo=/<skillname> [[RED]]- View detailed information about a skill
|
||||||
Commands.Stats.Self=YOUR STATS
|
Commands.Stats.Self=YOUR STATS
|
||||||
Commands.Stats=[[RED]]- View your mcMMO stats
|
Commands.Stats=[[RED]]- View your mcMMO stats
|
||||||
@ -498,7 +499,6 @@ Item.Injured.Wait=You were injured recently and must wait to use this. [[YELLOW]
|
|||||||
#SKILLS
|
#SKILLS
|
||||||
Skills.Disarmed=[[DARK_RED]]You have been disarmed!
|
Skills.Disarmed=[[DARK_RED]]You have been disarmed!
|
||||||
Skills.Header=[[RED]]-----[][[GREEN]]{0}[[RED]][]-----
|
Skills.Header=[[RED]]-----[][[GREEN]]{0}[[RED]][]-----
|
||||||
Skills.Leaderboard.Listener=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Leaderboard--
|
|
||||||
Skills.NeedMore=[[DARK_RED]]You need more
|
Skills.NeedMore=[[DARK_RED]]You need more
|
||||||
Skills.Stats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]])
|
Skills.Stats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]])
|
||||||
Skills.TooTired=[[RED]]You are too tired to use that ability again.
|
Skills.TooTired=[[RED]]You are too tired to use that ability again.
|
||||||
|
Loading…
Reference in New Issue
Block a user