mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 08:36:45 +01:00
I should be more descriptive with my commits. So here goes.
Made mcMMO play nice with servers not running Spout. Moved onCommand stuff into its own Object. Changed a few things around involving passing plugin.
This commit is contained in:
parent
263dc26380
commit
64e7bb4213
1521
mcMMO/com/gmail/nossr50/command/Commands.java
Normal file
1521
mcMMO/com/gmail/nossr50/command/Commands.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,8 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.gui.GenericTexture;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
@ -17,12 +19,18 @@ import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.listeners.mcSpoutListener;
|
||||
|
||||
public class SpoutStuff
|
||||
{
|
||||
private final static mcSpoutListener spoutListener = new mcSpoutListener();
|
||||
public static HashMap<Player, GenericTexture> xpbars = new HashMap<Player, GenericTexture>();
|
||||
public static HashMap<Player, GenericTexture> xpicons = new HashMap<Player, GenericTexture>();
|
||||
|
||||
public static void registerCustomEvent()
|
||||
{
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, Bukkit.getServer().getPluginManager().getPlugin("mcMMO"));
|
||||
}
|
||||
public static void playSoundForPlayer(SoundEffect effect, Player player, Location location)
|
||||
{
|
||||
//Contrib stuff
|
||||
|
@ -856,6 +856,8 @@ public class PlayerProfile
|
||||
} else {
|
||||
skillsXp.put(skillType, skillsXp.get(skillType)+newvalue);
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
{
|
||||
SkillType prevLastGained = lastgained;
|
||||
|
||||
lastgained = skillType;
|
||||
@ -864,6 +866,7 @@ public class PlayerProfile
|
||||
if(prevLastGained != skillType || prevLastGained == null)
|
||||
xpbarinc = SpoutStuff.getXpInc(this.getSkillXpLevel(lastgained), this.getXpToLevel(lastgained));
|
||||
}
|
||||
}
|
||||
//save();
|
||||
}
|
||||
public void removeXP(SkillType skillType, int newvalue)
|
||||
|
@ -190,7 +190,7 @@ public class mcBlockListener extends BlockListener
|
||||
if(mcPermissions.getInstance().woodCuttingAbility(player)
|
||||
&& PP.getTreeFellerMode()
|
||||
&& block.getTypeId() == 17
|
||||
&& m.blockBreakSimulate(block, player, plugin))
|
||||
&& m.blockBreakSimulate(block, player))
|
||||
{
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.EXPLODE, player, block.getLocation());
|
||||
@ -302,7 +302,7 @@ public class mcBlockListener extends BlockListener
|
||||
/*
|
||||
* GIGA DRILL BREAKER CHECKS
|
||||
*/
|
||||
if(PP.getGigaDrillBreakerMode() && m.blockBreakSimulate(block, player, plugin)
|
||||
if(PP.getGigaDrillBreakerMode() && m.blockBreakSimulate(block, player)
|
||||
&& Excavation.canBeGigaDrillBroken(block) && m.isShovel(inhand))
|
||||
{
|
||||
int x = 0;
|
||||
@ -339,7 +339,7 @@ public class mcBlockListener extends BlockListener
|
||||
* BERSERK MODE CHECKS
|
||||
*/
|
||||
if(PP.getBerserkMode()
|
||||
&& m.blockBreakSimulate(block, player, plugin)
|
||||
&& m.blockBreakSimulate(block, player)
|
||||
&& player.getItemInHand().getTypeId() == 0
|
||||
&& (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78))
|
||||
{
|
||||
@ -363,7 +363,7 @@ public class mcBlockListener extends BlockListener
|
||||
*/
|
||||
if(PP.getSuperBreakerMode()
|
||||
&& Mining.canBeSuperBroken(block)
|
||||
&& m.blockBreakSimulate(block, player, plugin))
|
||||
&& m.blockBreakSimulate(block, player))
|
||||
{
|
||||
|
||||
if(LoadProperties.miningrequirespickaxe)
|
||||
@ -378,7 +378,7 @@ public class mcBlockListener extends BlockListener
|
||||
/*
|
||||
* LEAF BLOWER
|
||||
*/
|
||||
if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getSkillLevel(SkillType.WOODCUTTING) >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player, plugin))
|
||||
if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getSkillLevel(SkillType.WOODCUTTING) >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player))
|
||||
{
|
||||
m.damageTool(player, (short)1);
|
||||
if(Math.random() * 10 > 9)
|
||||
|
@ -24,6 +24,7 @@ import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.command.Commands;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
@ -112,7 +113,7 @@ public class mcPlayerListener extends PlayerListener
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), LoadProperties.mcmmo}));
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
|
||||
}
|
||||
if(plugin.xpevent)
|
||||
if(Commands.xpevent)
|
||||
player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
|
||||
}
|
||||
|
||||
@ -124,8 +125,6 @@ public class mcPlayerListener extends PlayerListener
|
||||
Action action = event.getAction();
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
|
||||
|
||||
//Archery Nerf
|
||||
if(player.getItemInHand().getTypeId() == 261 && LoadProperties.archeryFireRateLimit)
|
||||
{
|
||||
@ -179,12 +178,12 @@ public class mcPlayerListener extends PlayerListener
|
||||
boolean pass = false;
|
||||
if(Herbalism.hasSeeds(player) && mcPermissions.getInstance().herbalism(player)){
|
||||
Herbalism.removeSeeds(player);
|
||||
if(LoadProperties.enableCobbleToMossy && m.blockBreakSimulate(block, player, plugin) && block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){
|
||||
if(LoadProperties.enableCobbleToMossy && m.blockBreakSimulate(block, player) && block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GreenThumb"));
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
pass = true;
|
||||
}
|
||||
if(block.getType() == Material.DIRT && m.blockBreakSimulate(block, player, plugin) && Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){
|
||||
if(block.getType() == Material.DIRT && m.blockBreakSimulate(block, player) && Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GreenThumb"));
|
||||
block.setType(Material.GRASS);
|
||||
pass = true;
|
||||
|
@ -4,16 +4,10 @@ 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;
|
||||
import com.gmail.nossr50.contrib.SpoutStuff;
|
||||
|
||||
public class mcSpoutListener extends SpoutListener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
public mcSpoutListener(mcMMO pluginx)
|
||||
{
|
||||
plugin = pluginx;
|
||||
}
|
||||
public void onSpoutCraftEnable(SpoutCraftEnableEvent event)
|
||||
{
|
||||
if(event.getPlayer().isSpoutCraftEnabled())
|
||||
|
@ -5,13 +5,12 @@ import java.io.FileReader;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.config.*;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
|
||||
@ -110,11 +109,11 @@ public class m
|
||||
return x;
|
||||
}
|
||||
|
||||
public static boolean blockBreakSimulate(Block block, Player player, Plugin plugin)
|
||||
public static boolean blockBreakSimulate(Block block, Player player)
|
||||
{
|
||||
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
|
||||
if(block != null && plugin != null && player != null){
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
if(block != null && player != null){
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled())
|
||||
{
|
||||
return true; //Return true if not cancelled
|
||||
@ -307,7 +306,7 @@ public class m
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static void convertToMySQL(Plugin pluginx)
|
||||
public static void convertToMySQL()
|
||||
{
|
||||
if(!LoadProperties.useMySQL)
|
||||
return;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@ import java.io.ObjectOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
@ -78,9 +79,9 @@ public class Party
|
||||
return x;
|
||||
}
|
||||
|
||||
public void informPartyMembers(Player player) {
|
||||
Player[] players = plugin.getPlayersOnline();
|
||||
informPartyMembers(player, players);
|
||||
public void informPartyMembers(Player player)
|
||||
{
|
||||
informPartyMembers(player, Bukkit.getServer().getOnlinePlayers());
|
||||
}
|
||||
|
||||
|
||||
@ -102,8 +103,7 @@ public class Party
|
||||
|
||||
public void informPartyMembersOwnerChange(String newOwner) {
|
||||
Player newOwnerPlayer = plugin.getServer().getPlayer(newOwner);
|
||||
Player[] players = plugin.getPlayersOnline();
|
||||
informPartyMembersOwnerChange(newOwnerPlayer, players);
|
||||
informPartyMembersOwnerChange(newOwnerPlayer, Bukkit.getServer().getOnlinePlayers());
|
||||
}
|
||||
|
||||
public void informPartyMembersOwnerChange(Player newOwner, Player[] players) {
|
||||
@ -120,9 +120,9 @@ public class Party
|
||||
}
|
||||
}
|
||||
|
||||
public void informPartyMembersQuit(Player player) {
|
||||
Player[] players = plugin.getPlayersOnline();
|
||||
informPartyMembersQuit(player, players);
|
||||
public void informPartyMembersQuit(Player player)
|
||||
{
|
||||
informPartyMembersQuit(player, Bukkit.getServer().getOnlinePlayers());
|
||||
}
|
||||
|
||||
public void informPartyMembersQuit(Player player, Player[] players)
|
||||
|
Loading…
Reference in New Issue
Block a user