From 78f79213cdd7190cd11ae54526f3b4ea42078e8a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 20 Aug 2011 18:23:38 -0700 Subject: [PATCH] Release of 1.1.06 --- mcMMO/Changelog.txt | 17 +-- mcMMO/com/gmail/nossr50/Combat.java | 2 +- mcMMO/com/gmail/nossr50/Database.java | 3 + .../gmail/nossr50/config/LoadProperties.java | 113 +++++++++++++++++- mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java | 74 ++++++++---- .../nossr50/datatypes/PlayerProfile.java | 27 +++++ .../datatypes/buttons/ButtonEscape.java | 13 ++ .../datatypes/buttons/ButtonHUDStyle.java | 2 +- .../nossr50/datatypes/popups/PopupMMO.java | 6 + .../listeners/mcSpoutInputListener.java | 4 +- .../listeners/mcSpoutScreenListener.java | 17 +++ .../com/gmail/nossr50/skills/Excavation.java | 5 +- mcMMO/com/gmail/nossr50/spout/SpoutStuff.java | 24 ++-- 13 files changed, 247 insertions(+), 60 deletions(-) create mode 100644 mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 697503f51..e7cd2b2cf 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,25 +1,18 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code Version 1.1.06 +mcMMO menu implemented! Default is 'M', change this in config Retro HUD implemented! +Retro XP fill color is completely customizable on a per skill basis +New levelup sound thanks to @Rustydaggers ! With the help of Randomage the XP Formulas have been vastly changed for flexibility Global modifiers and skill modifiers now support decimals Global formula modifier dropped from config GigaDrillBreaker/Berserk doesn't drop clay blocks anymore Fixed bug where Herbalism didn't heal more for bread/stew when right clicking a block Fixed bug where Wheat did not use the values form the config file - -TODO: - Add full customization of the colors - Fix Archery exploit - Fix the NPE with theType - Permission nodes for Spout elements - Small HUD style - HUD persistence - Maybe incorporate mmoParty - -In order to streamline the configuration of how XP/Levels are gained, we rewrote the formulas, it is paramount to understand that from a game perspective that does NOT change how fast you level up, it just changes how easy it is to configure the system, current configuration files will be automatically updated maintaining your selected leveling speed - +Fixed bug where Archery gave xp for inflicting self injury +Watch added to clay loot tables and maps remove from clay loot tables Version 1.1.05 Maps dropped from excavation are created correctly, and represent the area they are found in diff --git a/mcMMO/com/gmail/nossr50/Combat.java b/mcMMO/com/gmail/nossr50/Combat.java index 038766d60..8c27663dc 100644 --- a/mcMMO/com/gmail/nossr50/Combat.java +++ b/mcMMO/com/gmail/nossr50/Combat.java @@ -372,7 +372,7 @@ public class Combat * PVP XP */ if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender) - && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis()) + && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis() && !attacker.getName().equals(defender.getName())) { int xp = (int) ((event.getDamage() * 2) * 10); PPa.addXP(SkillType.ARCHERY, xp); diff --git a/mcMMO/com/gmail/nossr50/Database.java b/mcMMO/com/gmail/nossr50/Database.java index 0d56f1a84..831717dd9 100644 --- a/mcMMO/com/gmail/nossr50/Database.java +++ b/mcMMO/com/gmail/nossr50/Database.java @@ -42,6 +42,9 @@ public class Database { } //Create the DB structure public void createStructure(){ + Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"huds` (`user_id` int(10) unsigned NOT NULL," + + "`hudtype` varchar(50) NOT NULL DEFAULT 'STANDARD'," + + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," + "`user` varchar(40) NOT NULL," + "`lastlogin` int(32) unsigned NOT NULL," + diff --git a/mcMMO/com/gmail/nossr50/config/LoadProperties.java b/mcMMO/com/gmail/nossr50/config/LoadProperties.java index a6a7a5525..0ca5454c0 100644 --- a/mcMMO/com/gmail/nossr50/config/LoadProperties.java +++ b/mcMMO/com/gmail/nossr50/config/LoadProperties.java @@ -2,10 +2,11 @@ package com.gmail.nossr50.config; import java.io.File; import org.bukkit.util.config.Configuration; +import org.getspout.spoutapi.keyboard.Keyboard; public class LoadProperties { - public static Boolean xplockEnable, xpbar, xpicon, partybar, map, string, bucket, web, xprateEnable, slimeballs, spoutEnabled, + public static Boolean watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web, xprateEnable, slimeballs, spoutEnabled, donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, @@ -16,7 +17,7 @@ public class LoadProperties xprate, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood, nStone, nIron, nGold, nDiamond, locale; - public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y, partybar_x, partybar_y, partybar_spacing, mmap, mstring, mbucket, mweb, + public static int mwatch, xpbar_x, xpbar_y, xpicon_x, xpicon_y, partybar_x, partybar_y, partybar_spacing, mstring, mbucket, mweb, archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mslimeballs, mbones, msulphur, mslowsand, mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, @@ -24,11 +25,17 @@ public class LoadProperties berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond; - public static double pvpxprewardmodifier, tamingxpmodifier, miningxpmodifier, + public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r, archery_g, archery_b, axes_r, axes_g, axes_b, + excavation_r, excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b, mining_r, mining_g, mining_b, + repair_r, repair_g, repair_b, swords_r, swords_g, swords_b, taming_r, taming_g, taming_b, unarmed_r, unarmed_g, unarmed_b, + woodcutting_r, woodcutting_g, woodcutting_b, pvpxprewardmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public String directory = "plugins/mcMMO/"; + + public static Keyboard keypress; + File file = new File(directory + File.separator + "config.yml"); Configuration config = null; @@ -115,6 +122,46 @@ public class LoadProperties write("Spout.Party.HP.X_POS", -11); write("Spout.Party.HP.Y_POS", 0); write("Spout.Party.HP.SPACING", 16); + write("Spout.Menu.Key", "KEY_M"); + write("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); + write("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Archery.RED", 0.3); + write("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Axes.RED", 0.3); + write("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); + write("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); + write("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Mining.RED", 0.3); + write("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Repair.RED", 0.3); + write("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Swords.RED", 0.3); + write("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Taming.RED", 0.3); + write("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); + write("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); + write("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); + write("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); + write("Spout.HUD.Retro.Colors.Border.RED", 0.0); + write("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); + write("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); + write("Spout.HUD.Retro.Colors.Background.RED", 0.75); + write("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); + write("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); write("MySQL.Enabled", false); write("MySQL.Server.Address", "localhost"); @@ -282,6 +329,21 @@ public class LoadProperties { System.out.println("Loading Config File..."); + String temp = readString("Spout.Menu.Key", "KEY_M"); + + for(Keyboard x : Keyboard.values()) + { + if(x.toString().equalsIgnoreCase(temp)) + { + keypress = x; + } + } + + if(keypress == null) + { + System.out.println("Invalid KEY for Spout.Menu.Key, using KEY_M"); + keypress = Keyboard.KEY_M; + } donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true); xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false); @@ -297,6 +359,47 @@ public class LoadProperties partybar_y = readInteger("Spout.Party.HP.Y_POS", 0); partybar_spacing = readInteger("Spout.Party.HP.SPACING", 16); + acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); + acrobatics_g = readDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); + acrobatics_b = readDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); + archery_r = readDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); + archery_g = readDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); + archery_b = readDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); + axes_r = readDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); + axes_g = readDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); + axes_b = readDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); + excavation_r = readDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); + excavation_g = readDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); + excavation_b = readDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); + herbalism_r = readDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); + herbalism_g = readDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); + herbalism_b = readDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); + mining_r = readDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); + mining_g = readDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); + mining_b = readDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); + repair_r = readDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); + repair_g = readDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); + repair_b = readDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); + swords_r = readDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); + swords_g = readDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); + swords_b = readDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); + taming_r = readDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); + taming_g = readDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); + taming_b = readDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); + unarmed_r = readDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); + unarmed_g = readDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); + unarmed_b = readDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); + woodcutting_r = readDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); + woodcutting_g = readDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); + woodcutting_b = readDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); + + xpborder_r = readDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); + xpborder_g = readDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); + xpborder_b = readDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); + xpbackground_r = readDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); + xpbackground_g = readDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); + xpbackground_b = readDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); + msulphur = readInteger("Experience.Excavation.Sulphur", 30); mbones = readInteger("Experience.Excavation.Bones", 30); mbase = readInteger("Experience.Excavation.Base", 40); @@ -313,7 +416,7 @@ public class LoadProperties mstring = readInteger("Experience.Excavation.String", 200); mbucket = readInteger("Experience.Excavation.Bucket", 100); mweb = readInteger("Experience.Excavation.Web", 150); - mmap = readInteger("Experience.Excavation.Map", 200); + mwatch = readInteger("Experience.Excavation.Watch", 200); msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30); mwheat = readInteger("Experience.Herbalism.Wheat", 50); @@ -420,7 +523,7 @@ public class LoadProperties netherrack = readBoolean("Excavation.Drops.Netherrack", true); bones = readBoolean("Excavation.Drops.Bones", true); slimeballs = readBoolean("Excavation.Drops.Slimeballs", true); - map = readBoolean("Excavation.Drops.Map", true); + watch = readBoolean("Excavation.Drops.Watch", true); string = readBoolean("Excavation.Drops.String", true); bucket = readBoolean("Excavation.Drops.Bucket", true); web = readBoolean("Excavation.Drops.Web", true); diff --git a/mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java b/mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java index 13ae4f64c..b47cf6144 100644 --- a/mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java +++ b/mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java @@ -18,10 +18,15 @@ import com.gmail.nossr50.spout.SpoutStuff; public class HUDmmo { + int center_x = 427/2; + int center_y = 240/2; + String playerName = null; Widget xpbar = null; GenericGradient xpfill = null; GenericGradient xpbg = null; + GenericGradient xpicon_bg = null; + GenericGradient xpicon_border = null; GenericTexture xpicon = null; mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO"); @@ -30,6 +35,7 @@ public class HUDmmo playerName = player.getName(); initializeHUD(player); } + public void initializeHUD(Player player) { HUDType type = Users.getProfile(player).getHUDType(); @@ -69,6 +75,7 @@ public class HUDmmo } case SMALL: { + updateXpBarStandard(player, Users.getProfile(player)); break; } } @@ -87,37 +94,52 @@ public class HUDmmo xpbg = null; xpicon = null; + if(SpoutStuff.partyHealthBars.containsKey(sPlayer)) + { + SpoutStuff.partyHealthBars.remove(sPlayer); + if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty()) + SpoutStuff.initializePartyTracking(sPlayer); + } + sPlayer.getMainScreen().setDirty(true); } } private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer) { - Color black = new Color(0, 0, 0, 1f); + Color border = new Color((float)LoadProperties.xpborder_r, (float)LoadProperties.xpborder_g, (float)LoadProperties.xpborder_b, 1f); Color green = new Color(0, 1f, 0, 1f); - Color gray = new Color(0.75f, 0.75f, 0.75f, 1f); - + Color background = new Color((float)LoadProperties.xpbackground_r, (float)LoadProperties.xpbackground_g, (float)LoadProperties.xpbackground_b, 1f); + Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f); xpicon = new GenericTexture(); xpbar = new GenericGradient(); xpfill = new GenericGradient(); xpbg = new GenericGradient(); - xpicon.setWidth(6).setHeight(6).setX(149-6).setY(9).setDirty(true); + xpicon_bg = new GenericGradient(); + xpicon_border = new GenericGradient(); + + xpicon_bg.setBottomColor(darkbg).setTopColor(darkbg).setWidth(4).setHeight(4).setPriority(RenderPriority.High).setX(142).setY(10).setDirty(true); + xpicon_border.setBottomColor(border).setTopColor(border).setWidth(6).setHeight(6).setPriority(RenderPriority.Highest).setX(141).setY(9).setDirty(true); + + xpicon.setWidth(6).setHeight(6).setX(141).setY(9).setPriority(RenderPriority.Normal).setDirty(true); xpicon.setUrl(LoadProperties.web_url+"HUD/Retro/Icon_r.png"); xpbar.setWidth(128).setHeight(4).setX(149).setY(10); - ((GenericGradient) xpbar).setBottomColor(black).setTopColor(black).setPriority(RenderPriority.Highest).setDirty(true); + ((GenericGradient) xpbar).setBottomColor(border).setTopColor(border).setPriority(RenderPriority.Highest).setDirty(true); xpfill.setWidth(0).setHeight(2).setX(150).setY(11); xpfill.setBottomColor(green).setTopColor(green).setPriority(RenderPriority.Lowest).setDirty(true); xpbg.setWidth(126).setHeight(2).setX(150).setY(11); - xpbg.setBottomColor(gray).setTopColor(gray).setPriority(RenderPriority.Low).setDirty(true); + xpbg.setBottomColor(background).setTopColor(background).setPriority(RenderPriority.Low).setDirty(true); sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbar); sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpfill); sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbg); sPlayer.getMainScreen().attachWidget(plugin, (GenericTexture)xpicon); + sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_bg); + sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_border); sPlayer.getMainScreen().setDirty(true); } @@ -150,18 +172,26 @@ public class HUDmmo private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) { - //Coordinates 240, 427 are the bottom right. - GenericTexture xpbar = new GenericTexture(); - GenericTexture xpbar_fill = new GenericTexture(); + //Setup xp bar + xpbar = new GenericTexture(); - xpbar.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar.png"); - xpbar_fill.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar_fill.png"); + if(LoadProperties.xpicon) + { + xpicon = new GenericTexture(); + + xpicon.setUrl(LoadProperties.web_url+"HUD/Standard/Icon.png"); + + xpicon.setHeight(8).setWidth(16).setX(center_x-(8+64)).setY(LoadProperties.xpicon_y+2); + + xpicon.setDirty(true); + + sPlayer.getMainScreen().attachWidget(plugin, xpicon); + } - xpbar.setWidth(128).setHeight(4).setX(149).setY(10).setDirty(true); - xpbar_fill.setWidth(2).setHeight(2).setX(150).setY(11).setPriority(RenderPriority.High).setDirty(true); + ((GenericTexture)xpbar).setUrl(LoadProperties.web_url+"HUD/Standard/xpbar_inc000.png"); + xpbar.setX(center_x-64).setY(LoadProperties.xpbar_y).setHeight(4).setWidth(128); sPlayer.getMainScreen().attachWidget(plugin, xpbar); - sPlayer.getMainScreen().attachWidget(plugin, xpbar_fill); sPlayer.getMainScreen().setDirty(true); } @@ -175,6 +205,9 @@ public class HUDmmo else theType=PP.getLastGained(); + if(theType == null) + return; + ((GenericTexture) xpicon).setUrl(LoadProperties.web_url+"HUD/Standard/"+m.getCapitalized(theType.toString())+".png"); xpicon.setDirty(true); @@ -183,6 +216,7 @@ public class HUDmmo SpoutManager.getPlayer(player).getMainScreen().setDirty(true); } + private void updateXpBarRetro(Player player, PlayerProfile PP) { SkillType theType = null; @@ -192,17 +226,13 @@ public class HUDmmo else theType=PP.getLastGained(); - Color color = new Color(0.3f, 0.3f, 0.75f, 1f); + if(theType == null) + return; + + Color color = SpoutStuff.getRetroColor(theType); if(xpicon != null && theType != null) xpicon.setUrl(LoadProperties.web_url+"HUD/Retro/"+m.getCapitalized(theType.toString())+"_r.png"); - else - { - if(xpicon == null) - System.out.println("xpicon was null!"); - if(theType == null) - System.out.println("theType was null!"); - } if(theType != null) xpfill.setBottomColor(color).setTopColor(color).setWidth(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true); diff --git a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java index 592c5b0bd..e62d9839b 100644 --- a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -103,6 +103,19 @@ public class PlayerProfile return false; this.userid = id; if (id > 0) { + HashMap> huds = mcMMO.database.Read("SELECT hudtype FROM "+LoadProperties.MySQLtablePrefix+"huds WHERE user_id = " + id); + if(huds.get(1) == null) + { + mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"huds (user_id) VALUES ("+id+")"); + } else { + for(HUDType x : HUDType.values()) + { + if(x.toString().equals(huds.get(1).get(0))) + { + hud = x; + } + } + } 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); @@ -251,6 +264,16 @@ public class PlayerProfile skullSplitterDATS = Integer.valueOf(character[31]); if(character.length > 32) superBreakerDATS = Integer.valueOf(character[32]); + if(character.length > 33) + { + for(HUDType x : HUDType.values()) + { + if(x.toString().equals(character[33])) + { + hud = x; + } + } + } in.close(); return true; } @@ -268,6 +291,8 @@ public class PlayerProfile // if we are using mysql save to database if (LoadProperties.useMySQL) { + mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"huds SET " + +" 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); @@ -363,6 +388,7 @@ public class PlayerProfile writer.append(String.valueOf(serratedStrikesDATS)+":"); writer.append(String.valueOf(skullSplitterDATS)+":"); writer.append(String.valueOf(superBreakerDATS)+":"); + writer.append(hud.toString()+":"); writer.append("\r\n"); } } @@ -417,6 +443,7 @@ public class PlayerProfile out.append(0+":"); //DATS out.append(0+":"); //DATS out.append(0+":"); //DATS + out.append("STANDARD"+":");//HUD //Add more in the same format as the line above diff --git a/mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java b/mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java new file mode 100644 index 000000000..c25f6826b --- /dev/null +++ b/mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java @@ -0,0 +1,13 @@ +package com.gmail.nossr50.datatypes.buttons; + +import org.getspout.spoutapi.gui.GenericButton; + +public class ButtonEscape extends GenericButton +{ + public ButtonEscape() + { + this.setText("EXIT"); + this.setWidth(60).setHeight(20); + this.setDirty(true); + } +} \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java b/mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java index bca8a6de8..53c708e4d 100644 --- a/mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java +++ b/mcMMO/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java @@ -18,4 +18,4 @@ public class ButtonHUDStyle extends GenericButton this.setText("HUD Type: "+PP.getHUDType().toString()); this.setDirty(true); } -} +} \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/datatypes/popups/PopupMMO.java b/mcMMO/com/gmail/nossr50/datatypes/popups/PopupMMO.java index c4538a5d3..8d7c7094a 100644 --- a/mcMMO/com/gmail/nossr50/datatypes/popups/PopupMMO.java +++ b/mcMMO/com/gmail/nossr50/datatypes/popups/PopupMMO.java @@ -6,11 +6,13 @@ import org.getspout.spoutapi.gui.GenericLabel; import org.getspout.spoutapi.gui.GenericPopup; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.buttons.ButtonEscape; import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle; public class PopupMMO extends GenericPopup { ButtonHUDStyle HUDButton = null; + ButtonEscape EscapeButton = null; GenericLabel mcMMO_label = new GenericLabel(); GenericLabel tip_escape = new GenericLabel(); int center_x = 427/2; @@ -28,9 +30,13 @@ public class PopupMMO extends GenericPopup HUDButton = new ButtonHUDStyle(PP); HUDButton.setX(center_x-(HUDButton.getWidth()/2)).setY(center_y/2).setDirty(true); + EscapeButton = new ButtonEscape(); + EscapeButton.setX(center_x-(EscapeButton.getWidth()/2)).setY((center_y/2)+HUDButton.getHeight()+5).setDirty(true); + this.attachWidget(plugin, HUDButton); this.attachWidget(plugin, mcMMO_label); this.attachWidget(plugin, tip_escape); + this.attachWidget(plugin, EscapeButton); this.setDirty(true); } diff --git a/mcMMO/com/gmail/nossr50/listeners/mcSpoutInputListener.java b/mcMMO/com/gmail/nossr50/listeners/mcSpoutInputListener.java index dd315d6e6..0e8dd1a75 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcSpoutInputListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcSpoutInputListener.java @@ -3,11 +3,11 @@ package com.gmail.nossr50.listeners; import org.getspout.spoutapi.event.input.InputListener; import org.getspout.spoutapi.event.input.KeyPressedEvent; import org.getspout.spoutapi.gui.ScreenType; -import org.getspout.spoutapi.keyboard.Keyboard; import org.getspout.spoutapi.player.SpoutPlayer; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.popups.PopupMMO; import com.gmail.nossr50.spout.SpoutStuff; @@ -29,7 +29,7 @@ public class mcSpoutInputListener extends InputListener SpoutPlayer sPlayer = event.getPlayer(); - if(event.getKey() == Keyboard.KEY_M) + if(event.getKey() == LoadProperties.keypress) { if(!SpoutStuff.playerScreens.containsKey(sPlayer)) { diff --git a/mcMMO/com/gmail/nossr50/listeners/mcSpoutScreenListener.java b/mcMMO/com/gmail/nossr50/listeners/mcSpoutScreenListener.java index 417fa93b7..0bd3bb643 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcSpoutScreenListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcSpoutScreenListener.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.listeners; import org.getspout.spoutapi.event.screen.ButtonClickEvent; +import org.getspout.spoutapi.event.screen.ScreenCloseEvent; import org.getspout.spoutapi.event.screen.ScreenListener; import org.getspout.spoutapi.player.SpoutPlayer; @@ -9,7 +10,9 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.HUDType; import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.buttons.ButtonEscape; import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle; +import com.gmail.nossr50.datatypes.popups.PopupMMO; import com.gmail.nossr50.spout.SpoutStuff; public class mcSpoutScreenListener extends ScreenListener @@ -37,6 +40,9 @@ public class mcSpoutScreenListener extends ScreenListener PP.setHUDType(HUDType.STANDARD); break; case STANDARD: + PP.setHUDType(HUDType.SMALL); + break; + case SMALL: PP.setHUDType(HUDType.RETRO); break; } @@ -45,6 +51,17 @@ public class mcSpoutScreenListener extends ScreenListener SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP); } + } else if (event.getButton() instanceof ButtonEscape) + { + sPlayer.getMainScreen().closePopup(); + } + } + + public void onScreenClose(ScreenCloseEvent event) + { + if(event.getScreen() instanceof PopupMMO) + { + SpoutStuff.playerScreens.remove(event.getPlayer()); } } } \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/skills/Excavation.java b/mcMMO/com/gmail/nossr50/skills/Excavation.java index a2970cdf0..5483ac198 100644 --- a/mcMMO/com/gmail/nossr50/skills/Excavation.java +++ b/mcMMO/com/gmail/nossr50/skills/Excavation.java @@ -1,13 +1,11 @@ package com.gmail.nossr50.skills; import java.util.ArrayList; -import org.bukkit.Bukkit; 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.map.MapView; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; @@ -148,9 +146,8 @@ public class Excavation { if(Math.random() * 100 > 99) { - MapView mv = Bukkit.getServer().createMap(loc.getWorld()); xp+= LoadProperties.mwatch; - is.add(new ItemStack(Material.WATCH, 1, mv.getId())); + is.add(new ItemStack(Material.WATCH, 1, (byte)0)); } } if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500) diff --git a/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java b/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java index 2781a5aaa..e95bb8df2 100644 --- a/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java +++ b/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java @@ -44,8 +44,6 @@ public class SpoutStuff public static HashMap> partyHealthBars = new HashMap>(); public static HashMap playerScreens = new HashMap(); - - public static void registerCustomEvent() { Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin); @@ -58,29 +56,29 @@ public class SpoutStuff switch(type) { case ACROBATICS: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float) LoadProperties.acrobatics_r, (float) LoadProperties.acrobatics_g, (float) LoadProperties.acrobatics_b, 1); case ARCHERY: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float) LoadProperties.archery_r, (float)LoadProperties.archery_g, (float)LoadProperties.archery_b, 1f); case AXES: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float) LoadProperties.axes_r, (float)LoadProperties.axes_g, (float)LoadProperties.axes_b, 1f); case EXCAVATION: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.excavation_r, (float)LoadProperties.excavation_g, (float)LoadProperties.excavation_b, 1f); case HERBALISM: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.herbalism_r, (float)LoadProperties.herbalism_g, (float)LoadProperties.herbalism_b, 1f); case MINING: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.mining_r, (float)LoadProperties.mining_g, (float)LoadProperties.mining_b, 1f); case REPAIR: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.repair_r, (float)LoadProperties.repair_g, (float)LoadProperties.repair_b, 1f); case SORCERY: return new Color(0.3f, 0.3f, 0.75f, 1f); case SWORDS: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.swords_r, (float)LoadProperties.swords_g, (float)LoadProperties.swords_b, 1f); case TAMING: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.taming_r, (float)LoadProperties.taming_g, (float)LoadProperties.taming_b, 1f); case UNARMED: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.unarmed_r, (float)LoadProperties.unarmed_g, (float)LoadProperties.unarmed_b, 1f); case WOODCUTTING: - return new Color(0.3f, 0.3f, 0.75f, 1f); + return new Color((float)LoadProperties.woodcutting_r, (float)LoadProperties.woodcutting_g, (float)LoadProperties.woodcutting_b, 1f); default: return new Color(0.3f, 0.3f, 0.75f, 1f); }