From f875f1d1c0505bec684bd4a54cb9d170c04e76c8 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 23 Feb 2011 23:29:34 -0800 Subject: [PATCH] All changes up to 0.7.4 --- mcMMO/Changelog.txt | 9 +++++++++ mcMMO/com/gmail/nossr50/mcBlockListener.java | 8 ++++---- mcMMO/com/gmail/nossr50/mcLoadProperties.java | 3 ++- mcMMO/com/gmail/nossr50/mcPermissions.java | 2 +- mcMMO/com/gmail/nossr50/mcPlayerListener.java | 16 ++++++++++++++-- mcMMO/com/gmail/nossr50/mcUsers.java | 17 +++++++++++++++++ mcMMO/com/gmail/nossr50/mcm.java | 14 ++++++++------ mcMMO/plugin.yml | 2 +- 8 files changed, 56 insertions(+), 15 deletions(-) diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index abe9ac0b3..00e3859a1 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,14 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# +Version 0.7.4 + Work around for a bukkit bug that broke my onBlockDamage event + Added /clearmyspawn +Version 0.7.3 + Fixed to work with build 424 of CB + Lowered the XP of gold due to it not being that rare anymore +Version 0.7.2 + Fixed security flaw where players could access /mmoedit if the server was not running permissions + Reduced XP gain of woodcutting a bit Version 0.7 Completely rewrote the XP system Added an XP skillrate modifier to the settings file diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java index e007403f7..0f60112c5 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -39,6 +39,7 @@ public class mcBlockListener extends BlockListener { public void onBlockDamage(BlockDamageEvent event) { //STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2); Player player = event.getPlayer(); + //player.sendMessage("mcMMO DEBUG: EVENT-OK DMG LEVEL ("+event.getDamageLevel().getLevel()+")"); Block block = event.getBlock(); int x = block.getX(); int y = block.getY(); @@ -50,17 +51,16 @@ public class mcBlockListener extends BlockListener { /* * MINING */ - if(dmg == 3 && !mcConfig.getInstance().isBlockWatched(block) && !mcConfig.getInstance().isCoordsWatched(xyz)){ + if(dmg == 2 && !mcConfig.getInstance().isBlockWatched(block) && !mcConfig.getInstance().isCoordsWatched(xyz)){ if(mcPermissions.getInstance().mining(player)) mcm.getInstance().miningBlockCheck(player, block); /* * WOOD CUTTING */ if(block.getTypeId() == 17 - && mcPermissions.getInstance().woodcutting(player)){ - mcUsers.getProfile(player).addWoodcuttingGather(1); + && mcPermissions.getInstance().woodcutting(player)){ mcm.getInstance().woodCuttingProcCheck(player, block, loc); - mcUsers.getProfile(player).addWoodcuttingGather(3); + mcUsers.getProfile(player).addWoodcuttingGather(2); } /* * EXCAVATION diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java index b3d9d7d9d..dc445f57e 100644 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java @@ -2,7 +2,7 @@ package com.gmail.nossr50; public class mcLoadProperties { public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; - public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept; + public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; public static int xpmodifier; public static void loadMain(){ @@ -50,6 +50,7 @@ public class mcLoadProperties { whois = properties.getString("whois", "whois"); invite = properties.getString("invite", "invite"); accept = properties.getString("accept", "accept"); + clearmyspawn = properties.getString("clearmyspawn", "clearmyspawn"); properties.save("==McMMO Configuration==\r\nYou can turn off excavation loot tables by turning the option to false\r\nYou can customize mcMMOs command names by modifying them here as well\r\nThis is an early version of the configuration file, eventually you'll be able to customize messages from mcMMO and XP gains"); //herp derp } diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java index 02026abc6..b366362d2 100644 --- a/mcMMO/com/gmail/nossr50/mcPermissions.java +++ b/mcMMO/com/gmail/nossr50/mcPermissions.java @@ -11,7 +11,7 @@ import com.nijikokun.bukkit.Permissions.Permissions; public class mcPermissions { //Thanks to myWarp source code for helping me figure this shit out! private static Permissions permissionsPlugin; - private static boolean permissionsEnabled = false; + public static boolean permissionsEnabled = false; private static volatile mcPermissions instance; public static void initialize(Server server) { diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index 6e6009460..85c597a19 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -112,7 +112,19 @@ public class mcPlayerListener extends PlayerListener { /* * MMOEDIT COMMAND */ - if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){ + if(mcPermissions.getInstance().mySpawn(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.clearmyspawn)){ + event.setCancelled(true); + double x = player.getWorld().getSpawnLocation().getX(); + double y = player.getWorld().getSpawnLocation().getY(); + double z = player.getWorld().getSpawnLocation().getZ(); + mcUsers.getProfile(player).setMySpawn(x, y, z); + player.sendMessage(ChatColor.DARK_AQUA+"Myspawn is now cleared."); + } + if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){ + if(!mcPermissions.getInstance().mmoedit(player)){ + player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); + return; + } if(split.length < 3){ player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.mmoedit+" playername skillname newvalue"); return; @@ -193,7 +205,7 @@ public class mcPlayerListener extends PlayerListener { +"/"+(mcUsers.getProfile(target).getHerbalismInt() + 5) * mcLoadProperties.xpmodifier+")"); player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getExcavation()+ChatColor.DARK_AQUA + " XP("+mcUsers.getProfile(target).getExcavationGather() - +"/"+(mcUsers.getProfile(target).getExcavationInt() + 5) * mcLoadProperties.xpmodifier+")"); + +"/"+(mcUsers.getProfile(target).getExcavationInt() + 3) * mcLoadProperties.xpmodifier+")"); player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getArchery()+ChatColor.DARK_AQUA + " XP("+mcUsers.getProfile(target).getArcheryGather() +"/"+(mcUsers.getProfile(target).getArcheryInt() + 5) * mcLoadProperties.xpmodifier+")"); diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index e52ffe416..3af599207 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -207,6 +207,23 @@ class PlayerList addPlayer(); } + public void scoreBoard() + { + try { + //Open the user file + FileReader file = new FileReader(location); + BufferedReader in = new BufferedReader(file); + String line = ""; + while((line = in.readLine()) != null) + { + + } + in.close(); + } catch (Exception e) { + log.log(Level.SEVERE, "Exception while reading " + + location + " (Are you sure you formatted it correctly?)", e); + } + } public boolean load() { try { diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index 54db1ec96..932f66f35 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -574,7 +574,7 @@ public class mcm { } //GOLD if(block.getTypeId() == 14){ - mcUsers.getProfile(player).addMiningGather(50); + mcUsers.getProfile(player).addMiningGather(20); mcm.getInstance().blockProcCheck(block, player); } //DIAMOND @@ -1421,8 +1421,10 @@ public class mcm { player.sendMessage(ChatColor.GREEN+"/"+mcLoadProperties.stats+ChatColor.GRAY+" - Check current skill levels"); if(mcPermissions.getInstance().setMySpawn(player)) player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.setmyspawn+" - Sets your spawn"); - if(mcPermissions.getInstance().mySpawn(player)) + if(mcPermissions.getInstance().mySpawn(player)){ player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.myspawn+" - travel to myspawn, clears inventory"); + player.sendMessage(ChatColor.GREEN+"/"+mcLoadProperties.clearmyspawn+" - resets your myspawn to default spawn location"); + } if(mcPermissions.getInstance().whois(player) || player.isOp()) player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.whois+" - view detailed info about a player (req op)"); player.sendMessage(ChatColor.GRAY+"/woodcutting - Skill info"); @@ -1570,7 +1572,7 @@ public class mcm { } //DIRT SAND OR GRAVEL if(type == 3 || type == 13 || type == 2 || type == 12){ - mcUsers.getProfile(player).addExcavationGather(1); + mcUsers.getProfile(player).addExcavationGather(2); if(mcUsers.getProfile(player).getExcavationInt() > 750){ //CHANCE TO GET CAKE if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){ @@ -1660,11 +1662,11 @@ public class mcm { } } } - if(mcUsers.getProfile(player).getExcavationGatherInt() >= (mcUsers.getProfile(player).getExcavationInt() + 5) * mcLoadProperties.xpmodifier){ + if(mcUsers.getProfile(player).getExcavationGatherInt() >= (mcUsers.getProfile(player).getExcavationInt() + 3) * mcLoadProperties.xpmodifier){ int skillups = 0; - while(mcUsers.getProfile(player).getExcavationGatherInt() >= (mcUsers.getProfile(player).getExcavationInt() +5) * mcLoadProperties.xpmodifier){ + while(mcUsers.getProfile(player).getExcavationGatherInt() >= (mcUsers.getProfile(player).getExcavationInt() +3) * mcLoadProperties.xpmodifier){ skillups++; - mcUsers.getProfile(player).removeExcavationGather((mcUsers.getProfile(player).getExcavationInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(player).removeExcavationGather((mcUsers.getProfile(player).getExcavationInt() + 3) * mcLoadProperties.xpmodifier); mcUsers.getProfile(player).skillUpExcavation(1); } player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")"); diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index abe54e374..49e526c2b 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.7.1 \ No newline at end of file +version: 0.7.4 \ No newline at end of file