mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
A 1.0.51 WIP
This commit is contained in:
parent
b13958d435
commit
dac789ed99
@ -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)
|
else if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86)
|
||||||
plugin.misc.blockWatchList.add(block);
|
plugin.misc.blockWatchList.add(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block.getTypeId() == 42 && LoadProperties.anvilmessages)
|
if(block.getTypeId() == 42 && LoadProperties.anvilmessages)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
28
mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java
Normal file
28
mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java
Normal file
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ import com.gmail.nossr50.config.*;
|
|||||||
import com.gmail.nossr50.listeners.mcBlockListener;
|
import com.gmail.nossr50.listeners.mcBlockListener;
|
||||||
import com.gmail.nossr50.listeners.mcEntityListener;
|
import com.gmail.nossr50.listeners.mcEntityListener;
|
||||||
import com.gmail.nossr50.listeners.mcPlayerListener;
|
import com.gmail.nossr50.listeners.mcPlayerListener;
|
||||||
|
import com.gmail.nossr50.listeners.mcSpoutListener;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
import com.gmail.nossr50.party.Party;
|
import com.gmail.nossr50.party.Party;
|
||||||
import com.gmail.nossr50.skills.*;
|
import com.gmail.nossr50.skills.*;
|
||||||
@ -66,9 +67,12 @@ public class mcMMO extends JavaPlugin
|
|||||||
File file = new File(maindirectory + File.separator + "config.yml");
|
File file = new File(maindirectory + File.separator + "config.yml");
|
||||||
static File versionFile = new File(maindirectory + File.separator + "VERSION");
|
static File versionFile = new File(maindirectory + File.separator + "VERSION");
|
||||||
public static final Logger log = Logger.getLogger("Minecraft");
|
public static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
||||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||||
|
private final mcSpoutListener spoutListener = new mcSpoutListener(this);
|
||||||
|
|
||||||
public boolean xpevent = false;
|
public boolean xpevent = false;
|
||||||
int oldrate = 1;
|
int oldrate = 1;
|
||||||
public static mcPermissions permissionHandler = new mcPermissions();
|
public static mcPermissions permissionHandler = new mcPermissions();
|
||||||
@ -80,7 +84,6 @@ public class mcMMO extends JavaPlugin
|
|||||||
public static Database database = null;
|
public static Database database = null;
|
||||||
public Mob mob = new Mob();
|
public Mob mob = new Mob();
|
||||||
public Misc misc = new Misc(this);
|
public Misc misc = new Misc(this);
|
||||||
public Sorcery sorcery = new Sorcery(this);
|
|
||||||
|
|
||||||
//Config file stuff
|
//Config file stuff
|
||||||
LoadProperties config = new LoadProperties();
|
LoadProperties config = new LoadProperties();
|
||||||
@ -146,6 +149,12 @@ public class mcMMO extends JavaPlugin
|
|||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this);
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this);
|
||||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, 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();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
mcPermissions.initialize(getServer());
|
mcPermissions.initialize(getServer());
|
||||||
|
|
||||||
|
@ -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<Block> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.gmail.nossr50.mcMMO
|
main: com.gmail.nossr50.mcMMO
|
||||||
version: 1.0.50
|
version: 1.0.51 WIP
|
||||||
|
softdepend: Spout
|
||||||
commands:
|
commands:
|
||||||
xprate:
|
xprate:
|
||||||
description: Modify the xp rate or start an event
|
description: Modify the xp rate or start an event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user