Kill it with fire, part 1 - MySpawn

This commit is contained in:
GJ 2012-02-28 18:01:35 -05:00
parent e55006f662
commit e2d13034a8
15 changed files with 25 additions and 309 deletions

View File

@ -123,12 +123,6 @@ public class Database {
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0'," + "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," + "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); + "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+"skills2`");
Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"experience2`"); Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"experience2`");

View File

@ -16,16 +16,15 @@
*/ */
package com.gmail.nossr50; package com.gmail.nossr50;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin; 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; import com.gmail.nossr50.datatypes.PlayerProfile;
public class Item { public class Item {
@ -67,23 +66,18 @@ public class Item {
} }
} }
} }
if(PP.getMySpawn(player) != null)
{ if(player.getBedSpawnLocation() != null)
Location mySpawn = PP.getMySpawn(player); player.teleport(player.getBedSpawnLocation());
if(mySpawn != null){ else
player.teleport(mySpawn); //Do it twice to prevent weird stuff
player.teleport(mySpawn);
}
} else {
player.teleport(player.getWorld().getSpawnLocation()); player.teleport(player.getWorld().getSpawnLocation());
}
player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass")); //$NON-NLS-1$ player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass")); //$NON-NLS-1$
} else if (!Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) }
{ 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$ 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){ else if (is.getTypeId() == LoadProperties.chimaeraId && is.getAmount() <= itemsUsed)
player.sendMessage(mcLocale.getString("Item.NeedFeathers")); //$NON-NLS-1$ player.sendMessage(mcLocale.getString("Item.NeedFeathers")); //$NON-NLS-1$
} }
} }
}
} }

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -40,11 +40,6 @@ public class MccCommand implements CommandExecutor {
player.sendMessage("/mcstats " + ChatColor.RED + " " + mcLocale.getString("m.mccStats")); player.sendMessage("/mcstats " + ChatColor.RED + " " + mcLocale.getString("m.mccStats"));
player.sendMessage("/mctop <skillname> <page> " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards")); player.sendMessage("/mctop <skillname> <page> " + 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)) if (mcPermissions.getInstance().mcAbility(player))
player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility")); player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility"));

View File

@ -56,11 +56,6 @@ public class McremoveCommand implements CommandExecutor {
+LoadProperties.MySQLtablePrefix+"huds WHERE " +LoadProperties.MySQLtablePrefix+"huds WHERE "
+LoadProperties.MySQLtablePrefix+"huds.user_id="+userId); +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 " mcMMO.database.Write("DELETE FROM "
+LoadProperties.MySQLdbName+"." +LoadProperties.MySQLdbName+"."
+LoadProperties.MySQLtablePrefix+"skills WHERE " +LoadProperties.MySQLtablePrefix+"skills WHERE "

View File

