A very small update so far, going to probably slap in XP bars for this update

This commit is contained in:
nossr50 2011-08-02 16:48:55 -07:00
parent 037485335e
commit ed1f176aaf
9 changed files with 72 additions and 68 deletions

View File

@ -1,5 +1,10 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.0.50
/mcgod and /mmoedit now require permissions to be setup in some shape or form to be used
mcMMO now uses Spout instead of BukkitContrib
BukkitContrib support dropped
Version 1.0.49
Updated German locale
Fixed bug where using the party system on a MySQL setup caused errors when writing to non-existent files

View File

@ -5,7 +5,7 @@ import org.bukkit.util.config.Configuration;
public class LoadProperties
{
public static Boolean contribEnabled, 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 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, mlapus, 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/";

View File

@ -4,29 +4,28 @@ import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkitcontrib.BukkitContrib;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.bukkitcontrib.sound.SoundEffect;
import org.bukkitcontrib.sound.SoundManager;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import org.getspout.spoutapi.sound.SoundEffect;
import org.getspout.spoutapi.sound.SoundManager;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
public class contribStuff
public class SpoutStuff
{
public static void playSoundForPlayer(SoundEffect effect, Player player, Location location)
{
//Contrib stuff
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
SoundManager SM = BukkitContrib.getSoundManager();
SM.playSoundEffect(cPlayer, effect, location);
SoundManager SM = SpoutManager.getSoundManager();
SpoutPlayer sPlayer = (SpoutPlayer)player;
SM.playSoundEffect(sPlayer, effect, location);
}
public static void levelUpNotification(SkillType skillType, ContribPlayer cPlayer)
public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer)
{
PlayerProfile PP = Users.getProfile(cPlayer);
PlayerProfile PP = Users.getProfile(sPlayer);
Material mat = null;
switch(skillType)
@ -241,7 +240,7 @@ public class contribStuff
mat = Material.WATCH;
break;
}
cPlayer.sendNotification(ChatColor.GREEN+"Level Up!", ChatColor.YELLOW+m.getCapitalized(skillType.toString())+ChatColor.DARK_AQUA+" ("+ChatColor.GREEN+PP.getSkillLevel(skillType)+ChatColor.DARK_AQUA+")", mat);
sPlayer.sendNotification(ChatColor.GREEN+"Level Up!", ChatColor.YELLOW+m.getCapitalized(skillType.toString())+ChatColor.DARK_AQUA+" ("+ChatColor.GREEN+PP.getSkillLevel(skillType)+ChatColor.DARK_AQUA+")", mat);
}
public static Integer getNotificationTier(Integer level)

View File

@ -289,7 +289,8 @@ public class PlayerProfile
{
Long timestamp = System.currentTimeMillis()/1000; //Convert to seconds
// if we are using mysql save to database
if (LoadProperties.useMySQL) {
if (LoadProperties.useMySQL)
{
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);
@ -329,7 +330,8 @@ public class PlayerProfile
+", acrobatics = "+skillsXp.get(SkillType.ACROBATICS)
+" WHERE user_id = "+this.userid);
} else {
} else
{
// otherwise save to flatfile
try {
//Open the file

View File

@ -5,10 +5,9 @@ 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.contribStuff;
import com.gmail.nossr50.contrib.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
@ -19,9 +18,8 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.bukkitcontrib.sound.SoundEffect;
import org.getspout.spoutapi.player.SpoutPlayer;
import org.getspout.spoutapi.sound.SoundEffect;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.*;
@ -58,25 +56,25 @@ public class mcBlockListener extends BlockListener {
if(block.getTypeId() == 42 && LoadProperties.anvilmessages)
{
PlayerProfile PP = Users.getProfile(player);
if(LoadProperties.contribEnabled)
if(LoadProperties.spoutEnabled)
{
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
if(cPlayer.isBukkitContribEnabled())
SpoutPlayer sPlayer = (SpoutPlayer)player;
if(sPlayer.isSpoutCraftEnabled())
{
if(!PP.getPlacedAnvil())
{
cPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to repair!", Material.IRON_BLOCK);
sPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to repair!", Material.IRON_BLOCK);
PP.togglePlacedAnvil();
}
}
else
{
if(!PP.getPlacedAnvil())
{
event.getPlayer().sendMessage(mcLocale.getString("mcBlockListener.PlacedAnvil")); //$NON-NLS-1$
PP.togglePlacedAnvil();
}
}
else
{
if(!PP.getPlacedAnvil())
{
event.getPlayer().sendMessage(mcLocale.getString("mcBlockListener.PlacedAnvil")); //$NON-NLS-1$
PP.togglePlacedAnvil();
}
}
}
else
{
@ -189,19 +187,21 @@ public class mcBlockListener extends BlockListener {
&& block.getTypeId() == 17
&& m.blockBreakSimulate(block, player, plugin))
{
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.EXPLODE, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.EXPLODE, player, block.getLocation());
WoodCutting.treeFeller(block, player, plugin);
for(Block blockx : plugin.misc.treeFeller)
{
if(blockx != null){
if(blockx != null)
{
Material mat = Material.getMaterial(block.getTypeId());
byte type = 0;
if(block.getTypeId() == 17)
type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
if(blockx.getTypeId() == 17){
if(blockx.getTypeId() == 17)
{
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
//XP WOODCUTTING
if(!plugin.misc.blockWatchList.contains(block))
@ -316,8 +316,8 @@ public class mcBlockListener extends BlockListener {
/*
* TREE FELLAN STUFF
*/
if(LoadProperties.contribEnabled && block.getTypeId() == 17 && Users.getProfile(player).getTreeFellerMode())
contribStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
if(LoadProperties.spoutEnabled && block.getTypeId() == 17 && Users.getProfile(player).getTreeFellerMode())
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
/*
* GREEN TERRA STUFF
@ -353,8 +353,8 @@ public class mcBlockListener extends BlockListener {
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
//Contrib stuff
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
/*
* BERSERK MODE CHECKS
@ -375,8 +375,8 @@ public class mcBlockListener extends BlockListener {
block.setType(Material.AIR);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
/*
@ -409,8 +409,8 @@ public class mcBlockListener extends BlockListener {
}
block.setType(Material.AIR);
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
if(block.getType() == Material.AIR && plugin.misc.blockWatchList.contains(block))
{

View File

@ -44,8 +44,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.entity.Player;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.getspout.spoutapi.player.SpoutPlayer;
public class mcMMO extends JavaPlugin
@ -118,10 +117,10 @@ public class mcMMO extends JavaPlugin
PluginManager pm = getServer().getPluginManager();
if(pm.getPlugin("BukkitContrib") != null)
LoadProperties.contribEnabled = true;
if(pm.getPlugin("Spout") != null)
LoadProperties.spoutEnabled = true;
else
LoadProperties.contribEnabled = false;
LoadProperties.spoutEnabled = false;
//Player Stuff
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
@ -658,11 +657,11 @@ public class mcMMO extends JavaPlugin
{
player.sendMessage(x);
}
if(LoadProperties.contribEnabled)
if(LoadProperties.spoutEnabled && player instanceof SpoutPlayer)
{
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
SpoutPlayer sPlayer = (SpoutPlayer)player;
if(LoadProperties.donateMessage)
cPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE);
sPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE);
}
else
{

View File

@ -7,13 +7,13 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkitcontrib.sound.SoundEffect;
import org.getspout.spoutapi.sound.SoundEffect;
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.contribStuff;
import com.gmail.nossr50.contrib.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
@ -476,8 +476,8 @@ public class Mining
}
if(block.getData() != (byte) 5)
PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier);
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
Skills.XpCheckSkill(SkillType.MINING, player);
}

View File

@ -6,8 +6,8 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Leaderboard;
import com.gmail.nossr50.Users;
@ -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.contribStuff;
import com.gmail.nossr50.contrib.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.PlayerStat;
import com.gmail.nossr50.datatypes.SkillType;
@ -309,12 +309,12 @@ public class Skills {
//Contrib stuff
if(LoadProperties.contribEnabled)
if(LoadProperties.spoutEnabled && player instanceof SpoutPlayer)
{
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
if(cPlayer.isBukkitContribEnabled())
SpoutPlayer sPlayer = SpoutManager.getPlayerFromId(player.getEntityId());
if(sPlayer.isSpoutCraftEnabled())
{
contribStuff.levelUpNotification(skillType, cPlayer);
SpoutStuff.levelUpNotification(skillType, sPlayer);
} else
{
player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));

View File

@ -1,6 +1,6 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
version: 1.0.49
version: 1.0.50 WIP
commands:
mcc:
description: Lists mcMMO commands
@ -76,8 +76,6 @@ commands:
a:
description: Toggle Admin chat or send admin chat messages
permission: mcmmo.chat.adminchat
sorcery:
description: Detailed skill info
permissions:
mcmmo.*:
description: Implies all mcmmo permissions.
@ -90,7 +88,7 @@ permissions:
mcmmo.defaults:
default: true
description: mcmmo permisionss that default to true
description: mcmmo permisions that default to true
children:
mcmmo.ability.*: true
mcmmo.item.*: true
@ -100,13 +98,14 @@ permissions:
mcmmo.commands.*: true
mcmmo.chat.partychat: true
mcmmo.skills.*: true
mcmmo.tools.*: false
mcmmo.defaultsop:
default: op
description: mcmmo permissions that default to op
children:
mcmmo.admin: false
mcmmo.tools.*: true
mcmmo.tools.*: false
mcmmo.chat.adminchat: true
mcmmo.admin: