mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
New stuff :)
This commit is contained in:
parent
64e7bb4213
commit
16ca9c8aa7
@ -2,14 +2,17 @@ Changelog:
|
||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
||||
Version 1.0.51
|
||||
Brand new XP Bars and Skill Icons designed by BrandonXP
|
||||
Noises added to leveling
|
||||
Repairing metal now has a sound effect
|
||||
Leveling up now has a sound effect
|
||||
MySpawn now works correctly when you are in the nether
|
||||
MySpawn message when you right click a bed is now squelched
|
||||
Intervals at which players renegerate hp have doubled in length
|
||||
Intervals at which players renegerate hp have doubled in length (making it take 100% longer to regenerate than before)
|
||||
Rewrote many variables stored per player to be integer instead of long, reducing overall memory usage of mcMMO
|
||||
Rewrote the Timer mcMMO relies on to instead use the BukkitScheduler for performance
|
||||
Fixed the party member list of /party
|
||||
Removed a debug message when repairing diamond armor
|
||||
Changed chat to use getDisplayName() instead of getName()
|
||||
Changed chat priority from lowest to highest
|
||||
|
||||
Version 1.0.50
|
||||
New /xprate command for those with mcmmo.admin permissions!
|
||||
|
@ -25,6 +25,7 @@ import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class Commands
|
||||
{
|
||||
@ -1213,8 +1214,15 @@ public class Commands
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyMembers")+" ("+tempList+ChatColor.GREEN+")");
|
||||
return true;
|
||||
} else if(args.length == 1){
|
||||
if(args[0].equals("q") && PP.inParty()) {
|
||||
if(args[0].equals("q") && PP.inParty())
|
||||
{
|
||||
ArrayList<Player> partymembers = Party.getInstance().getPartyMembers(player);
|
||||
|
||||
Pinstance.removeFromParty(player, PP);
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.resetPartyHealthBarDisplays(partymembers);
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("?")) {
|
||||
@ -1264,7 +1272,12 @@ public class Commands
|
||||
{
|
||||
if(PP.inParty())
|
||||
{
|
||||
ArrayList<Player> partymembers = Party.getInstance().getPartyMembers(player);
|
||||
|
||||
Pinstance.removeFromParty(player, PP);
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.resetPartyHealthBarDisplays(partymembers);
|
||||
}
|
||||
Pinstance.addToParty(player, PP, args[0], false);
|
||||
return true;
|
||||
@ -1314,7 +1327,14 @@ public class Commands
|
||||
}
|
||||
}
|
||||
PlayerProfile tPP = Users.getProfile(tPlayer);
|
||||
|
||||
ArrayList<Player> partymembers = Party.getInstance().getPartyMembers(player);
|
||||
|
||||
Pinstance.removeFromParty(tPlayer, tPP);
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.resetPartyHealthBarDisplays(partymembers);
|
||||
|
||||
tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
|
||||
}
|
||||
} else {
|
||||
@ -1395,10 +1415,10 @@ public class Commands
|
||||
pMessage = pMessage + " " + args[i];
|
||||
}
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE
|
||||
+ player.getName() + ChatColor.GREEN + ") ";
|
||||
+ player.getDisplayName() + ChatColor.GREEN + ") ";
|
||||
|
||||
log.log(Level.INFO,
|
||||
"[P](" + PP.getParty() + ")" + "<" + player.getName()
|
||||
"[P](" + PP.getParty() + ")" + "<" + player.getDisplayName()
|
||||
+ "> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
@ -1426,7 +1446,6 @@ public class Commands
|
||||
}
|
||||
|
||||
else if(label.equalsIgnoreCase("a")){
|
||||
|
||||
// Console message?
|
||||
if(!(sender instanceof Player) && args.length >= 1)
|
||||
{
|
||||
@ -1442,13 +1461,14 @@ public class Commands
|
||||
+ aMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp))
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!mcPermissions.getInstance().adminChat(player)){
|
||||
if(!mcPermissions.getInstance().adminChat(player) && !player.isOp())
|
||||
{
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
@ -1463,10 +1483,10 @@ public class Commands
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE
|
||||
+ player.getName() + ChatColor.AQUA + "} ";
|
||||
log.log(Level.INFO, "[A]<" + player.getName() + "> "
|
||||
log.log(Level.INFO, "[A]<" + player.getDisplayName() + "> "
|
||||
+ aMessage);
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp))
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
}
|
||||
return true;
|
||||
|
@ -5,9 +5,9 @@ import org.bukkit.util.config.Configuration;
|
||||
|
||||
public class LoadProperties
|
||||
{
|
||||
public static Boolean 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, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
||||
public static Boolean 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, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
||||
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood, nStone, nIron, nGold, nDiamond, locale;
|
||||
public static int archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, 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, xpGainMultiplier, superBreakerCooldown = 240, greenTerraCooldown = 240, gigaDrillBreakerCooldown = 240, treeFellerCooldown = 240, berserkCooldown = 240, serratedStrikeCooldown = 240, skullSplitterCooldown = 240, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier = 2, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier, rWood, rStone, rIron, rGold, rDiamond;
|
||||
public static int 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, xpGainMultiplier, superBreakerCooldown = 240, greenTerraCooldown = 240, gigaDrillBreakerCooldown = 240, treeFellerCooldown = 240, berserkCooldown = 240, serratedStrikeCooldown = 240, skullSplitterCooldown = 240, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier = 2, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier, rWood, rStone, rIron, rGold, rDiamond;
|
||||
public String directory = "plugins/mcMMO/";
|
||||
File file = new File(directory + File.separator + "config.yml");
|
||||
Configuration config = null;
|
||||
@ -143,6 +143,7 @@ public class LoadProperties
|
||||
write("XP.Excavation.Apple", 10);
|
||||
write("XP.Excavation.Eggs", 10);
|
||||
write("XP.Excavation.Cake", 300);
|
||||
write("XP.Excavation.Slimeballs", 10);
|
||||
write("XP.Excavation.Cocoa_Beans", 10);
|
||||
|
||||
//write("Sorcery.Spells.Water.Thunder", 75);
|
||||
@ -161,6 +162,7 @@ public class LoadProperties
|
||||
write("Excavation.Drops.Sulphur", true);
|
||||
write("Excavation.Drops.Netherrack", true);
|
||||
write("Excavation.Drops.Bones", true);
|
||||
write("Excavation.Drops.Slimeballs", true);
|
||||
|
||||
write("Commands.mctop.Name", "mctop");
|
||||
write("Commands.mctop.Enabled", true);
|
||||
@ -233,10 +235,6 @@ public class LoadProperties
|
||||
donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true);
|
||||
xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false);
|
||||
|
||||
//cure_self = readInteger("Sorcery.Spells.Curative.Cure_Self.Mana_Cost");
|
||||
//cure_other = readInteger("Sorcery.Spells.Curative.Cure_Other.Mana_Cost");
|
||||
//water_thunder = readInteger("Sorcery.Spells.Water.Thunder");
|
||||
|
||||
msulphur = readInteger("XP.Excavation.Sulphur", 3);
|
||||
mbones = readInteger("XP.Excavation.Bones", 3);
|
||||
mbase = readInteger("XP.Excavation.Base", 4);
|
||||
@ -249,6 +247,7 @@ public class LoadProperties
|
||||
meggs = readInteger("XP.Excavation.Eggs", 10);
|
||||
mcake = readInteger("XP.Excavation.Cake", 300);
|
||||
mcocoa = readInteger("XP.Excavation.Cocoa_Beans", 10);
|
||||
mslimeballs = readInteger("XP.Excavation.Slimeballs", 10);
|
||||
|
||||
msugar = readInteger("XP.Herbalism.Sugar_Cane", 3);
|
||||
mwheat = readInteger("XP.Herbalism.Wheat", 5);
|
||||
@ -355,6 +354,7 @@ public class LoadProperties
|
||||
sulphur = readBoolean("Excavation.Drops.Sulphur", true);
|
||||
netherrack = readBoolean("Excavation.Drops.Netherrack", true);
|
||||
bones = readBoolean("Excavation.Drops.Bones", true);
|
||||
slimeballs = readBoolean("Excavation.Drops.Slimeballs", true);
|
||||
|
||||
mctop = readString("Commands.mctop.Name", "mctop");
|
||||
mctopEnable = readBoolean("Commands.mctop.Enabled", true);
|
||||
|
26
mcMMO/com/gmail/nossr50/datatypes/HealthBarMMO.java
Normal file
26
mcMMO/com/gmail/nossr50/datatypes/HealthBarMMO.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.getspout.spoutapi.gui.GenericLabel;
|
||||
import org.getspout.spoutapi.gui.GenericTexture;
|
||||
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class HealthBarMMO
|
||||
{
|
||||
public GenericTexture health_bar = null;
|
||||
public GenericLabel health_name = null;
|
||||
public String playerName = null;
|
||||
|
||||
public HealthBarMMO(LivingEntity entity, String name)
|
||||
{
|
||||
health_name = new GenericLabel();
|
||||
health_name.setText(ChatColor.GREEN+name).setDirty(true);
|
||||
|
||||
health_bar = new GenericTexture();
|
||||
health_bar.setUrl(SpoutStuff.getHealthBarURL(entity.getHealth())).setHeight(8).setWidth(64).setDirty(true);
|
||||
|
||||
playerName = name;
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
|
@ -5,7 +5,7 @@ import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import org.bukkit.Material;
|
||||
|
@ -26,6 +26,7 @@ import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.skills.Acrobatics;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.Taming;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
|
||||
public class mcEntityListener extends EntityListener
|
||||
@ -134,11 +135,17 @@ public class mcEntityListener extends EntityListener
|
||||
/*
|
||||
* Check to see if the defender took damage so we can apply recently hurt
|
||||
*/
|
||||
if(event.getEntity() instanceof Player && !event.isCancelled() && event.getDamage() >= 1)
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
Player herpderp = (Player)event.getEntity();
|
||||
if(!event.isCancelled() && event.getDamage() >= 1)
|
||||
{
|
||||
Users.getProfile(herpderp).setRecentlyHurt(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
if(LoadProperties.spoutEnabled && Users.getProfile(herpderp).inParty())
|
||||
SpoutStuff.updatePartyHealthBarDisplay(herpderp, herpderp.getHealth()-event.getDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.command.Commands;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
@ -60,10 +60,9 @@ public class mcPlayerListener extends PlayerListener
|
||||
{
|
||||
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(LoadProperties.enableMySpawn && mcPermissions.getInstance().mySpawn(player))
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if(player != null && PP != null)
|
||||
{
|
||||
PP.setRespawnATS(System.currentTimeMillis());
|
||||
@ -78,7 +77,12 @@ public class mcPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
}
|
||||
if(LoadProperties.spoutEnabled && PP.inParty())
|
||||
{
|
||||
SpoutStuff.updatePartyHealthBarDisplay(player, 20);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
Users.addUser(event.getPlayer());
|
||||
@ -92,6 +96,8 @@ public class mcPlayerListener extends PlayerListener
|
||||
*/
|
||||
|
||||
//Discard the PlayerProfile object
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Users.removeUser(event.getPlayer());
|
||||
if(LoadProperties.spoutEnabled)
|
||||
{
|
||||
@ -101,6 +107,10 @@ public class mcPlayerListener extends PlayerListener
|
||||
if(SpoutStuff.xpicons.containsKey(event.getPlayer()))
|
||||
SpoutStuff.xpicons.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
//Health bar stuff
|
||||
if(LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
|
||||
SpoutStuff.resetPartyHealthBarDisplays(Party.getInstance().getPartyMembers(player));
|
||||
}
|
||||
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
@ -115,6 +125,10 @@ public class mcPlayerListener extends PlayerListener
|
||||
}
|
||||
if(Commands.xpevent)
|
||||
player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
|
||||
|
||||
//Health bar stuff
|
||||
if(LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
|
||||
SpoutStuff.resetPartyHealthBarDisplays(Party.getInstance().getPartyMembers(player));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -227,13 +241,13 @@ public class mcPlayerListener extends PlayerListener
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getDisplayName() + ChatColor.GREEN + ") "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getDisplayName() + ChatColor.AQUA + "} "; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
if(PP.getPartyChatMode())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log.log(Level.INFO, "[P]("+PP.getParty()+")"+"<"+player.getName()+"> "+event.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
log.log(Level.INFO, "[P]("+PP.getParty()+")"+"<"+player.getDisplayName()+"> "+event.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
for(Player herp : plugin.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(Users.getProfile(herp).inParty())
|
||||
@ -249,7 +263,7 @@ public class mcPlayerListener extends PlayerListener
|
||||
|
||||
if((player.isOp() || mcPermissions.getInstance().adminChat(player)) && PP.getAdminChatMode())
|
||||
{
|
||||
log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
log.log(Level.INFO, "[A]"+"<"+player.getDisplayName()+"> "+event.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
event.setCancelled(true);
|
||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||
if((herp.isOp() || mcPermissions.getInstance().adminChat(herp))){
|
||||
|
@ -3,31 +3,39 @@ package com.gmail.nossr50.listeners;
|
||||
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
|
||||
import org.getspout.spoutapi.event.spout.SpoutListener;
|
||||
import org.getspout.spoutapi.gui.GenericTexture;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutListener extends SpoutListener
|
||||
{
|
||||
public void onSpoutCraftEnable(SpoutCraftEnableEvent event)
|
||||
{
|
||||
if(event.getPlayer().isSpoutCraftEnabled())
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
if(sPlayer.isSpoutCraftEnabled())
|
||||
{
|
||||
//Setup xp bar
|
||||
GenericTexture xpbar = new GenericTexture();
|
||||
GenericTexture xpicon = new GenericTexture();
|
||||
|
||||
//Setup Party HUD stuff
|
||||
if(Users.getProfile(sPlayer).inParty())
|
||||
SpoutStuff.initializePartyTracking(sPlayer);
|
||||
|
||||
xpicon.setUrl("http://dl.dropbox.com/u/18212134/xpbar/icon.png");
|
||||
|
||||
xpicon.setHeight(16).setWidth(32).setX(93).setY(2);
|
||||
|
||||
xpbar.setUrl("http://dl.dropbox.com/u/18212134/xpbar/xpbar_inc000.png");
|
||||
xpbar.setX(110).setY(6).setHeight(8).setWidth(256);
|
||||
|
||||
SpoutStuff.xpbars.put(event.getPlayer(), xpbar);
|
||||
SpoutStuff.xpicons.put(event.getPlayer(), xpicon);
|
||||
|
||||
event.getPlayer().getMainScreen().attachWidget(SpoutStuff.xpbars.get(event.getPlayer()));
|
||||
event.getPlayer().getMainScreen().attachWidget(SpoutStuff.xpicons.get(event.getPlayer()));
|
||||
event.getPlayer().getMainScreen().setDirty(true);
|
||||
SpoutStuff.xpbars.put(sPlayer, xpbar);
|
||||
SpoutStuff.xpicons.put(sPlayer, xpicon);
|
||||
|
||||
sPlayer.getMainScreen().attachWidget(SpoutStuff.xpbars.get(sPlayer));
|
||||
sPlayer.getMainScreen().attachWidget(SpoutStuff.xpicons.get(sPlayer));
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -5,7 +5,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.command.Commands;
|
||||
import com.gmail.nossr50.config.*;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.listeners.mcBlockListener;
|
||||
import com.gmail.nossr50.listeners.mcEntityListener;
|
||||
import com.gmail.nossr50.listeners.mcPlayerListener;
|
||||
@ -117,7 +117,7 @@ public class mcMMO extends JavaPlugin
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Normal, this);
|
||||
|
@ -5,6 +5,7 @@ import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.Swords;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
|
||||
public class mcTimer implements Runnable
|
||||
@ -54,6 +55,8 @@ public class mcTimer implements Runnable
|
||||
player.getHealth() > 0 && player.getHealth() < 20
|
||||
&& m.getPowerLevel(player) >= 1000){
|
||||
player.setHealth(m.calculateHealth(player.getHealth(), 1));
|
||||
if(LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
|
||||
SpoutStuff.updatePartyHealthBarDisplay(player, player.getHealth());
|
||||
}
|
||||
}
|
||||
if(thecount == 40 || thecount == 80){
|
||||
@ -62,6 +65,8 @@ public class mcTimer implements Runnable
|
||||
&& m.getPowerLevel(player) >= 500
|
||||
&& m.getPowerLevel(player) < 1000){
|
||||
player.setHealth(m.calculateHealth(player.getHealth(), 1));
|
||||
if(LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
|
||||
SpoutStuff.updatePartyHealthBarDisplay(player, player.getHealth());
|
||||
}
|
||||
}
|
||||
if(thecount == 80)
|
||||
@ -70,6 +75,8 @@ public class mcTimer implements Runnable
|
||||
player.getHealth() > 0 && player.getHealth() < 20
|
||||
&& m.getPowerLevel(player) < 500){
|
||||
player.setHealth(m.calculateHealth(player.getHealth(), 1));
|
||||
if(LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
|
||||
SpoutStuff.updatePartyHealthBarDisplay(player, player.getHealth());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
@ -101,6 +102,23 @@ public class Party
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPartyMembers(Player player)
|
||||
{
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
|
||||
for(Player p : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(player != null && p != null)
|
||||
{
|
||||
if(inSameParty(player, p) && !p.getName().equals(player.getName()))
|
||||
{
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
public void informPartyMembersOwnerChange(String newOwner) {
|
||||
Player newOwnerPlayer = plugin.getServer().getPlayer(newOwner);
|
||||
informPartyMembersOwnerChange(newOwnerPlayer, Bukkit.getServer().getOnlinePlayers());
|
||||
@ -110,7 +128,7 @@ public class Party
|
||||
int x = 0;
|
||||
for(Player p : players){
|
||||
if(newOwner != null && p != null){
|
||||
if(inSameParty(newOwner, p) && !p.getName().equals(newOwner.getName()))
|
||||
if(inSameParty(newOwner, p))
|
||||
{
|
||||
//TODO: Needs more locale.
|
||||
p.sendMessage(newOwner.getName()+" is the new party owner.");
|
||||
|
@ -131,6 +131,15 @@ public class Excavation
|
||||
is.add(new ItemStack(Material.SOUL_SAND, 1, (byte)0, (byte)0));
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if(LoadProperties.slimeballs && PP.getSkillLevel(SkillType.EXCAVATION) >= 50)
|
||||
{
|
||||
if(Math.random() * 20 > 19)
|
||||
{
|
||||
xp+= LoadProperties.mslimeballs * LoadProperties.xpGainMultiplier;
|
||||
is.add(new ItemStack(Material.SLIME_BALL, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//DIRT SAND OR GRAVEL
|
||||
|
@ -12,7 +12,7 @@ import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
@ -9,6 +9,7 @@ import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
@ -53,6 +54,10 @@ public class Repair {
|
||||
dif = (short) (durabilityBefore - durabilityAfter);
|
||||
dif = (short) (dif * 6); //Boost XP
|
||||
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier);
|
||||
|
||||
//CLANG CLANG
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
}
|
||||
else if (isIronArmor(is) && hasItem(player, rIron)){
|
||||
/*
|
||||
@ -64,6 +69,10 @@ public class Repair {
|
||||
dif = (short) (durabilityBefore - durabilityAfter);
|
||||
dif = (short) (dif * 2); //Boost XP
|
||||
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier);
|
||||
|
||||
//CLANG CLANG
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
//GOLD ARMOR
|
||||
} else if (isGoldArmor(is) && hasItem(player, rGold)){
|
||||
removeItem(player, rGold);
|
||||
@ -72,6 +81,10 @@ public class Repair {
|
||||
dif = (short) (durabilityBefore - durabilityAfter);
|
||||
dif = (short) (dif * 4); //Boost XP of Gold to around Iron
|
||||
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier);
|
||||
|
||||
//CLANG CLANG
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
} else {
|
||||
needMoreVespeneGas(is, player);
|
||||
}
|
||||
@ -131,6 +144,10 @@ public class Repair {
|
||||
if(m.isHoe(is))
|
||||
dif = (short) (dif / 2);
|
||||
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier);
|
||||
|
||||
//CLANG CLANG
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
} else if (isDiamondTools(is) && hasItem(player, rDiamond) && PP.getSkillLevel(SkillType.REPAIR) >= LoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds
|
||||
/*
|
||||
* DIAMOND TOOLS
|
||||
@ -146,6 +163,10 @@ public class Repair {
|
||||
if(m.isHoe(is))
|
||||
dif = (short) (dif / 2);
|
||||
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier);
|
||||
|
||||
//CLANG CLANG
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
} else if(isGoldTools(is) && hasItem(player, rGold)){
|
||||
player.getItemInHand().setDurability(getRepairAmount(is, player));
|
||||
removeItem(player, rGold);
|
||||
@ -159,6 +180,10 @@ public class Repair {
|
||||
if(m.isHoe(is))
|
||||
dif = (short) (dif / 2);
|
||||
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier);
|
||||
|
||||
//CLANG CLANG
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
} else {
|
||||
needMoreVespeneGas(is, player);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.contrib;
|
||||
package com.gmail.nossr50.spout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -19,18 +20,32 @@ import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.datatypes.HealthBarMMO;
|
||||
import com.gmail.nossr50.listeners.mcSpoutListener;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class SpoutStuff
|
||||
{
|
||||
private final static mcSpoutListener spoutListener = new mcSpoutListener();
|
||||
public static HashMap<Player, GenericTexture> xpbars = new HashMap<Player, GenericTexture>();
|
||||
public static HashMap<Player, GenericTexture> xpicons = new HashMap<Player, GenericTexture>();
|
||||
public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>();
|
||||
|
||||
public static void registerCustomEvent()
|
||||
{
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, Bukkit.getServer().getPluginManager().getPlugin("mcMMO"));
|
||||
}
|
||||
public static String getHealthBarURL(Integer hp)
|
||||
{
|
||||
String url = "";
|
||||
|
||||
if(hp.toString().toCharArray().length > 1)
|
||||
url = "http://dl.dropbox.com/u/18212134/xpbar/health_inc"+hp+".png";
|
||||
else
|
||||
url = "http://dl.dropbox.com/u/18212134/xpbar/health_inc0"+hp+".png";
|
||||
|
||||
return url;
|
||||
}
|
||||
public static void playSoundForPlayer(SoundEffect effect, Player player, Location location)
|
||||
{
|
||||
//Contrib stuff
|
||||
@ -38,13 +53,80 @@ public class SpoutStuff
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
SM.playSoundEffect(sPlayer, effect, location);
|
||||
}
|
||||
public static void initializePartyTracking(SpoutPlayer player)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
ArrayList<HealthBarMMO> hpbars = new ArrayList<HealthBarMMO>();
|
||||
for(Player x : Party.getInstance().getPartyMembers(player))
|
||||
{
|
||||
HealthBarMMO hpbar = new HealthBarMMO(x, x.getName());
|
||||
hpbar.health_name.setX(0).setY(pos);
|
||||
hpbar.health_bar.setX(-11).setY(pos+8);
|
||||
hpbars.add(hpbar);
|
||||
pos+=20;
|
||||
}
|
||||
|
||||
partyHealthBars.put(player, hpbars);
|
||||
|
||||
for(HealthBarMMO x : partyHealthBars.get(player))
|
||||
{
|
||||
if(x != null)
|
||||
{
|
||||
player.getMainScreen().attachWidget(x.health_bar);
|
||||
player.getMainScreen().attachWidget(x.health_name);
|
||||
}
|
||||
}
|
||||
|
||||
player.getMainScreen().setDirty(true);
|
||||
}
|
||||
public static void resetPartyHealthBarDisplays(ArrayList<Player> players)
|
||||
{
|
||||
for(Player x : players)
|
||||
{
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(x);
|
||||
if(sPlayer.isSpoutCraftEnabled())
|
||||
{
|
||||
for(HealthBarMMO y : partyHealthBars.get(x))
|
||||
{
|
||||
sPlayer.getMainScreen().removeWidget(y.health_bar);
|
||||
sPlayer.getMainScreen().removeWidget(y.health_name);
|
||||
}
|
||||
initializePartyTracking(SpoutManager.getPlayer(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updatePartyHealthBarDisplay(Player player, Integer hp)
|
||||
{
|
||||
for(Player x : Party.getInstance().getPartyMembers(player))
|
||||
{
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(x);
|
||||
if(sPlayer.isSpoutCraftEnabled())
|
||||
{
|
||||
for(HealthBarMMO y : partyHealthBars.get(x))
|
||||
{
|
||||
if(y.playerName.equalsIgnoreCase(player.getName()))
|
||||
{
|
||||
y.health_bar.setUrl(getHealthBarURL(hp)).setDirty(true);
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void playRepairNoise(Player player)
|
||||
{
|
||||
SoundManager SM = SpoutManager.getSoundManager();
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
SM.playCustomMusic(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "http://dl.dropbox.com/u/18212134/xpbar/ui_armorweapon_repair.wav", false);
|
||||
}
|
||||
public static void playLevelUpNoise(Player player)
|
||||
{
|
||||
SoundManager SM = SpoutManager.getSoundManager();
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
String r = String.valueOf((int) (Math.random()*8));
|
||||
SM.playCustomMusic(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "http://dl.dropbox.com/u/18212134/ANUSOUND/"+r+".wav", false);
|
||||
SM.playCustomMusic(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "http://dl.dropbox.com/u/18212134/ANUSOUND/"+(int)Math.random()*8+".wav", false);
|
||||
}
|
||||
|
||||
public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer)
|
@ -1,6 +1,6 @@
|
||||
name: mcMMO
|
||||
main: com.gmail.nossr50.mcMMO
|
||||
version: 1.0.51 WIP
|
||||
version: 1.0.51 WIP v2
|
||||
softdepend: [Spout]
|
||||
commands:
|
||||
xprate:
|
||||
@ -107,8 +107,6 @@ permissions:
|
||||
default: op
|
||||
description: mcmmo permissions that default to op
|
||||
children:
|
||||
mcmmo.admin: false
|
||||
mcmmo.tools.*: false
|
||||
mcmmo.chat.adminchat: true
|
||||
|
||||
mcmmo.admin:
|
||||
@ -186,9 +184,9 @@ permissions:
|
||||
mcmmo.chat.adminchat: true
|
||||
mcmmo.chat.partychat: true
|
||||
mcmmo.chat.adminchat:
|
||||
description:
|
||||
description: Allows participation in admin chat
|
||||
mcmmo.chat.partychat:
|
||||
description:
|
||||
description: Allows participation in party chat
|
||||
mcmmo.skills.*:
|
||||
description: Implies all mcmmo.skills permissions.
|
||||
children:
|
||||
|
Loading…
Reference in New Issue
Block a user