@ -40,11 +40,11 @@ public class LoadProperties {
public static Boolean enableOnlyActivateWhenSneaking, public static Boolean enableOnlyActivateWhenSneaking,
enableAbilityMessages, enableAbilities, showDisplayName, showFaces, enableAbilityMessages, enableAbilities, showDisplayName, showFaces,
xplockEnable, xpbar, xpicon, partybar, xprateEnable, spoutEnabled, xplockEnable, xpbar, xpicon, partybar, xprateEnable, spoutEnabled,
donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, donateMessage, chimaeraWingEnable, xpGainsMobSpawners,
mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable,
whoisEnable, mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable, mcremoveEnable, whoisEnable, mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable, mcremoveEnable,
clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, mcgodEnable, mcabilityEnable, mctopEnable,
addlevelsEnable, mcrefreshEnable, aEnable, pEnable, enableMotd, enableMySpawn, addlevelsEnable, mcrefreshEnable, aEnable, pEnable, enableMotd,
enableCobbleToMossy, useMySQL, toolsLoseDurabilityFromAbilities, enableCobbleToMossy, useMySQL, toolsLoseDurabilityFromAbilities,
pvpxp, miningrequirespickaxe, excavationRequiresShovel, pvpxp, miningrequirespickaxe, excavationRequiresShovel,
woodcuttingrequiresaxe, anvilmessages, mayDowngradeEnchants, woodcuttingrequiresaxe, anvilmessages, mayDowngradeEnchants,
@ -301,7 +301,6 @@ public class LoadProperties {
locale = readString("General.Locale", "en_us"); locale = readString("General.Locale", "en_us");
enableMotd = readBoolean("General.MOTD.Enabled", true); enableMotd = readBoolean("General.MOTD.Enabled", true);
enableMySpawn = readBoolean("General.MySpawn.Enabled", true);
saveInterval = readInteger("General.Save_Interval", 10); saveInterval = readInteger("General.Save_Interval", 10);
statsTracking = readBoolean("General.Stats_Tracking", true); statsTracking = readBoolean("General.Stats_Tracking", true);
eventCallback = readBoolean("General.Event_Callback", true); eventCallback = readBoolean("General.Event_Callback", true);
@ -412,11 +411,9 @@ public class LoadProperties {
mcremoveEnable = readBoolean("Commands.mcremove.Enable", true); mcremoveEnable = readBoolean("Commands.mcremove.Enable", true);
ptpEnable = readBoolean("Commands.ptp.Enabled", true); ptpEnable = readBoolean("Commands.ptp.Enabled", true);
partyEnable = readBoolean("Commands.party.Enabled", true); partyEnable = readBoolean("Commands.party.Enabled", true);
myspawnEnable = readBoolean("Commands.myspawn.Enabled", true);
whoisEnable = readBoolean("Commands.whois.Enabled", true); whoisEnable = readBoolean("Commands.whois.Enabled", true);
inviteEnable = readBoolean("Commands.invite.Enabled", true); inviteEnable = readBoolean("Commands.invite.Enabled", true);
acceptEnable = readBoolean("Commands.accept.Enabled", true); acceptEnable = readBoolean("Commands.accept.Enabled", true);
clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true);
aEnable = readBoolean("Commands.a.Enabled", true); aEnable = readBoolean("Commands.a.Enabled", true);
pEnable = readBoolean("Commands.p.Enabled", true); pEnable = readBoolean("Commands.p.Enabled", true);

View File

@ -28,7 +28,6 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.events.McMMOPlayerXpGainEvent; import com.gmail.nossr50.events.McMMOPlayerXpGainEvent;
@ -47,7 +46,7 @@ public class PlayerProfile
private HUDType hud; private HUDType hud;
//MISC //MISC
private String party, myspawn, myspawnworld, invite; private String party, invite;
//TOGGLES //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, 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 //TIMESTAMPS
//ATS = (Time of) Activation Time Stamp //ATS = (Time of) Activation Time Stamp
//DATS = (Time of) Deactivation 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; private SkillType lastgained = null, skillLock = null;
@ -142,9 +141,6 @@ public class PlayerProfile
HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id); HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id);
//lastlogin = Integer.parseInt(users.get(1).get(0)); //lastlogin = Integer.parseInt(users.get(1).get(0));
party = users.get(1).get(1); party = users.get(1).get(1);
HashMap<Integer, ArrayList<String>> 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);
HashMap<Integer, ArrayList<String>> cooldowns = mcMMO.database.Read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes FROM "+LoadProperties.MySQLtablePrefix+"cooldowns WHERE user_id = " + id); HashMap<Integer, ArrayList<String>> 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 * I'm still learning MySQL, this is a fix for adding a new table
@ -224,9 +220,6 @@ public class PlayerProfile
//Get Mining //Get Mining
if(character.length > 1 && m.isInt(character[1])) if(character.length > 1 && m.isInt(character[1]))
skills.put(SkillType.MINING, Integer.valueOf(character[1])); skills.put(SkillType.MINING, Integer.valueOf(character[1]));
//Myspawn
if(character.length > 2)
myspawn = character[2];
//Party //Party
if(character.length > 3) if(character.length > 3)
party = character[3]; party = character[3];
@ -269,8 +262,6 @@ public class PlayerProfile
skillsXp.put(SkillType.AXES, Integer.valueOf(character[21])); skillsXp.put(SkillType.AXES, Integer.valueOf(character[21]));
if(character.length > 22 && m.isInt(character[22])) if(character.length > 22 && m.isInt(character[22]))
skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(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])) if(character.length > 24 && m.isInt(character[24]))
skills.put(SkillType.TAMING, Integer.valueOf(character[24])); skills.put(SkillType.TAMING, Integer.valueOf(character[24]));
if(character.length > 25 && m.isInt(character[25])) if(character.length > 25 && m.isInt(character[25]))
@ -324,7 +315,6 @@ public class PlayerProfile
+" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid); +" 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 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+"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 " mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET "
+" mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER) +" mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER)
+", woodcutting = " + skillsDATS.get(AbilityType.TREE_FELLER) +", woodcutting = " + skillsDATS.get(AbilityType.TREE_FELLER)
@ -385,7 +375,7 @@ public class PlayerProfile
} else { } else {
writer.append(playerName + ":"); writer.append(playerName + ":");
writer.append(skills.get(SkillType.MINING) + ":"); writer.append(skills.get(SkillType.MINING) + ":");
writer.append(myspawn + ":"); writer.append("" + ":");
writer.append(party+":"); writer.append(party+":");
writer.append(skillsXp.get(SkillType.MINING) + ":"); writer.append(skillsXp.get(SkillType.MINING) + ":");
writer.append(skills.get(SkillType.WOODCUTTING) + ":"); writer.append(skills.get(SkillType.WOODCUTTING) + ":");
@ -406,7 +396,7 @@ public class PlayerProfile
writer.append(skillsXp.get(SkillType.SWORDS) + ":"); writer.append(skillsXp.get(SkillType.SWORDS) + ":");
writer.append(skillsXp.get(SkillType.AXES) + ":"); writer.append(skillsXp.get(SkillType.AXES) + ":");
writer.append(skillsXp.get(SkillType.ACROBATICS) + ":"); writer.append(skillsXp.get(SkillType.ACROBATICS) + ":");
writer.append(myspawnworld+":"); writer.append(""+":");
writer.append(skills.get(SkillType.TAMING) + ":"); writer.append(skills.get(SkillType.TAMING) + ":");
writer.append(skillsXp.get(SkillType.TAMING) + ":"); writer.append(skillsXp.get(SkillType.TAMING) + ":");
//Need to store the DATS of abilities nao //Need to store the DATS of abilities nao
@ -452,9 +442,7 @@ public class PlayerProfile
} }
//Misc stuff //Misc stuff
myspawn = "";
party = ""; party = "";
myspawnworld = "";
save(); save();
} }
@ -469,7 +457,7 @@ public class PlayerProfile
//Add the player to the end //Add the player to the end
out.append(playerName + ":"); out.append(playerName + ":");
out.append(0 + ":"); //mining out.append(0 + ":"); //mining
out.append(myspawn+":"); out.append(""+":");
out.append(party+":"); out.append(party+":");
out.append(0+":"); //XP out.append(0+":"); //XP
out.append(0+":"); //woodcutting out.append(0+":"); //woodcutting
@ -490,7 +478,7 @@ public class PlayerProfile
out.append(0+":"); //swordsXP out.append(0+":"); //swordsXP
out.append(0+":"); //axesXP out.append(0+":"); //axesXP
out.append(0+":"); //acrobaticsXP out.append(0+":"); //acrobaticsXP
out.append(myspawnworld+":"); out.append(""+":");
out.append(0+":"); //taming out.append(0+":"); //taming
out.append(0+":"); //tamingXP out.append(0+":"); //tamingXP
out.append(0+":"); //DATS out.append(0+":"); //DATS
@ -616,13 +604,6 @@ public class PlayerProfile
{ {
abilityuse = !abilityuse; abilityuse = !abilityuse;
} }
public long getMySpawnATS(){
return mySpawnATS;
}
public void setMySpawnATS(long newvalue)
{
mySpawnATS = (int) (newvalue/1000);
}
public void decreaseBleedTicks() public void decreaseBleedTicks()
{ {
bleedticks--; bleedticks--;
@ -1167,74 +1148,11 @@ public class PlayerProfile
return false; 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(){ public boolean isDead(){
return dead; 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() public String getPlayerName()
{ {
return playerName; return playerName;

View File

@ -25,7 +25,6 @@ import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -142,18 +141,6 @@ public class mcBlockListener implements Listener
if(event instanceof FakeBlockBreakEvent) if(event instanceof FakeBlockBreakEvent)
return; 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 * HERBALISM
*/ */

View File

@ -21,7 +21,6 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; 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.PlayerLoginEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerShearEntityEvent; import org.bukkit.event.player.PlayerShearEntityEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -71,7 +69,6 @@ import com.gmail.nossr50.skills.Skills;
public class mcPlayerListener implements Listener public class mcPlayerListener implements Listener
{ {
protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$ protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$
public Location spawn = null;
private mcMMO plugin; private mcMMO plugin;
public mcPlayerListener(mcMMO instance) public mcPlayerListener(mcMMO instance)
@ -136,20 +133,6 @@ public class mcPlayerListener implements Listener
event.setCancelled(true); 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) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLogin(PlayerLoginEvent event) public void onPlayerLogin(PlayerLoginEvent event)
{ {
@ -208,14 +191,6 @@ public class mcPlayerListener implements Listener
if(action == Action.RIGHT_CLICK_BLOCK) if(action == Action.RIGHT_CLICK_BLOCK)
{ {
Material mat = block.getType(); 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))) if(block != null && mcPermissions.getInstance().repair(player) && block.getTypeId() == LoadProperties.anvilID && (Repair.isTools(is) || Repair.isArmor(is)))
{ {

View File

@ -486,8 +486,6 @@ public class m
+ LoadProperties.MySQLtablePrefix + LoadProperties.MySQLtablePrefix
+ "users SET lastlogin = " + 0 + "users SET lastlogin = " + 0
+ " WHERE id = " + id); + " 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 " mcMMO.database.Write("UPDATE "
+ LoadProperties.MySQLtablePrefix + LoadProperties.MySQLtablePrefix
+ "skills SET " + " taming = taming+" + "skills SET " + " taming = taming+"
@ -537,9 +535,6 @@ public class m
+ LoadProperties.MySQLtablePrefix + LoadProperties.MySQLtablePrefix
+ "users WHERE user = '" + "users WHERE user = '"
+ playerName + "'"); + playerName + "'");
mcMMO.database.Write("INSERT INTO "
+ LoadProperties.MySQLtablePrefix
+ "spawn (user_id) VALUES (" + id + ")");
mcMMO.database.Write("INSERT INTO " mcMMO.database.Write("INSERT INTO "
+ LoadProperties.MySQLtablePrefix + LoadProperties.MySQLtablePrefix
+ "skills (user_id) VALUES (" + id + ")"); + "skills (user_id) VALUES (" + id + ")");
@ -556,10 +551,6 @@ public class m
+ LoadProperties.MySQLtablePrefix + LoadProperties.MySQLtablePrefix
+ "users SET party = '" + party + "users SET party = '" + party
+ "' WHERE id = " + id); + "' 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 " mcMMO.database.Write("UPDATE "
+ LoadProperties.MySQLtablePrefix + LoadProperties.MySQLtablePrefix
+ "skills SET " + " taming = " + "skills SET " + " taming = "

View File

@ -315,10 +315,8 @@ public class mcMMO extends JavaPlugin
//Other commands //Other commands
if(LoadProperties.addxpEnable) getCommand("addxp").setExecutor(new AddxpCommand(this)); if(LoadProperties.addxpEnable) getCommand("addxp").setExecutor(new AddxpCommand(this));
if(LoadProperties.addlevelsEnable) getCommand("addlevels").setExecutor(new AddlevelsCommand(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)); if(LoadProperties.mmoeditEnable) getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
getCommand("mmoupdate").setExecutor(new MmoupdateCommand()); getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
if(LoadProperties.myspawnEnable) getCommand("myspawn").setExecutor(new MyspawnCommand());
if(LoadProperties.mcstatsEnable) getCommand("mcstats").setExecutor(new McstatsCommand(this)); if(LoadProperties.mcstatsEnable) getCommand("mcstats").setExecutor(new McstatsCommand(this));
if(LoadProperties.whoisEnable) getCommand("whois").setExecutor(new WhoisCommand(this)); if(LoadProperties.whoisEnable) getCommand("whois").setExecutor(new WhoisCommand(this));
if(LoadProperties.xprateEnable) getCommand("xprate").setExecutor(new XprateCommand()); if(LoadProperties.xprateEnable) getCommand("xprate").setExecutor(new XprateCommand());

View File

@ -70,12 +70,6 @@ public class mcPermissions
public boolean mcAbility(Player player) { public boolean mcAbility(Player player) {
return player.hasPermission("mcmmo.commands.ability"); 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) { public boolean partyChat(Player player) {
return player.hasPermission("mcmmo.chat.partychat"); return player.hasPermission("mcmmo.chat.partychat");
} }

View File

@ -9,8 +9,6 @@
### ###
General: General:
Locale: en_us Locale: en_us
MySpawn:
Enabled: true
MOTD: MOTD:
Enabled: true Enabled: true
#Amount of time (in minutes) to wait between saves of player information #Amount of time (in minutes) to wait between saves of player information
@ -1147,14 +1145,10 @@ Commands:
Donate_Message: true Donate_Message: true
mcrefresh: mcrefresh:
Enabled: true Enabled: true
myspawn:
Enabled: true
addxp: addxp:
Enabled: true Enabled: true
addlevels: addlevels:
Enabled: true Enabled: true
clearmyspawn:
Enabled: true
ptp: ptp:
Enabled: true Enabled: true
p: p:

View File

@ -49,9 +49,6 @@ commands:
party: party:
description: Create/join a party description: Create/join a party
permission: mcmmo.commands.party permission: mcmmo.commands.party
myspawn:
description: Teleport to your MySpawn
permission: mcmmo.commands.myspawn
whois: whois:
description: View mcMMO stats of another player description: View mcMMO stats of another player
invite: invite:
@ -60,9 +57,6 @@ commands:
accept: accept:
description: Accept a party invite description: Accept a party invite
permission: mcmmo.chat.partychat permission: mcmmo.chat.partychat
clearmyspawn:
description: Clear your MySpawn location
permission: mcmmo.commands.myspawn
mmoupdate: mmoupdate:
description: Convert from Flat File to MySQL description: Convert from Flat File to MySQL
permission: mcmmo.admin permission: mcmmo.admin
@ -177,17 +171,11 @@ permissions:
description: Implies all mcmmo.commands permissions. description: Implies all mcmmo.commands permissions.
children: children:
mcmmo.commands.ability: true mcmmo.commands.ability: true
mcmmo.commands.myspawn: true
mcmmo.commands.setmyspawn: true
mcmmo.commands.ptp: true mcmmo.commands.ptp: true
mcmmo.commands.whois: true mcmmo.commands.whois: true
mcmmo.commands.party: true mcmmo.commands.party: true
mcmmo.commands.ability: mcmmo.commands.ability:
description: description:
mcmmo.commands.myspawn:
description:
mcmmo.commands.setmyspawn:
description:
mcmmo.commands.ptp: mcmmo.commands.ptp:
description: description:
mcmmo.commands.whois: mcmmo.commands.whois: