From aadfb22f0016f11b086da1167c82aa5a509c43b3 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Thu, 26 Jan 2012 15:11:15 -0800 Subject: [PATCH 1/5] Fixed lack of ; in pull request --- src/main/java/com/gmail/nossr50/config/LoadProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 11a5c3331..77fbf995f 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -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); From 85fe839e918d39b888dadd5def658c112f78f653 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Thu, 26 Jan 2012 15:19:07 -0800 Subject: [PATCH 2/5] Update changelog and fix for Jenkins build #4 --- Changelog.txt | 5 +++++ src/main/java/com/gmail/nossr50/Combat.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 68ba8190a..46f2a1768 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,6 +2,11 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code Version 1.2.08 + - 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 diff --git a/src/main/java/com/gmail/nossr50/Combat.java b/src/main/java/com/gmail/nossr50/Combat.java index 6b58b1aca..f41f7da0a 100644 --- a/src/main/java/com/gmail/nossr50/Combat.java +++ b/src/main/java/com/gmail/nossr50/Combat.java @@ -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); From 5863efbdd8678c36d92afb54b5003e5af0c39a86 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Thu, 26 Jan 2012 18:42:46 -0500 Subject: [PATCH 3/5] Events + Alias (not really fix) fix Changed Bukkit events to new event system Changed aliasing to send both the mcmmo command and the command used. --- pom.xml | 2 +- .../nossr50/listeners/mcBlockListener.java | 14 +++++-- .../nossr50/listeners/mcEntityListener.java | 15 ++++--- .../nossr50/listeners/mcPlayerListener.java | 39 ++++++++++++------- src/main/java/com/gmail/nossr50/mcMMO.java | 29 +++----------- 5 files changed, 52 insertions(+), 47 deletions(-) diff --git a/pom.xml b/pom.xml index d48e6ac10..42bbf8dfe 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,7 @@ org.getspout - spoutplugin + spoutpluginapi dev-SNAPSHOT jar compile diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index b082a93ed..8da729ebb 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -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 @@ -111,7 +114,8 @@ public class mcBlockListener extends BlockListener } } } - + + @EventHandler(priority = EventPriority.MONITOR) public void onBlockBreak(BlockBreakEvent event) { Player player = event.getPlayer(); @@ -274,7 +278,8 @@ 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(); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java index 4788b1f8a..9eaae96a1 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java @@ -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,14 +44,15 @@ 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; public mcEntityListener(final mcMMO plugin) { this.plugin = plugin; } - + + @EventHandler(priority = EventPriority.MONITOR) public void onEntityDamage(EntityDamageEvent event) { if(event.isCancelled()) @@ -158,7 +161,8 @@ public class mcEntityListener extends EntityListener } } } - + + @EventHandler public void onEntityDeath(EntityDeathEvent event) { Entity x = event.getEntity(); @@ -180,7 +184,8 @@ public class mcEntityListener extends EntityListener } } - + + @EventHandler public void onCreatureSpawn(CreatureSpawnEvent event) { SpawnReason reason = event.getSpawnReason(); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 602e0748e..02978a929 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -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; @@ -74,7 +76,8 @@ public class mcPlayerListener extends PlayerListener { plugin = instance; } - + + @EventHandler public void onPlayerFish(PlayerFishEvent event) { if(mcPermissions.getInstance().fishing(event.getPlayer())) @@ -94,15 +97,17 @@ public class mcPlayerListener extends PlayerListener } } } - - public void onPlayerPickupItem(PlayerPickupItemEvent event) - { - if(Users.getProfile(event.getPlayer()).getBerserkMode()) - { - event.setCancelled(true); - } - } + @EventHandler + public void onPlayerPickupItem(PlayerPickupItemEvent event) + { + if(Users.getProfile(event.getPlayer()).getBerserkMode()) + { + event.setCancelled(true); + } + } + + @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(); @@ -333,14 +343,17 @@ 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))); } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 4b03f60f8..58f56c16c 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -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; @@ -139,28 +137,11 @@ public class mcMMO extends JavaPlugin LoadProperties.spoutEnabled = true; 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()); From 80cc22efff926e1c75db574541f797b52e91deb8 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Thu, 26 Jan 2012 16:09:36 -0800 Subject: [PATCH 4/5] Stage changes for finalized 1.2.08 --- Changelog.txt | 2 ++ pom.xml | 2 +- src/main/resources/plugin.yml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 46f2a1768..ee45332ff 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,6 +2,8 @@ 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) diff --git a/pom.xml b/pom.xml index 42bbf8dfe..b645a2101 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 1.2.08-dev + 1.2.08 mcMMO https://github.com/TheYeti/mcMMO diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 52e3c52f9..ba0c9f067 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -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. From e1399427f0bd3fa2c0450da0273087ac81fca3eb Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Thu, 26 Jan 2012 21:57:17 -0500 Subject: [PATCH 5/5] Fixed cast issue with Repair Mastery - fixes Issue #47 --- src/main/java/com/gmail/nossr50/skills/Repair.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/Repair.java b/src/main/java/com/gmail/nossr50/skills/Repair.java index cc6f396c2..5e5cb4e62 100644 --- a/src/main/java/com/gmail/nossr50/skills/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/Repair.java @@ -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); }