From dac789ed99386bd8507523e2078a8f872a5c6054 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 3 Aug 2011 17:59:34 -0700 Subject: [PATCH] A 1.0.51 WIP --- .../nossr50/listeners/mcBlockListener.java | 1 + .../nossr50/listeners/mcSpoutListener.java | 28 +++++ mcMMO/com/gmail/nossr50/mcMMO.java | 11 +- mcMMO/com/gmail/nossr50/skills/Sorcery.java | 115 ------------------ mcMMO/plugin.yml | 3 +- 5 files changed, 41 insertions(+), 117 deletions(-) create mode 100644 mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java delete mode 100644 mcMMO/com/gmail/nossr50/skills/Sorcery.java diff --git a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java index acaf1d5b5..8cb6b9f7f 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java @@ -53,6 +53,7 @@ public class mcBlockListener extends BlockListener { else if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86) plugin.misc.blockWatchList.add(block); } + if(block.getTypeId() == 42 && LoadProperties.anvilmessages) { PlayerProfile PP = Users.getProfile(player); diff --git a/mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java b/mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java new file mode 100644 index 000000000..88d7dc8a3 --- /dev/null +++ b/mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java @@ -0,0 +1,28 @@ +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 com.gmail.nossr50.mcMMO; + +public class mcSpoutListener extends SpoutListener +{ + mcMMO plugin = null; + public mcSpoutListener(mcMMO pluginx) + { + plugin = pluginx; + } + public void onSpoutCraftEnable(SpoutCraftEnableEvent event) + { + if(event.getPlayer().isSpoutCraftEnabled()) + { + //The bottom right of the screen is x=240, y=427 + + GenericTexture xpbar = new GenericTexture(); + xpbar.setUrl("http://dl.dropbox.com/u/18212134/xpbar/xpbar_inc000.png"); + + event.getPlayer().getMainScreen().attachWidget(xpbar.setX(0).setY(240)); + } + } +} diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index 3c893cc43..21ba88cb8 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -7,6 +7,7 @@ import com.gmail.nossr50.config.*; import com.gmail.nossr50.listeners.mcBlockListener; import com.gmail.nossr50.listeners.mcEntityListener; import com.gmail.nossr50.listeners.mcPlayerListener; +import com.gmail.nossr50.listeners.mcSpoutListener; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.skills.*; @@ -66,9 +67,12 @@ public class mcMMO extends JavaPlugin File file = new File(maindirectory + File.separator + "config.yml"); static File versionFile = new File(maindirectory + File.separator + "VERSION"); public static final Logger log = Logger.getLogger("Minecraft"); + private final mcPlayerListener playerListener = new mcPlayerListener(this); private final mcBlockListener blockListener = new mcBlockListener(this); private final mcEntityListener entityListener = new mcEntityListener(this); + private final mcSpoutListener spoutListener = new mcSpoutListener(this); + public boolean xpevent = false; int oldrate = 1; public static mcPermissions permissionHandler = new mcPermissions(); @@ -80,7 +84,6 @@ public class mcMMO extends JavaPlugin public static Database database = null; public Mob mob = new Mob(); public Misc misc = new Misc(this); - public Sorcery sorcery = new Sorcery(this); //Config file stuff LoadProperties config = new LoadProperties(); @@ -145,6 +148,12 @@ public class mcMMO extends JavaPlugin pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this); pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this); + + //Spout Stuff + if(LoadProperties.spoutEnabled) + { + pm.registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, this); + } PluginDescriptionFile pdfFile = this.getDescription(); mcPermissions.initialize(getServer()); diff --git a/mcMMO/com/gmail/nossr50/skills/Sorcery.java b/mcMMO/com/gmail/nossr50/skills/Sorcery.java deleted file mode 100644 index 8e08b2151..000000000 --- a/mcMMO/com/gmail/nossr50/skills/Sorcery.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gmail.nossr50.skills; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; - -import com.gmail.nossr50.Users; -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.datatypes.PlayerProfile; -import com.gmail.nossr50.locale.mcLocale; - -public class Sorcery -{ - mcMMO plugin = null; - - public Sorcery(mcMMO pluginx) - { - plugin = pluginx; - } - - public Block getSpellTargetBlock(Player player) - { - List blocks = player.getLineOfSight(null, 25); - for(Block x : blocks) - { - Material y = Material.AIR; - if(x.getType() != y) - return x; - } - return null; - } - public void informSelected(String spellname, int cost, Player player) - { - player.sendMessage(mcLocale.getString("Sorcery.SpellSelected", new Object[] {spellname, cost})); - } - - public void informSpell(String spellname, Player player) - { - PlayerProfile PP = Users.getProfile(player); - player.sendMessage(mcLocale.getString("Sorcery.HasCast") +" "+spellname+" "+ mcLocale.getString("Sorcery.Current_Mana")+ChatColor.YELLOW+"("+ChatColor.GRAY+PP.getCurrentMana()+ChatColor.YELLOW+"/"+ChatColor.GREEN+PP.getMaxMana()+ChatColor.YELLOW+")"); - } - - public void shoutSpell(String spellname, Player player) - { - for(Player x : plugin.getServer().getOnlinePlayers()) - { - if(x == player) - continue; - if(m.getDistance(x.getLocation(), player.getLocation()) < 35) - { - x.sendMessage(ChatColor.GREEN+"-"+ChatColor.DARK_AQUA+"="+ChatColor.GOLD+spellname+ChatColor.DARK_AQUA+"="+ChatColor.GREEN+"-" - +" "+ChatColor.YELLOW+"["+ChatColor.DARK_RED+player.getName()+ChatColor.YELLOW+"]"); - } - } - } - - public void handleGreenDyeCycle(Player player) - { - PlayerProfile PP = Users.getProfile(player); - - //The selector is used to account for permissions removing spells from this order. - - //Check if player has access to curative spell - if(!hasCurativeSpellPermission(player)) - PP.setDyeChanged(true); - - switch(PP.getGreenDyeCycleSel()) - { - case 0: - if(mcPermissions.getInstance().sorceryCurativeHealSelf(player)) - { - PP.setDyeChanged(true); - PP.setGreenDyeCycleSel(1); - PP.setGreenDyeCycle(0); - - informSelected(mcLocale.getString("Sorcery.Curative.Self"), LoadProperties.cure_self, player); - break; - } - - else - { - PP.setGreenDyeCycleSel(1); - } - case 1: - if(mcPermissions.getInstance().sorceryCurativeHealOther(player)) - { - PP.setDyeChanged(true); - PP.setGreenDyeCycleSel(0); - PP.setGreenDyeCycle(1); - - informSelected(mcLocale.getString("Sorcery.Curative.Other"), LoadProperties.cure_other, player); - break; - } - else - { - PP.setGreenDyeCycleSel(0); - } - } - } - public boolean hasCurativeSpellPermission (Player player) - { - if(mcPermissions.getInstance().sorceryCurativeHealOther(player) == false - && mcPermissions.getInstance().sorceryCurativeHealSelf(player) == false) - return false; - else - return true; - } - -} diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 6c2189aa3..3a5bbee3d 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,6 +1,7 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 1.0.50 +version: 1.0.51 WIP +softdepend: Spout commands: xprate: description: Modify the xp rate or start an event