From e2d13034a89d76fec1aaad366934dc5d56027efd Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 28 Feb 2012 18:01:35 -0500 Subject: [PATCH] Kill it with fire, part 1 - MySpawn --- src/main/java/com/gmail/nossr50/Database.java | 6 -- src/main/java/com/gmail/nossr50/Item.java | 30 +++--- .../commands/general/ClearmyspawnCommand.java | 46 -------- .../commands/general/MyspawnCommand.java | 58 ---------- .../gmail/nossr50/commands/mc/MccCommand.java | 5 - .../nossr50/commands/mc/McremoveCommand.java | 5 - .../gmail/nossr50/config/LoadProperties.java | 9 +- .../nossr50/datatypes/PlayerProfile.java | 100 ++---------------- .../nossr50/listeners/mcBlockListener.java | 13 --- .../nossr50/listeners/mcPlayerListener.java | 25 ----- src/main/java/com/gmail/nossr50/m.java | 9 -- src/main/java/com/gmail/nossr50/mcMMO.java | 2 - .../java/com/gmail/nossr50/mcPermissions.java | 6 -- src/main/resources/config.yml | 6 -- src/main/resources/plugin.yml | 14 +-- 15 files changed, 25 insertions(+), 309 deletions(-) delete mode 100644 src/main/java/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java delete mode 100644 src/main/java/com/gmail/nossr50/commands/general/MyspawnCommand.java diff --git a/src/main/java/com/gmail/nossr50/Database.java b/src/main/java/com/gmail/nossr50/Database.java index b35106256..e18f50612 100644 --- a/src/main/java/com/gmail/nossr50/Database.java +++ b/src/main/java/com/gmail/nossr50/Database.java @@ -123,12 +123,6 @@ public class Database { + "`axes` int(10) unsigned NOT NULL DEFAULT '0'," + "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); - Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "spawn` (`user_id` int(10) NOT NULL," - + "`x` int(64) NOT NULL DEFAULT '0'," - + "`y` int(64) NOT NULL DEFAULT '0'," - + "`z` int(64) NOT NULL DEFAULT '0'," - + "`world` varchar(50) NOT NULL DEFAULT ''," - + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"skills2`"); Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"experience2`"); diff --git a/src/main/java/com/gmail/nossr50/Item.java b/src/main/java/com/gmail/nossr50/Item.java index 590baeb36..7eea2b6ab 100644 --- a/src/main/java/com/gmail/nossr50/Item.java +++ b/src/main/java/com/gmail/nossr50/Item.java @@ -16,16 +16,15 @@ */ package com.gmail.nossr50; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; -import com.gmail.nossr50.config.*; -import com.gmail.nossr50.locale.mcLocale; -import com.gmail.nossr50.skills.*; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; +import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; public class Item { @@ -67,23 +66,18 @@ public class Item { } } } - if(PP.getMySpawn(player) != null) - { - Location mySpawn = PP.getMySpawn(player); - if(mySpawn != null){ - player.teleport(mySpawn); //Do it twice to prevent weird stuff - player.teleport(mySpawn); - } - } else { + + if(player.getBedSpawnLocation() != null) + player.teleport(player.getBedSpawnLocation()); + else player.teleport(player.getWorld().getSpawnLocation()); - } + player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass")); //$NON-NLS-1$ - } else if (!Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) - { - player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(player, PP.getRecentlyHurt(), 60)})); //$NON-NLS-1$ - } else if (is.getTypeId() == LoadProperties.chimaeraId && is.getAmount() <= 9){ - player.sendMessage(mcLocale.getString("Item.NeedFeathers")); //$NON-NLS-1$ } + else if (!Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= itemsUsed) + player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(player, PP.getRecentlyHurt(), 60)})); //$NON-NLS-1$ + else if (is.getTypeId() == LoadProperties.chimaeraId && is.getAmount() <= itemsUsed) + player.sendMessage(mcLocale.getString("Item.NeedFeathers")); //$NON-NLS-1$ } } } diff --git a/src/main/java/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java b/src/main/java/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java deleted file mode 100644 index 16fb54b2f..000000000 --- a/src/main/java/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gmail.nossr50.commands.general; - -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.config.LoadProperties; -import com.gmail.nossr50.datatypes.PlayerProfile; -import com.gmail.nossr50.locale.mcLocale; - -public class ClearmyspawnCommand implements CommandExecutor { - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!LoadProperties.clearmyspawnEnable || !LoadProperties.enableMySpawn) { - sender.sendMessage("This command is not enabled."); - return true; - } - - if (!(sender instanceof Player)) { - sender.sendMessage("This command does not support console useage."); - return true; - } - - Player player = (Player) sender; - PlayerProfile PP = Users.getProfile(player); - - if (!mcPermissions.getInstance().mySpawn(player)) { - player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - - double x = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getX(); - double y = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getY(); - double z = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getZ(); - String worldname = Bukkit.getServer().getWorlds().get(0).getName(); - PP.setMySpawn(x, y, z, worldname); - player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnCleared")); - - return true; - } -} diff --git a/src/main/java/com/gmail/nossr50/commands/general/MyspawnCommand.java b/src/main/java/com/gmail/nossr50/commands/general/MyspawnCommand.java deleted file mode 100644 index 9c5565ec8..000000000 --- a/src/main/java/com/gmail/nossr50/commands/general/MyspawnCommand.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gmail.nossr50.commands.general; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -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.config.LoadProperties; -import com.gmail.nossr50.datatypes.PlayerProfile; -import com.gmail.nossr50.locale.mcLocale; - -public class MyspawnCommand implements CommandExecutor { - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!LoadProperties.myspawnEnable || !LoadProperties.enableMySpawn) { - sender.sendMessage("This command is not enabled."); - return true; - } - - if (!(sender instanceof Player)) { - sender.sendMessage("This command does not support console useage."); - return true; - } - - Player player = (Player) sender; - PlayerProfile PP = Users.getProfile(player); - - if (!mcPermissions.getInstance().mySpawn(player)) { - player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if (System.currentTimeMillis() < (PP.getMySpawnATS() * 1000) + 3600000) { - long x = (((PP.getMySpawnATS() * 1000) + 3600000) - System.currentTimeMillis()); - int y = (int) (x / 60000); - int z = (int) ((x / 1000) - (y * 60)); - player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnTimeNotice", new Object[] { y, z })); - return true; - } - PP.setMySpawnATS(System.currentTimeMillis()); - if (PP.getMySpawn(player) != null) { - Location mySpawn = PP.getMySpawn(player); - - if (mySpawn != null) { - // It's done twice because it acts oddly when you are in another world - player.teleport(mySpawn); - player.teleport(mySpawn); - } - } else { - player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnNotExist")); - } - - return true; - } -} diff --git a/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java index b99943df2..22fa7cdf3 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java @@ -40,11 +40,6 @@ public class MccCommand implements CommandExecutor { player.sendMessage("/mcstats " + ChatColor.RED + " " + mcLocale.getString("m.mccStats")); player.sendMessage("/mctop " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards")); - if (mcPermissions.getInstance().mySpawn(player)) { - player.sendMessage("/myspawn " + ChatColor.RED + mcLocale.getString("m.mccMySpawn")); - player.sendMessage("/clearmyspawn " + ChatColor.RED + mcLocale.getString("m.mccClearMySpawn")); - } - if (mcPermissions.getInstance().mcAbility(player)) player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility")); diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java index 7b4b21c53..0932bbeb9 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -56,11 +56,6 @@ public class McremoveCommand implements CommandExecutor { +LoadProperties.MySQLtablePrefix+"huds WHERE " +LoadProperties.MySQLtablePrefix+"huds.user_id="+userId); - mcMMO.database.Write("DELETE FROM " - +LoadProperties.MySQLdbName+"." - +LoadProperties.MySQLtablePrefix+"spawn WHERE " - +LoadProperties.MySQLtablePrefix+"spawn.user_id="+userId); - mcMMO.database.Write("DELETE FROM " +LoadProperties.MySQLdbName+"." +LoadProperties.MySQLtablePrefix+"skills WHERE " diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index a252c7f9e..69b56da1c 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -40,11 +40,11 @@ public class LoadProperties { public static Boolean enableOnlyActivateWhenSneaking, enableAbilityMessages, enableAbilities, showDisplayName, showFaces, xplockEnable, xpbar, xpicon, partybar, xprateEnable, spoutEnabled, - donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, + donateMessage, chimaeraWingEnable, xpGainsMobSpawners, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, whoisEnable, mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable, mcremoveEnable, - clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, - addlevelsEnable, mcrefreshEnable, aEnable, pEnable, enableMotd, enableMySpawn, + mcgodEnable, mcabilityEnable, mctopEnable, + addlevelsEnable, mcrefreshEnable, aEnable, pEnable, enableMotd, enableCobbleToMossy, useMySQL, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, excavationRequiresShovel, woodcuttingrequiresaxe, anvilmessages, mayDowngradeEnchants, @@ -301,7 +301,6 @@ public class LoadProperties { locale = readString("General.Locale", "en_us"); enableMotd = readBoolean("General.MOTD.Enabled", true); - enableMySpawn = readBoolean("General.MySpawn.Enabled", true); saveInterval = readInteger("General.Save_Interval", 10); statsTracking = readBoolean("General.Stats_Tracking", true); eventCallback = readBoolean("General.Event_Callback", true); @@ -412,11 +411,9 @@ public class LoadProperties { mcremoveEnable = readBoolean("Commands.mcremove.Enable", true); ptpEnable = readBoolean("Commands.ptp.Enabled", true); partyEnable = readBoolean("Commands.party.Enabled", true); - myspawnEnable = readBoolean("Commands.myspawn.Enabled", true); whoisEnable = readBoolean("Commands.whois.Enabled", true); inviteEnable = readBoolean("Commands.invite.Enabled", true); acceptEnable = readBoolean("Commands.accept.Enabled", true); - clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true); aEnable = readBoolean("Commands.a.Enabled", true); pEnable = readBoolean("Commands.p.Enabled", true); diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index c18691946..ce81e210d 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -28,7 +28,6 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.GameMode; -import org.bukkit.Location; import org.bukkit.entity.Player; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.events.McMMOPlayerXpGainEvent; @@ -47,7 +46,7 @@ public class PlayerProfile private HUDType hud; //MISC - private String party, myspawn, myspawnworld, invite; + private String party, invite; //TOGGLES private boolean partyhud = true, spoutcraft = false, filling = false, xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, @@ -57,7 +56,7 @@ public class PlayerProfile //TIMESTAMPS //ATS = (Time of) Activation Time Stamp //DATS = (Time of) Deactivation Time Stamp - private int xpGainATS = 0, recentlyHurt = 0, mySpawnATS, respawnATS, hoePreparationATS, shovelPreparationATS, swordsPreparationATS, fistsPreparationATS, axePreparationATS, pickaxePreparationATS; + private int xpGainATS = 0, recentlyHurt = 0, respawnATS, hoePreparationATS, shovelPreparationATS, swordsPreparationATS, fistsPreparationATS, axePreparationATS, pickaxePreparationATS; private SkillType lastgained = null, skillLock = null; @@ -141,10 +140,7 @@ public class PlayerProfile } HashMap> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id); //lastlogin = Integer.parseInt(users.get(1).get(0)); - party = users.get(1).get(1); - HashMap> spawn = mcMMO.database.Read("SELECT world, x, y, z FROM "+LoadProperties.MySQLtablePrefix+"spawn WHERE user_id = " + id); - myspawnworld = spawn.get(1).get(0); - myspawn = spawn.get(1).get(1) + "," + spawn.get(1).get(2) + "," + spawn.get(1).get(3); + party = users.get(1).get(1); HashMap> cooldowns = mcMMO.database.Read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes FROM "+LoadProperties.MySQLtablePrefix+"cooldowns WHERE user_id = " + id); /* * I'm still learning MySQL, this is a fix for adding a new table @@ -224,9 +220,6 @@ public class PlayerProfile //Get Mining if(character.length > 1 && m.isInt(character[1])) skills.put(SkillType.MINING, Integer.valueOf(character[1])); - //Myspawn - if(character.length > 2) - myspawn = character[2]; //Party if(character.length > 3) party = character[3]; @@ -269,8 +262,6 @@ public class PlayerProfile skillsXp.put(SkillType.AXES, Integer.valueOf(character[21])); if(character.length > 22 && m.isInt(character[22])) skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(character[22])); - if(character.length > 23 && m.isInt(character[23])) - myspawnworld = character[23]; if(character.length > 24 && m.isInt(character[24])) skills.put(SkillType.TAMING, Integer.valueOf(character[24])); if(character.length > 25 && m.isInt(character[25])) @@ -324,7 +315,6 @@ public class PlayerProfile +" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid); - mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET " +" mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER) +", woodcutting = " + skillsDATS.get(AbilityType.TREE_FELLER) @@ -385,7 +375,7 @@ public class PlayerProfile } else { writer.append(playerName + ":"); writer.append(skills.get(SkillType.MINING) + ":"); - writer.append(myspawn + ":"); + writer.append("" + ":"); writer.append(party+":"); writer.append(skillsXp.get(SkillType.MINING) + ":"); writer.append(skills.get(SkillType.WOODCUTTING) + ":"); @@ -406,7 +396,7 @@ public class PlayerProfile writer.append(skillsXp.get(SkillType.SWORDS) + ":"); writer.append(skillsXp.get(SkillType.AXES) + ":"); writer.append(skillsXp.get(SkillType.ACROBATICS) + ":"); - writer.append(myspawnworld+":"); + writer.append(""+":"); writer.append(skills.get(SkillType.TAMING) + ":"); writer.append(skillsXp.get(SkillType.TAMING) + ":"); //Need to store the DATS of abilities nao @@ -452,9 +442,7 @@ public class PlayerProfile } //Misc stuff - myspawn = ""; party = ""; - myspawnworld = ""; save(); } @@ -469,7 +457,7 @@ public class PlayerProfile //Add the player to the end out.append(playerName + ":"); out.append(0 + ":"); //mining - out.append(myspawn+":"); + out.append(""+":"); out.append(party+":"); out.append(0+":"); //XP out.append(0+":"); //woodcutting @@ -490,7 +478,7 @@ public class PlayerProfile out.append(0+":"); //swordsXP out.append(0+":"); //axesXP out.append(0+":"); //acrobaticsXP - out.append(myspawnworld+":"); + out.append(""+":"); out.append(0+":"); //taming out.append(0+":"); //tamingXP out.append(0+":"); //DATS @@ -616,13 +604,6 @@ public class PlayerProfile { abilityuse = !abilityuse; } - public long getMySpawnATS(){ - return mySpawnATS; - } - public void setMySpawnATS(long newvalue) - { - mySpawnATS = (int) (newvalue/1000); - } public void decreaseBleedTicks() { bleedticks--; @@ -1167,74 +1148,11 @@ public class PlayerProfile return false; } } - public String getMySpawnWorld() - { - if(myspawnworld != null && !myspawnworld.equals("") && !myspawnworld.equals("null")){ - return myspawnworld; - } else { - return Bukkit.getServer().getWorlds().get(0).toString(); - } - } - //Save a users spawn location - public void setMySpawn(double x, double y, double z, String myspawnworldlocation){ - myspawn = x+","+y+","+z; - myspawnworld = myspawnworldlocation; - } - public String getX(){ - if(myspawn != null) - { - String[] split = myspawn.split(","); - return split[0]; - } - else - return null; - } - public String getY(){ - if(myspawn != null) - { - String[] split = myspawn.split(","); - return split[1]; - } - else - return null; - } - public String getZ(){ - if(myspawn != null) - { - String[] split = myspawn.split(","); - return split[2]; - } - else - return null; - } + public boolean isDead(){ return dead; } - public Location getMySpawn(Player player) - { - Location loc = null; - if(myspawn != null) - { - if(m.isDouble(getX()) && m.isDouble(getY()) && m.isDouble(getZ())) - loc = new Location(player.getWorld(),(Double.parseDouble(getX())), Double.parseDouble(getY()), Double.parseDouble(getZ())); - else - return null; - } else - return null; - - loc.setYaw(0); - loc.setPitch(0); - if(loc.getX() != 0 && loc.getY() != 0 && loc.getZ() != 0 && loc.getWorld() != null) - { - if(Bukkit.getServer().getWorld(this.getMySpawnWorld()) != null) - loc.setWorld(Bukkit.getServer().getWorld(this.getMySpawnWorld())); - else - loc.setWorld(Bukkit.getServer().getWorlds().get(0)); - return loc; - } else { - return null; - } - } + public String getPlayerName() { return playerName; diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index 96469b240..693514bdd 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -25,7 +25,6 @@ import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; @@ -142,18 +141,6 @@ public class mcBlockListener implements Listener if(event instanceof FakeBlockBreakEvent) return; - //Reset player spawn back to world spawn if their bed is destroyed. - if(block.getType().equals(Material.BED_BLOCK) && LoadProperties.enableMySpawn && PP.getMySpawn(player) != null) - { - if(PP.getMySpawn(player).getBlock().getType() != Material.BED_BLOCK) - { - double x = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getX(); - double y = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getY(); - double z = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getZ(); - String worldname = Bukkit.getServer().getWorlds().get(0).getName(); - PP.setMySpawn(x, y, z, worldname); - } - } /* * HERBALISM */ diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 8db89d9ef..6d15100b1 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -21,7 +21,6 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; @@ -45,7 +44,6 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerShearEntityEvent; import org.bukkit.inventory.ItemStack; @@ -71,7 +69,6 @@ import com.gmail.nossr50.skills.Skills; public class mcPlayerListener implements Listener { protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$ - public Location spawn = null; private mcMMO plugin; public mcPlayerListener(mcMMO instance) @@ -135,20 +132,6 @@ public class mcPlayerListener implements Listener if(Users.getProfile(event.getPlayer()).getBerserkMode()) event.setCancelled(true); } - - @EventHandler - public void onPlayerRespawn(PlayerRespawnEvent event) - { - Player player = event.getPlayer(); - PlayerProfile PP = Users.getProfile(player); - if(LoadProperties.enableMySpawn && mcPermissions.getInstance().mySpawn(player)) - { - PP.setRespawnATS(System.currentTimeMillis()); - Location mySpawn = PP.getMySpawn(player); - if(mySpawn != null) - event.setRespawnLocation(mySpawn); - } - } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerLogin(PlayerLoginEvent event) @@ -208,14 +191,6 @@ public class mcPlayerListener implements Listener if(action == Action.RIGHT_CLICK_BLOCK) { Material mat = block.getType(); - if(LoadProperties.enableMySpawn && block != null) - { - if(mat.equals(Material.BED_BLOCK) && mcPermissions.getInstance().setMySpawn(player)) - { - Location loc = player.getLocation(); - PP.setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName()); - } - } if(block != null && mcPermissions.getInstance().repair(player) && block.getTypeId() == LoadProperties.anvilID && (Repair.isTools(is) || Repair.isArmor(is))) { diff --git a/src/main/java/com/gmail/nossr50/m.java b/src/main/java/com/gmail/nossr50/m.java index df6359c36..1b768b92f 100644 --- a/src/main/java/com/gmail/nossr50/m.java +++ b/src/main/java/com/gmail/nossr50/m.java @@ -486,8 +486,6 @@ public class m + LoadProperties.MySQLtablePrefix + "users SET lastlogin = " + 0 + " WHERE id = " + id); - //if(getDouble(x) > 0 && getDouble(y) > 0 && getDouble(z) > 0) - //mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + myspawnworld + "', x = " +getDouble(x)+", y = "+getDouble(y)+", z = "+getDouble(z)+" WHERE user_id = "+id); mcMMO.database.Write("UPDATE " + LoadProperties.MySQLtablePrefix + "skills SET " + " taming = taming+" @@ -537,9 +535,6 @@ public class m + LoadProperties.MySQLtablePrefix + "users WHERE user = '" + playerName + "'"); - mcMMO.database.Write("INSERT INTO " - + LoadProperties.MySQLtablePrefix - + "spawn (user_id) VALUES (" + id + ")"); mcMMO.database.Write("INSERT INTO " + LoadProperties.MySQLtablePrefix + "skills (user_id) VALUES (" + id + ")"); @@ -556,10 +551,6 @@ public class m + LoadProperties.MySQLtablePrefix + "users SET party = '" + party + "' WHERE id = " + id); - /* - if(getDouble(x) > 0 && getDouble(y) > 0 && getDouble(z) > 0) - mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + myspawnworld + "', x = " +getDouble(x)+", y = "+getDouble(y)+", z = "+getDouble(z)+" WHERE user_id = "+id); - */ mcMMO.database.Write("UPDATE " + LoadProperties.MySQLtablePrefix + "skills SET " + " taming = " diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 006964e94..82d2d6348 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -315,10 +315,8 @@ public class mcMMO extends JavaPlugin //Other commands if(LoadProperties.addxpEnable) getCommand("addxp").setExecutor(new AddxpCommand(this)); if(LoadProperties.addlevelsEnable) getCommand("addlevels").setExecutor(new AddlevelsCommand(this)); - if(LoadProperties.clearmyspawnEnable) getCommand("clearmyspawn").setExecutor(new ClearmyspawnCommand()); if(LoadProperties.mmoeditEnable) getCommand("mmoedit").setExecutor(new MmoeditCommand(this)); getCommand("mmoupdate").setExecutor(new MmoupdateCommand()); - if(LoadProperties.myspawnEnable) getCommand("myspawn").setExecutor(new MyspawnCommand()); if(LoadProperties.mcstatsEnable) getCommand("mcstats").setExecutor(new McstatsCommand(this)); if(LoadProperties.whoisEnable) getCommand("whois").setExecutor(new WhoisCommand(this)); if(LoadProperties.xprateEnable) getCommand("xprate").setExecutor(new XprateCommand()); diff --git a/src/main/java/com/gmail/nossr50/mcPermissions.java b/src/main/java/com/gmail/nossr50/mcPermissions.java index f969f1738..568358361 100644 --- a/src/main/java/com/gmail/nossr50/mcPermissions.java +++ b/src/main/java/com/gmail/nossr50/mcPermissions.java @@ -70,12 +70,6 @@ public class mcPermissions public boolean mcAbility(Player player) { return player.hasPermission("mcmmo.commands.ability"); } - public boolean mySpawn(Player player) { - return player.hasPermission("mcmmo.commands.myspawn"); - } - public boolean setMySpawn(Player player) { - return player.hasPermission("mcmmo.commands.setmyspawn"); - } public boolean partyChat(Player player) { return player.hasPermission("mcmmo.chat.partychat"); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 2dfb7c374..ab809d65a 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -9,8 +9,6 @@ ### General: Locale: en_us - MySpawn: - Enabled: true MOTD: Enabled: true #Amount of time (in minutes) to wait between saves of player information @@ -1147,14 +1145,10 @@ Commands: Donate_Message: true mcrefresh: Enabled: true - myspawn: - Enabled: true addxp: Enabled: true addlevels: Enabled: true - clearmyspawn: - Enabled: true ptp: Enabled: true p: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index fc975514b..8d0790c34 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -49,9 +49,6 @@ commands: party: description: Create/join a party permission: mcmmo.commands.party - myspawn: - description: Teleport to your MySpawn - permission: mcmmo.commands.myspawn whois: description: View mcMMO stats of another player invite: @@ -60,9 +57,6 @@ commands: accept: description: Accept a party invite permission: mcmmo.chat.partychat - clearmyspawn: - description: Clear your MySpawn location - permission: mcmmo.commands.myspawn mmoupdate: description: Convert from Flat File to MySQL permission: mcmmo.admin @@ -176,18 +170,12 @@ permissions: mcmmo.commands.*: description: Implies all mcmmo.commands permissions. children: - mcmmo.commands.ability: true - mcmmo.commands.myspawn: true - mcmmo.commands.setmyspawn: true + mcmmo.commands.ability: true mcmmo.commands.ptp: true mcmmo.commands.whois: true mcmmo.commands.party: true mcmmo.commands.ability: description: - mcmmo.commands.myspawn: - description: - mcmmo.commands.setmyspawn: - description: mcmmo.commands.ptp: description: mcmmo.commands.whois: