Merge pull request #2 from gmcferrin/patch-3

Patch 3
This commit is contained in:
gmcferrin 2012-01-26 19:03:03 -08:00
commit 71aac4ea7d
10 changed files with 65 additions and 53 deletions

View File

@ -2,6 +2,13 @@ Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.2.08
- Changed Bukkit events to new event system
- Changed aliasing to send both the mcmmo command and the command used.
- Changes in combat exp (Pull Request #49)
- Repair for bows & leather armor (Pull Request #46)
- Fixed missing images (Pull Request #45)
- POM Changes for dependencies (Pull Request #36)
- Fishing & Repair fixes (Pull Request #31)
- Fixed CraftOfflinePlayer issue (Issue #212) errors for offline wolf owners
- Pull in commit from @NuclearW for issue from previous commit

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.2.08-dev</version>
<version>1.2.08</version>
<name>mcMMO</name>
<url>https://github.com/TheYeti/mcMMO</url>
<issueManagement>
@ -134,7 +134,7 @@
</dependency>
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutplugin</artifactId>
<artifactId>spoutpluginapi</artifactId>
<version>dev-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>

View File

@ -108,7 +108,7 @@ public class Combat
if(hpLeft < event.getDamage())
xpinc = hpLeft;
else
xpinc = event.getDamage;
xpinc = event.getDamage();
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);

View File

@ -345,7 +345,7 @@ public class LoadProperties
write("Skills.Repair.String.ID", 287);
write("Skills.Repair.String.Name", "String");
write("Skills.Repair.Leather.ID", 334);
write("Skills.Repair.String.Name", "Leather")
write("Skills.Repair.String.Name", "Leather");
write("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
write("Skills.Excavation.Requires_Shovel", true);
write("Skills.Mining.Requires_Pickaxe", true);

View File

@ -29,10 +29,12 @@ import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
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.getspout.spoutapi.SpoutManager;
@ -44,7 +46,7 @@ import com.gmail.nossr50.skills.*;
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
public class mcBlockListener extends BlockListener
public class mcBlockListener implements Listener
{
private final mcMMO plugin;
@ -53,6 +55,7 @@ public class mcBlockListener extends BlockListener
this.plugin = plugin;
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
//Setup some basic vars
@ -112,6 +115,7 @@ public class mcBlockListener extends BlockListener
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event)
{
Player player = event.getPlayer();
@ -275,6 +279,7 @@ public class mcBlockListener extends BlockListener
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDamage(BlockDamageEvent event)
{
if(event.isCancelled())
@ -439,6 +444,7 @@ public class mcBlockListener extends BlockListener
}
}
@EventHandler
public void onBlockFromTo(BlockFromToEvent event)
{
Block blockFrom = event.getBlock();

View File

@ -20,13 +20,15 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Combat;
@ -42,7 +44,7 @@ import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.Taming;
public class mcEntityListener extends EntityListener
public class mcEntityListener implements Listener
{
private final mcMMO plugin;
@ -50,6 +52,7 @@ public class mcEntityListener extends EntityListener
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityDamage(EntityDamageEvent event)
{
if(event.isCancelled())
@ -159,6 +162,7 @@ public class mcEntityListener extends EntityListener
}
}
@EventHandler
public void onEntityDeath(EntityDeathEvent event)
{
Entity x = event.getEntity();
@ -181,6 +185,7 @@ public class mcEntityListener extends EntityListener
}
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event)
{
SpawnReason reason = event.getSpawnReason();

View File

@ -32,6 +32,9 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -39,7 +42,6 @@ import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -64,7 +66,7 @@ import com.gmail.nossr50.skills.Repair;
import com.gmail.nossr50.skills.Skills;
public class mcPlayerListener extends PlayerListener
public class mcPlayerListener implements Listener
{
protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$
public Location spawn = null;
@ -75,6 +77,7 @@ public class mcPlayerListener extends PlayerListener
plugin = instance;
}
@EventHandler
public void onPlayerFish(PlayerFishEvent event)
{
if(mcPermissions.getInstance().fishing(event.getPlayer()))
@ -95,6 +98,7 @@ public class mcPlayerListener extends PlayerListener
}
}
@EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
if(Users.getProfile(event.getPlayer()).getBerserkMode())
@ -103,6 +107,7 @@ public class mcPlayerListener extends PlayerListener
}
}
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event)
{
@ -126,11 +131,13 @@ public class mcPlayerListener extends PlayerListener
}
}
@EventHandler
public void onPlayerLogin(PlayerLoginEvent event)
{
Users.addUser(event.getPlayer());
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
@ -151,6 +158,7 @@ public class mcPlayerListener extends PlayerListener
Users.removeUser(event.getPlayer());
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
@ -164,6 +172,7 @@ public class mcPlayerListener extends PlayerListener
player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteract(PlayerInteractEvent event)
{
Player player = event.getPlayer();
@ -298,6 +307,7 @@ public class mcPlayerListener extends PlayerListener
}
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerChat(PlayerChatEvent event)
{
Player player = event.getPlayer();
@ -334,13 +344,16 @@ public class mcPlayerListener extends PlayerListener
}
}
// Dynamically aliasing commands need to be re-done.
// For now, using a command with an alias will send both the original command, and the mcMMO command
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
String message = event.getMessage();
if(!message.startsWith("/")) return;
String command = message.substring(1).split(" ")[0];
if(plugin.aliasMap.containsKey(command)) {
if(command.equalsIgnoreCase(plugin.aliasMap.get(command))) return;
event.setCancelled(true);
//event.setCancelled(true);
event.getPlayer().chat(message.replaceFirst(command, plugin.aliasMap.get(command)));
}
}

View File

@ -49,8 +49,6 @@ import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
@ -140,27 +138,10 @@ public class mcMMO extends JavaPlugin
else
LoadProperties.spoutEnabled = false;
//Player Stuff
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_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);
pm.registerEvent(Event.Type.PLAYER_FISH, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Lowest, this);
//Block Stuff
pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this);
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.BLOCK_FROMTO, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Normal, this);
//Entity Stuff
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
//Register events
pm.registerEvents(playerListener, this);
pm.registerEvents(blockListener, this);
pm.registerEvents(entityListener, this);
PluginDescriptionFile pdfFile = this.getDescription();
mcPermissions.initialize(getServer());

View File

@ -469,9 +469,9 @@ public class Repair {
}
public static short repairCalculate(Player player, short durability, int ramt){
PlayerProfile PP = Users.getProfile(player);
float bonus = (PP.getSkillLevel(SkillType.REPAIR) / 500);
float bonus = (float)(PP.getSkillLevel(SkillType.REPAIR)) / 500;
bonus = (ramt * bonus);
ramt = ramt+=bonus;
ramt+=bonus;
if(checkPlayerProcRepair(player)){
ramt = (short) (ramt * 2);
}

View File

@ -1,6 +1,6 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
version: 1.2.08-dev-2
version: 1.2.08
softdepend: [Spout]
author: TheYeti
description: mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.