mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
mcMMO -> All changes up to 0.6.2
vStopFire -> All changes up to 1.1 WoolPlus -> All changes up to 1.2 vPlayersOnline -> All changes up to 1.5
This commit is contained in:
parent
09ca2b3b0d
commit
38f24bee62
@ -1,152 +1,161 @@
|
|||||||
Changelog:
|
Changelog:
|
||||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
|
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
|
||||||
Version 0.5.17
|
Version 0.6.2
|
||||||
|
Axes now do critical strikes against farm animals
|
||||||
Changed namespaces to fit bukkits new standard
|
Removed the "Stupidly Long Constructor"
|
||||||
Adjusted excavation proc rates
|
Now compatible with the latest CB builds
|
||||||
Modified excavation loot tables
|
Version 0.6.1
|
||||||
Added Party Invite System
|
Customizable command names
|
||||||
|
Axes can now be modified with /mmoedit
|
||||||
Version 0.5.16
|
Party members are now correctly informed when you leave the party
|
||||||
|
Fixed incorrect commands in /mcc
|
||||||
Fixed unarmed not checking for permissions when hitting players
|
Version 0.5.17
|
||||||
|
|
||||||
Version 0.5.15
|
Changed namespaces to fit bukkits new standard
|
||||||
Fixed stone swords not being recognized as swords
|
Adjusted excavation proc rates
|
||||||
Fixed /a not working if you were an op but did not have permissions
|
Modified excavation loot tables
|
||||||
|
Added Party Invite System
|
||||||
Version 0.5.14
|
|
||||||
Added permissions for skills
|
Version 0.5.16
|
||||||
|
|
||||||
Version 0.5.13
|
Fixed unarmed not checking for permissions when hitting players
|
||||||
|
|
||||||
Removed skillgain from succesful parries
|
Version 0.5.15
|
||||||
Repair now refreshed the inventory
|
Fixed stone swords not being recognized as swords
|
||||||
|
Fixed /a not working if you were an op but did not have permissions
|
||||||
Version 0.5.12
|
|
||||||
|
Version 0.5.14
|
||||||
Fixed being able to hurt party members with the bow and arrow
|
Added permissions for skills
|
||||||
|
|
||||||
Version 0.5.11
|
Version 0.5.13
|
||||||
|
|
||||||
Added /mmoedit command
|
Removed skillgain from succesful parries
|
||||||
Fixed bug preventing player versus player damage
|
Repair now refreshed the inventory
|
||||||
Fixed bug preventing damage from scaling with unarmed & bows
|
|
||||||
Fixed disarm proc making the opponent dupe his/her items
|
Version 0.5.12
|
||||||
Added mcmmo.tools.mmoedit permission
|
|
||||||
Added mcmmo.commands.setmyspawn permission
|
Fixed being able to hurt party members with the bow and arrow
|
||||||
Added totalskill to /stats
|
|
||||||
Changed the look of /stats
|
Version 0.5.11
|
||||||
|
|
||||||
Version 0.5.10
|
Added /mmoedit command
|
||||||
|
Fixed bug preventing player versus player damage
|
||||||
Fixed trying to set health to an invalid value
|
Fixed bug preventing damage from scaling with unarmed & bows
|
||||||
|
Fixed disarm proc making the opponent dupe his/her items
|
||||||
Version 0.5.9
|
Added mcmmo.tools.mmoedit permission
|
||||||
|
Added mcmmo.commands.setmyspawn permission
|
||||||
Fixed duping inventories on death
|
Added totalskill to /stats
|
||||||
|
Changed the look of /stats
|
||||||
Version 0.5.8
|
|
||||||
|
Version 0.5.10
|
||||||
Fixed bug where players inventories would dupe during combat
|
|
||||||
|
Fixed trying to set health to an invalid value
|
||||||
Version 0.5.7
|
|
||||||
|
Version 0.5.9
|
||||||
Fixed monsters instant killing players
|
|
||||||
Misc fixes
|
Fixed duping inventories on death
|
||||||
Version 0.5.4
|
|
||||||
|
Version 0.5.8
|
||||||
Changed herbalism skill gain from wheat to be WAAAAY slower
|
|
||||||
|
Fixed bug where players inventories would dupe during combat
|
||||||
Version 0.5.3
|
|
||||||
|
Version 0.5.7
|
||||||
Players will now correctly drop their inventories when killed by a monster
|
|
||||||
|
Fixed monsters instant killing players
|
||||||
Version 0.5.2
|
Misc fixes
|
||||||
|
Version 0.5.4
|
||||||
Fixed MAJOR bug preventing swords skill from gaining through combat
|
|
||||||
|
Changed herbalism skill gain from wheat to be WAAAAY slower
|
||||||
Version 0.5
|
|
||||||
|
Version 0.5.3
|
||||||
Archery Added
|
|
||||||
Swords Added
|
Players will now correctly drop their inventories when killed by a monster
|
||||||
Acrobatics Added
|
|
||||||
Logging for Party/Admin chat added
|
Version 0.5.2
|
||||||
Fixed whois to show correct values for Excavation
|
|
||||||
Made death messages much much more specific
|
Fixed MAJOR bug preventing swords skill from gaining through combat
|
||||||
|
|
||||||
Version 0.4.4
|
Version 0.5
|
||||||
|
|
||||||
Fixed being able to repair full durability iron tools
|
Archery Added
|
||||||
Fixed herbalism benefits not behaving properly
|
Swords Added
|
||||||
Fixed removing 1 diamond from every stack of diamond when repairing diamond
|
Acrobatics Added
|
||||||
|
Logging for Party/Admin chat added
|
||||||
Version 0.4.2
|
Fixed whois to show correct values for Excavation
|
||||||
|
Made death messages much much more specific
|
||||||
Removed myspawn from the motd
|
|
||||||
|
Version 0.4.4
|
||||||
Version 0.4.1
|
|
||||||
|
Fixed being able to repair full durability iron tools
|
||||||
Fixed /mcc showing incorrect command for herbalism
|
Fixed herbalism benefits not behaving properly
|
||||||
Changed unarmed skillrate to be much slower than before
|
Fixed removing 1 diamond from every stack of diamond when repairing diamond
|
||||||
Modified a few skill descriptions
|
|
||||||
Added permission for /whois
|
Version 0.4.2
|
||||||
Players can now use admin chat without being op as long as they have the correct permission (requires Permissions)
|
|
||||||
|
Removed myspawn from the motd
|
||||||
Version 0.4
|
|
||||||
|
Version 0.4.1
|
||||||
Permissions support
|
|
||||||
Removed OPs having different names than normal players
|
Fixed /mcc showing incorrect command for herbalism
|
||||||
Removed /setspawn & /spawn
|
Changed unarmed skillrate to be much slower than before
|
||||||
Slowed down excavation skill rate
|
Modified a few skill descriptions
|
||||||
Fixed excavation coal drop being too rare
|
Added permission for /whois
|
||||||
|
Players can now use admin chat without being op as long as they have the correct permission (requires Permissions)
|
||||||
Version 0.3.4
|
|
||||||
|
Version 0.4
|
||||||
Creepers now give double xp for unarmed
|
|
||||||
Iron armor can now be repaired!
|
Permissions support
|
||||||
Fixed bug stopping items from being repaired
|
Removed OPs having different names than normal players
|
||||||
|
Removed /setspawn & /spawn
|
||||||
Version 0.3.3
|
Slowed down excavation skill rate
|
||||||
|
Fixed excavation coal drop being too rare
|
||||||
Yet another herbalism skill gain tweak
|
|
||||||
|
Version 0.3.4
|
||||||
Version 0.3.2
|
|
||||||
|
Creepers now give double xp for unarmed
|
||||||
Changed excavation loot tables to be more rewarding
|
Iron armor can now be repaired!
|
||||||
Changed sand to give normal excavation xp instead of double xp
|
Fixed bug stopping items from being repaired
|
||||||
Fixed herbalism skill exploit
|
|
||||||
Mobs killed with unarmed now drop loot properly
|
Version 0.3.3
|
||||||
Unarmed xp rate depends on mob (zombies lowest fyi)
|
|
||||||
Huge player crashing bug fix on disarm!
|
Yet another herbalism skill gain tweak
|
||||||
|
|
||||||
Version 0.3.1
|
Version 0.3.2
|
||||||
|
|
||||||
Fixed excavation not saving properly
|
Changed excavation loot tables to be more rewarding
|
||||||
Fixed repair using excavation values
|
Changed sand to give normal excavation xp instead of double xp
|
||||||
|
Fixed herbalism skill exploit
|
||||||
Version 0.3
|
Mobs killed with unarmed now drop loot properly
|
||||||
|
Unarmed xp rate depends on mob (zombies lowest fyi)
|
||||||
Unarmed skill
|
Huge player crashing bug fix on disarm!
|
||||||
Herbalism skill
|
|
||||||
Excavation skill
|
Version 0.3.1
|
||||||
Many bugfixes (thanks for reporting them!)
|
|
||||||
/<skillname> - Detailed information about skills in game
|
Fixed excavation not saving properly
|
||||||
|
Fixed repair using excavation values
|
||||||
Version 0.2.1
|
|
||||||
|
Version 0.3
|
||||||
Misc bugfixes
|
|
||||||
|
Unarmed skill
|
||||||
Version 0.2
|
Herbalism skill
|
||||||
|
Excavation skill
|
||||||
Repair ability added
|
Many bugfixes (thanks for reporting them!)
|
||||||
Repair skill added
|
/<skillname> - Detailed information about skills in game
|
||||||
Iron Armor repair temporarily disabled
|
|
||||||
Anvils (Iron Block) added
|
Version 0.2.1
|
||||||
/mcmmo & /mcc added
|
|
||||||
Misc changes to existing commands
|
Misc bugfixes
|
||||||
Misc bug fixes
|
|
||||||
|
Version 0.2
|
||||||
Version 0.1
|
|
||||||
|
Repair ability added
|
||||||
Releasing my awesome plugin
|
Repair skill added
|
||||||
|
Iron Armor repair temporarily disabled
|
||||||
|
Anvils (Iron Block) added
|
||||||
|
/mcmmo & /mcc added
|
||||||
|
Misc changes to existing commands
|
||||||
|
Misc bug fixes
|
||||||
|
|
||||||
|
Version 0.1
|
||||||
|
|
||||||
|
Releasing my awesome plugin
|
||||||
|
@ -1,117 +1,117 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.block.BlockListener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class mcBlockListener extends BlockListener {
|
public class mcBlockListener extends BlockListener {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public mcBlockListener(final mcMMO plugin) {
|
public mcBlockListener(final mcMMO plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
Block block;
|
Block block;
|
||||||
if (event.getBlockReplacedState().getTypeId() == 78) {
|
if (event.getBlockReplacedState().getTypeId() == 78) {
|
||||||
block = event.getBlockAgainst();
|
block = event.getBlockAgainst();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block = event.getBlock();
|
block = event.getBlock();
|
||||||
}
|
}
|
||||||
int x = block.getX();
|
int x = block.getX();
|
||||||
int y = block.getY();
|
int y = block.getY();
|
||||||
int z = block.getZ();
|
int z = block.getZ();
|
||||||
String xyz = x+","+y+","+z;
|
String xyz = x+","+y+","+z;
|
||||||
mcConfig.getInstance().addBlockWatch(block);
|
mcConfig.getInstance().addBlockWatch(block);
|
||||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
mcConfig.getInstance().addCoordsWatch(xyz);
|
||||||
if(block.getTypeId() == 42)
|
if(block.getTypeId() == 42)
|
||||||
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
|
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
|
||||||
}
|
}
|
||||||
//put all Block related code here
|
//put all Block related code here
|
||||||
public void onBlockDamage(BlockDamageEvent event) {
|
public void onBlockDamage(BlockDamageEvent event) {
|
||||||
//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
|
//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
int x = block.getX();
|
int x = block.getX();
|
||||||
int y = block.getY();
|
int y = block.getY();
|
||||||
int z = block.getZ();
|
int z = block.getZ();
|
||||||
String xyz = x+","+y+","+z;
|
String xyz = x+","+y+","+z;
|
||||||
int type = block.getTypeId();
|
int type = block.getTypeId();
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
int dmg = event.getDamageLevel().getLevel();
|
int dmg = event.getDamageLevel().getLevel();
|
||||||
/*
|
/*
|
||||||
* MINING
|
* MINING
|
||||||
*/
|
*/
|
||||||
if(dmg == 3 && !mcConfig.getInstance().isBlockWatched(block) && !mcConfig.getInstance().isCoordsWatched(xyz)){
|
if(dmg == 3 && !mcConfig.getInstance().isBlockWatched(block) && !mcConfig.getInstance().isCoordsWatched(xyz)){
|
||||||
if(mcPermissions.getInstance().mining(player))
|
if(mcPermissions.getInstance().mining(player))
|
||||||
mcm.getInstance().miningBlockCheck(player, block);
|
mcm.getInstance().miningBlockCheck(player, block);
|
||||||
/*
|
/*
|
||||||
* WOOD CUTTING
|
* WOOD CUTTING
|
||||||
*/
|
*/
|
||||||
if(block.getTypeId() == 17
|
if(block.getTypeId() == 17
|
||||||
&& mcPermissions.getInstance().woodcutting(player)){
|
&& mcPermissions.getInstance().woodcutting(player)){
|
||||||
mcUsers.getProfile(player).addwgather(1);
|
mcUsers.getProfile(player).addwgather(1);
|
||||||
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
||||||
}
|
}
|
||||||
mcm.getInstance().simulateSkillUp(player);
|
mcm.getInstance().simulateSkillUp(player);
|
||||||
/*
|
/*
|
||||||
* EXCAVATION
|
* EXCAVATION
|
||||||
*/
|
*/
|
||||||
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
|
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
|
||||||
mcm.getInstance().excavationProcCheck(block, player);
|
mcm.getInstance().excavationProcCheck(block, player);
|
||||||
/*
|
/*
|
||||||
* HERBALISM
|
* HERBALISM
|
||||||
*/
|
*/
|
||||||
if(!(type == 39 || type == 40 || type == 37 || type == 38)
|
if(!(type == 39 || type == 40 || type == 37 || type == 38)
|
||||||
&& mcPermissions.getInstance().herbalism(player));
|
&& mcPermissions.getInstance().herbalism(player));
|
||||||
mcm.getInstance().herbalismProcCheck(block, player); //You place the blocks so we wont check if they are being watched
|
mcm.getInstance().herbalismProcCheck(block, player); //You place the blocks so we wont check if they are being watched
|
||||||
/*
|
/*
|
||||||
* EXPLOIT COUNTERMEASURES
|
* EXPLOIT COUNTERMEASURES
|
||||||
*/
|
*/
|
||||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
mcConfig.getInstance().addCoordsWatch(xyz);
|
||||||
mcConfig.getInstance().addBlockWatch(block);
|
mcConfig.getInstance().addBlockWatch(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onBlockFlow(BlockFromToEvent event) {
|
public void onBlockFlow(BlockFromToEvent event) {
|
||||||
//Code borrowed from WorldGuard by sk89q
|
//Code borrowed from WorldGuard by sk89q
|
||||||
World world = event.getBlock().getWorld();
|
World world = event.getBlock().getWorld();
|
||||||
int radius = 1;
|
int radius = 1;
|
||||||
Block blockFrom = event.getBlock();
|
Block blockFrom = event.getBlock();
|
||||||
Block blockTo = event.getToBlock();
|
Block blockTo = event.getToBlock();
|
||||||
|
|
||||||
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
||||||
|
|
||||||
int ox = blockTo.getX();
|
int ox = blockTo.getX();
|
||||||
int oy = blockTo.getY();
|
int oy = blockTo.getY();
|
||||||
int oz = blockTo.getZ();
|
int oz = blockTo.getZ();
|
||||||
|
|
||||||
if(blockTo.getTypeId() == 9 || blockTo.getTypeId() == 8){
|
if(blockTo.getTypeId() == 9 || blockTo.getTypeId() == 8){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int cx = -radius; cx <= radius; cx++) {
|
for (int cx = -radius; cx <= radius; cx++) {
|
||||||
for (int cy = -radius; cy <= radius; cy++) {
|
for (int cy = -radius; cy <= radius; cy++) {
|
||||||
for (int cz = -radius; cz <= radius; cz++) {
|
for (int cz = -radius; cz <= radius; cz++) {
|
||||||
Block dirt = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
Block dirt = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||||
//If block is dirt
|
//If block is dirt
|
||||||
if (isWater == true &&
|
if (isWater == true &&
|
||||||
dirt.getTypeId() == 13) {
|
dirt.getTypeId() == 13) {
|
||||||
//Change
|
//Change
|
||||||
dirt.setTypeId(82);
|
dirt.setTypeId(82);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,56 +1,56 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class mcConfig {
|
public class mcConfig {
|
||||||
private static volatile mcConfig instance;
|
private static volatile mcConfig instance;
|
||||||
String location = "mcmmo.properties";
|
String location = "mcmmo.properties";
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
static ArrayList<String> adminChatList = new ArrayList<String>();
|
static ArrayList<String> adminChatList = new ArrayList<String>();
|
||||||
static ArrayList<String> coordsWatchList = new ArrayList<String>();
|
static ArrayList<String> coordsWatchList = new ArrayList<String>();
|
||||||
static ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
static ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
||||||
static ArrayList<String> partyChatList = new ArrayList<String>();
|
static ArrayList<String> partyChatList = new ArrayList<String>();
|
||||||
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
|
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
|
||||||
public boolean isCoordsWatched(String xyz) {return coordsWatchList.contains(xyz);}
|
public boolean isCoordsWatched(String xyz) {return coordsWatchList.contains(xyz);}
|
||||||
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
|
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
|
||||||
public void removeCoordsWatch(String xyz) {coordsWatchList.remove(coordsWatchList.indexOf(xyz));}
|
public void removeCoordsWatch(String xyz) {coordsWatchList.remove(coordsWatchList.indexOf(xyz));}
|
||||||
public void addBlockWatch(Block block) {blockWatchList.add(block);}
|
public void addBlockWatch(Block block) {blockWatchList.add(block);}
|
||||||
public void addCoordsWatch(String xyz) {coordsWatchList.add(xyz);}
|
public void addCoordsWatch(String xyz) {coordsWatchList.add(xyz);}
|
||||||
public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);}
|
public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);}
|
||||||
public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);}
|
public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);}
|
||||||
public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));}
|
public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));}
|
||||||
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
||||||
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
||||||
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
||||||
|
|
||||||
public static mcConfig getInstance() {
|
public static mcConfig getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new mcConfig();
|
instance = new mcConfig();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
public void toggleAdminChat(String playerName){
|
public void toggleAdminChat(String playerName){
|
||||||
if(isAdminToggled(playerName)){
|
if(isAdminToggled(playerName)){
|
||||||
removeAdminToggled(playerName);
|
removeAdminToggled(playerName);
|
||||||
} else {
|
} else {
|
||||||
addAdminToggled(playerName);
|
addAdminToggled(playerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void togglePartyChat(String playerName){
|
public void togglePartyChat(String playerName){
|
||||||
if(isPartyToggled(playerName)){
|
if(isPartyToggled(playerName)){
|
||||||
removePartyToggled(playerName);
|
removePartyToggled(playerName);
|
||||||
} else {
|
} else {
|
||||||
addPartyToggled(playerName);
|
addPartyToggled(playerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,365 +1,131 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.entity.Spider;
|
import org.bukkit.entity.Spider;
|
||||||
import org.bukkit.entity.Squid;
|
import org.bukkit.entity.Squid;
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
import org.bukkit.event.entity.EntityListener;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class mcEntityListener extends EntityListener {
|
public class mcEntityListener extends EntityListener {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public mcEntityListener(final mcMMO plugin) {
|
public mcEntityListener(final mcMMO plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
public boolean isBow(ItemStack is){
|
||||||
Entity x = event.getEntity(); //Defender
|
if (is.getTypeId() == 261){
|
||||||
Entity y = event.getDamager(); //Attacker
|
return true;
|
||||||
/*
|
} else {
|
||||||
* IF DEFENDER IS PLAYER
|
return false;
|
||||||
*/
|
}
|
||||||
if(x instanceof Player){
|
}
|
||||||
Player defender = (Player)x;
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
/*
|
Entity x = event.getEntity();
|
||||||
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
DamageCause type = event.getCause();
|
||||||
*/
|
/*
|
||||||
mcm.getInstance().parryCheck(defender, event, y);
|
* ACROBATICS
|
||||||
/*
|
*/
|
||||||
* PLAYER DEATH BY MONSTER MESSAGE CHECK, CHECKS TO SEE IF TO REPORT THE DEATH OR NOT
|
if(x instanceof Player){
|
||||||
*/
|
Player player = (Player)x;
|
||||||
mcm.getInstance().playerDeathByMonsterMessageCheck(y, defender, plugin);
|
Location loc = player.getLocation();
|
||||||
/*
|
int xx = loc.getBlockX();
|
||||||
* CHECKS IF THE PLAYER DIES, IF SO DROP HIS SHIT BECAUSE OF THE DAMAGE MODIFIERS
|
int y = loc.getBlockY();
|
||||||
* MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST...
|
int z = loc.getBlockZ();
|
||||||
*/
|
if(type == DamageCause.FALL){
|
||||||
|
mcm.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
|
||||||
}
|
}
|
||||||
/*
|
}
|
||||||
* IF ATTACKER IS PLAYER
|
/*
|
||||||
*/
|
* ARCHERY CHECKS
|
||||||
if(y instanceof Player){
|
*/
|
||||||
int type = ((Player) y).getItemInHand().getTypeId();
|
if(event instanceof EntityDamageByProjectileEvent){
|
||||||
Player attacker = (Player)y;
|
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
|
||||||
/*
|
mcm.getInstance().archeryCheck(c);
|
||||||
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
|
}
|
||||||
*/
|
/*
|
||||||
mcm.getInstance().playerVersusMonsterChecks(event, attacker, x, type);
|
* Entity Damage by Entity checks
|
||||||
/*
|
*/
|
||||||
* Player versus Squid checks, this handles all skill damage modifiers and any procs.
|
if(event instanceof EntityDamageByEntityEvent){
|
||||||
*/
|
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event;
|
||||||
mcm.getInstance().playerVersusSquidChecks(event, attacker, x, type);
|
Entity e = eventb.getEntity(); //Defender
|
||||||
/*
|
Entity f = eventb.getDamager(); //Attacker
|
||||||
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
|
/*
|
||||||
*/
|
* IF DEFENDER IS PLAYER
|
||||||
mcm.getInstance().playerVersusPlayerChecks(x, attacker, event, plugin);
|
*/
|
||||||
/*
|
if(e instanceof Player){
|
||||||
* Player versus Animals checks, these checks handle any skill modifiers or procs
|
Player defender = (Player)e;
|
||||||
*/
|
/*
|
||||||
mcm.getInstance().playerVersusAnimalsChecks(x, attacker, event, type);
|
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
||||||
}
|
*/
|
||||||
}
|
mcm.getInstance().parryCheck(defender, eventb, f);
|
||||||
public boolean isBow(ItemStack is){
|
/*
|
||||||
if (is.getTypeId() == 261){
|
* PLAYER DEATH BY MONSTER MESSAGE CHECK, CHECKS TO SEE IF TO REPORT THE DEATH OR NOT
|
||||||
return true;
|
*/
|
||||||
} else {
|
//mcm.getInstance().playerDeathByMonsterMessageCheck(y, defender, plugin);
|
||||||
return false;
|
/*
|
||||||
}
|
* CHECKS IF THE PLAYER DIES, IF SO DROP HIS SHIT BECAUSE OF THE DAMAGE MODIFIERS
|
||||||
}
|
* MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST...
|
||||||
|
*/
|
||||||
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
|
|
||||||
Entity y = event.getDamager();
|
}
|
||||||
Entity x = event.getEntity();
|
/*
|
||||||
/*
|
* IF ATTACKER IS PLAYER
|
||||||
* Defender is player
|
*/
|
||||||
*/
|
if(f instanceof Player){
|
||||||
if(y instanceof Player){
|
//((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!");
|
||||||
Player attacker = (Player)y;
|
int typeid = ((Player) f).getItemInHand().getTypeId();
|
||||||
/*
|
Player attacker = (Player)f;
|
||||||
* DEBUG MESSAGE
|
/*
|
||||||
*/
|
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
|
||||||
//attacker.sendMessage(event.getProjectile().toString());
|
*/
|
||||||
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
|
mcm.getInstance().playerVersusMonsterChecks(eventb, attacker, e, typeid);
|
||||||
/*
|
/*
|
||||||
* Defender is Monster
|
* Player versus Squid checks, this handles all skill damage modifiers and any procs.
|
||||||
*/
|
*/
|
||||||
if(x instanceof Monster){
|
mcm.getInstance().playerVersusSquidChecks(eventb, attacker, e, typeid);
|
||||||
Monster defender = (Monster)x;
|
/*
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
*/
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
mcm.getInstance().playerVersusPlayerChecks(e, attacker, eventb, plugin);
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
/*
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
* Player versus Animals checks, these checks handle any skill modifiers or procs
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
*/
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
mcm.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
}
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
}
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
}
|
||||||
if(defender.getHealth() <= 0)
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
mcm.getInstance().simulateNaturalDrops(defender);
|
Entity x = event.getEntity();
|
||||||
//XP
|
if(x instanceof Player){
|
||||||
if(Math.random() * 10 > 7){
|
Player player = (Player)x;
|
||||||
mcUsers.getProfile(attacker).skillUpArchery(1);
|
if(mcUsers.getProfile(player).isDead()){
|
||||||
attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by 1. Total ("+mcUsers.getProfile(attacker).getArchery()+")");
|
mcUsers.getProfile(player).setDead(false);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
/*
|
}
|
||||||
* Defender is Animals
|
}
|
||||||
*/
|
public boolean isPlayer(Entity entity){
|
||||||
if(x instanceof Animals){
|
if (entity instanceof Player) {
|
||||||
Animals defender = (Animals)x;
|
return true;
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
} else{
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
return false;
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
}
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
}
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
}
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
|
||||||
if(defender.getHealth() <= 0)
|
|
||||||
mcm.getInstance().simulateNaturalDrops(defender);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Defender is Squid
|
|
||||||
*/
|
|
||||||
if(x instanceof Squid){
|
|
||||||
Squid defender = (Squid)x;
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
|
||||||
if(defender.getHealth() <= 0)
|
|
||||||
mcm.getInstance().simulateNaturalDrops(defender);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Attacker is Player
|
|
||||||
*/
|
|
||||||
if(x instanceof Player){
|
|
||||||
if(mcLoadProperties.pvp == false){
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Player defender = (Player)x;
|
|
||||||
/*
|
|
||||||
* Stuff for the daze proc
|
|
||||||
*/
|
|
||||||
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
|
|
||||||
if(mcm.getInstance().inSameParty(defender, attacker)){
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Location loc = defender.getLocation();
|
|
||||||
if(Math.random() * 10 > 5){
|
|
||||||
loc.setPitch(90);
|
|
||||||
} else {
|
|
||||||
loc.setPitch(-90);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Check the proc
|
|
||||||
*/
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 300 && mcUsers.getProfile(attacker).getArcheryInt() < 400){
|
|
||||||
if(Math.random() * 10 > 7){
|
|
||||||
defender.teleportTo(loc);
|
|
||||||
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
|
|
||||||
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 600){
|
|
||||||
if(Math.random() * 10 > 4){
|
|
||||||
defender.teleportTo(loc);
|
|
||||||
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
|
|
||||||
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
|
||||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
|
||||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
|
||||||
if(defender.getHealth() >= 0){
|
|
||||||
if(mcUsers.getProfile(defender).isDead())
|
|
||||||
return;
|
|
||||||
if(defender.getHealth() <= 0){
|
|
||||||
mcUsers.getProfile(defender).setDead(true);
|
|
||||||
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
|
||||||
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with an arrow.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mcUsers.getProfile(defender).isDead())
|
|
||||||
return;
|
|
||||||
if(defender.getHealth() - event.getDamage() <= 0){
|
|
||||||
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
|
||||||
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with the bow and arrow.");
|
|
||||||
mcUsers.getProfile(defender).setDead(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
|
||||||
Entity x = event.getEntity();
|
|
||||||
if(x instanceof Player){
|
|
||||||
Player player = (Player)x;
|
|
||||||
DamageCause type = event.getCause();
|
|
||||||
Location loc = player.getLocation();
|
|
||||||
int xx = loc.getBlockX();
|
|
||||||
int y = loc.getBlockY();
|
|
||||||
int z = loc.getBlockZ();
|
|
||||||
if(type == DamageCause.FALL){
|
|
||||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50
|
|
||||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 250
|
|
||||||
&& mcPermissions.getInstance().acrobatics(player)){
|
|
||||||
if(Math.random() * 10 > 8){
|
|
||||||
event.setCancelled(true);
|
|
||||||
player.sendMessage("**ROLLED**");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250
|
|
||||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 450
|
|
||||||
&& mcPermissions.getInstance().acrobatics(player)){
|
|
||||||
if(Math.random() * 10 > 6){
|
|
||||||
event.setCancelled(true);
|
|
||||||
player.sendMessage("**ROLLED**");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450
|
|
||||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 750
|
|
||||||
&& mcPermissions.getInstance().acrobatics(player)){
|
|
||||||
if(Math.random() * 10 > 4){
|
|
||||||
event.setCancelled(true);
|
|
||||||
player.sendMessage("**ROLLED**");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750
|
|
||||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 950
|
|
||||||
&& mcPermissions.getInstance().acrobatics(player)){
|
|
||||||
if(Math.random() * 10 > 2){
|
|
||||||
event.setCancelled(true);
|
|
||||||
player.sendMessage("**BARREL ROLLED**");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950
|
|
||||||
&& mcPermissions.getInstance().acrobatics(player)){
|
|
||||||
event.setCancelled(true);
|
|
||||||
player.sendMessage("**ROLLED... LIKE A BOSS**");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(player.getHealth() - event.getDamage() <= 0)
|
|
||||||
return;
|
|
||||||
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
|
|
||||||
&& mcPermissions.getInstance().acrobatics(player)){
|
|
||||||
if(event.getDamage() >= 2 && event.getDamage() < 6){
|
|
||||||
mcUsers.getProfile(player).skillUpAcrobatics(1);
|
|
||||||
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 1. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
|
|
||||||
}
|
|
||||||
if(event.getDamage() >= 6 && event.getDamage() < 19){
|
|
||||||
mcUsers.getProfile(player).skillUpAcrobatics(2);
|
|
||||||
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 2. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
|
|
||||||
}
|
|
||||||
if(event.getDamage() >= 19){
|
|
||||||
mcUsers.getProfile(player).skillUpAcrobatics(3);
|
|
||||||
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 3. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
|
|
||||||
if(player.getHealth() - event.getDamage() <= 0){
|
|
||||||
if(mcUsers.getProfile(player).isDead())
|
|
||||||
return;
|
|
||||||
mcUsers.getProfile(player).setDead(true);
|
|
||||||
for(Player bidoof : plugin.getServer().getOnlinePlayers()){
|
|
||||||
bidoof.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.DARK_RED+"fallen "+ChatColor.GRAY+"to death.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(type == DamageCause.DROWNING){
|
|
||||||
if(mcUsers.getProfile(player).isDead())
|
|
||||||
return;
|
|
||||||
if(player.getHealth() - event.getDamage() <= 0){
|
|
||||||
mcUsers.getProfile(player).setDead(true);
|
|
||||||
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
|
|
||||||
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.AQUA+"drowned.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if(type == DamageCause.FIRE || type == DamageCause.FIRE_TICK){
|
|
||||||
if(mcUsers.getProfile(player).isDead())
|
|
||||||
return;
|
|
||||||
if(player.getHealth() - event.getDamage() <= 0){
|
|
||||||
mcUsers.getProfile(player).setDead(true);
|
|
||||||
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
|
|
||||||
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.RED+"burned "+ChatColor.GRAY+"to death.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if(type == DamageCause.LAVA){
|
|
||||||
if(mcUsers.getProfile(player).isDead())
|
|
||||||
return;
|
|
||||||
if(player.getHealth() - event.getDamage() <= 0){
|
|
||||||
mcUsers.getProfile(player).setDead(true);
|
|
||||||
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
|
|
||||||
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.RED+"melted "+ChatColor.GRAY+".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void onEntityDeath(EntityDeathEvent event) {
|
|
||||||
Entity x = event.getEntity();
|
|
||||||
if(x instanceof Player){
|
|
||||||
Player player = (Player)x;
|
|
||||||
if(mcUsers.getProfile(player).isDead()){
|
|
||||||
mcUsers.getProfile(player).setDead(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
|
||||||
derp.sendMessage(ChatColor.GRAY+player.getName()+" has died.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public boolean isPlayer(Entity entity){
|
|
||||||
if (entity instanceof Player) {
|
|
||||||
return true;
|
|
||||||
} else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -2,13 +2,17 @@ package com.gmail.nossr50;
|
|||||||
|
|
||||||
public class mcLoadProperties {
|
public class mcLoadProperties {
|
||||||
public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal;
|
public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal;
|
||||||
|
public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept;
|
||||||
|
|
||||||
public static void loadMain(){
|
public static void loadMain(){
|
||||||
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
|
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
|
||||||
mcProperties properties = new mcProperties(propertiesFile);
|
mcProperties properties = new mcProperties(propertiesFile);
|
||||||
properties.load();
|
properties.load();
|
||||||
|
|
||||||
//Grab properties stuff here
|
|
||||||
|
/*
|
||||||
|
* EXCAVATION LOOT TOGGLES
|
||||||
|
*/
|
||||||
glowstone = properties.getBoolean("glowstone", true);
|
glowstone = properties.getBoolean("glowstone", true);
|
||||||
pvp = properties.getBoolean("pvp", true);
|
pvp = properties.getBoolean("pvp", true);
|
||||||
eggs = properties.getBoolean("eggs", true);
|
eggs = properties.getBoolean("eggs", true);
|
||||||
@ -20,7 +24,21 @@ public class mcLoadProperties {
|
|||||||
sulphur = properties.getBoolean("sulphur", true);
|
sulphur = properties.getBoolean("sulphur", true);
|
||||||
netherrack = properties.getBoolean("netherrack", true);
|
netherrack = properties.getBoolean("netherrack", true);
|
||||||
bones = properties.getBoolean("bones", true);
|
bones = properties.getBoolean("bones", true);
|
||||||
properties.save("==McMMO Configuration==");
|
/*
|
||||||
|
* CUSTOM COMMANDS
|
||||||
|
*/
|
||||||
|
mcmmo = properties.getString("mcmmo", "mcmmo");
|
||||||
|
mcc = properties.getString("mcc", "mcc");
|
||||||
|
stats = properties.getString("stats", "stats");
|
||||||
|
mmoedit = properties.getString("mmoedit", "mmoedit");
|
||||||
|
ptp = properties.getString("ptp", "ptp");
|
||||||
|
party = properties.getString("party", "party");
|
||||||
|
myspawn = properties.getString("myspawn", "myspawn");
|
||||||
|
setmyspawn = properties.getString("setmyspawn", "setmyspawn");
|
||||||
|
whois = properties.getString("whois", "whois");
|
||||||
|
invite = properties.getString("invite", "invite");
|
||||||
|
accept = properties.getString("accept", "accept");
|
||||||
|
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
|
//herp derp
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,125 +1,127 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.nijiko.Messaging;
|
import com.nijiko.Messaging;
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
import com.nijiko.permissions.Control;
|
import com.nijiko.permissions.Control;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.PluginLoader;
|
import org.bukkit.plugin.PluginLoader;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class mcMMO extends JavaPlugin {
|
public class mcMMO extends JavaPlugin {
|
||||||
static String maindirectory = "mcMMO/";
|
static String maindirectory = "mcMMO/";
|
||||||
static File Properties = new File(maindirectory + "mcmmo.properties");
|
static File Properties = new File(maindirectory + "mcmmo.properties");
|
||||||
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 HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
||||||
private final String name = "mcMMO";
|
private final String name = "mcMMO";
|
||||||
public static PermissionHandler PermissionsHandler = null;
|
public static PermissionHandler PermissionsHandler = null;
|
||||||
private Permissions permissions;
|
private Permissions permissions;
|
||||||
|
|
||||||
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
/*
|
||||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
||||||
}
|
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
||||||
|
}
|
||||||
public void onEnable() {
|
*/
|
||||||
//Make the directory if it does not exist
|
//herp
|
||||||
new File(maindirectory).mkdir();
|
public void onEnable() {
|
||||||
//Make the file if it does not exist
|
//Make the directory if it does not exist
|
||||||
if(!Properties.exists()){
|
new File(maindirectory).mkdir();
|
||||||
try {
|
//Make the file if it does not exist
|
||||||
Properties.createNewFile();
|
if(!Properties.exists()){
|
||||||
FileWriter writer = null;
|
try {
|
||||||
try {
|
Properties.createNewFile();
|
||||||
writer = new FileWriter(Properties);
|
FileWriter writer = null;
|
||||||
writer.append("#Turn this setting to false to disable pvp interactions completely");
|
try {
|
||||||
writer.append("pvp=true");
|
writer = new FileWriter(Properties);
|
||||||
writer.append("#Excavation Loot Toggles");
|
writer.append("#Turn this setting to false to disable pvp interactions completely");
|
||||||
writer.append("eggs=true");
|
writer.append("pvp=true");
|
||||||
writer.append("apples=true");
|
writer.append("#Excavation Loot Toggles");
|
||||||
writer.append("cake=true");
|
writer.append("eggs=true");
|
||||||
writer.append("music=true");
|
writer.append("apples=true");
|
||||||
writer.append("diamond=true");
|
writer.append("cake=true");
|
||||||
writer.append("glowstone=true");
|
writer.append("music=true");
|
||||||
writer.append("slowsand=true");
|
writer.append("diamond=true");
|
||||||
writer.append("netherrack=true");
|
writer.append("glowstone=true");
|
||||||
writer.append("bones=true");
|
writer.append("slowsand=true");
|
||||||
writer.append("sulphur=true");
|
writer.append("netherrack=true");
|
||||||
writer.append("coal=true");
|
writer.append("bones=true");
|
||||||
writer.append("#Appreciate the plugin? Send me a donation via paypal nossr50@gmail.com\r\n");
|
writer.append("sulphur=true");
|
||||||
} catch (Exception e) {
|
writer.append("coal=true");
|
||||||
log.log(Level.SEVERE, "Exception while creating " + Properties, e);
|
writer.append("mcmmo=mcmmo");
|
||||||
} finally {
|
writer.append("mcc=mcc");
|
||||||
try {
|
writer.append("stats=stats");
|
||||||
if (writer != null) {
|
writer.append("#Appreciate the plugin? Send me a donation via paypal nossr50@gmail.com\r\n");
|
||||||
writer.close();
|
} catch (Exception e) {
|
||||||
}
|
log.log(Level.SEVERE, "Exception while creating " + Properties, e);
|
||||||
} catch (IOException e) {
|
} finally {
|
||||||
log.log(Level.SEVERE, "Exception while closing writer for " + Properties, e);
|
try {
|
||||||
}
|
if (writer != null) {
|
||||||
}
|
writer.close();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.log(Level.SEVERE, "Exception while closing writer for " + Properties, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Load the file
|
|
||||||
mcLoadProperties.loadMain();
|
} catch (IOException e) {
|
||||||
mcUsers.getInstance().loadUsers();
|
e.printStackTrace();
|
||||||
PluginManager pm = getServer().getPluginManager();
|
}
|
||||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
}
|
||||||
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
|
//Load the file
|
||||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
mcLoadProperties.loadMain();
|
||||||
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
mcUsers.getInstance().loadUsers();
|
||||||
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
PluginManager pm = getServer().getPluginManager();
|
||||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
|
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_BLOCK, entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
||||||
//Displays a message when plugin is loaded
|
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
|
||||||
mcPermissions.initialize(getServer());
|
//Displays a message when plugin is loaded
|
||||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
}
|
mcPermissions.initialize(getServer());
|
||||||
public void setupPermissions() {
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
}
|
||||||
if(this.PermissionsHandler == null) {
|
public void setupPermissions() {
|
||||||
if(test != null) {
|
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||||
this.PermissionsHandler = ((Permissions)test).getHandler();
|
if(this.PermissionsHandler == null) {
|
||||||
} else {
|
if(test != null) {
|
||||||
log.info(Messaging.bracketize(name) + " Permission system not enabled. Disabling plugin.");
|
this.PermissionsHandler = ((Permissions)test).getHandler();
|
||||||
this.getServer().getPluginManager().disablePlugin(this);
|
} else {
|
||||||
}
|
log.info(Messaging.bracketize(name) + " Permission system not enabled. Disabling plugin.");
|
||||||
}
|
this.getServer().getPluginManager().disablePlugin(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public Permissions getPermissions() {
|
}
|
||||||
return permissions;
|
|
||||||
}
|
public Permissions getPermissions() {
|
||||||
public void onDisable() {
|
return permissions;
|
||||||
System.out.println("mcMMO was disabled.");
|
}
|
||||||
}
|
public void onDisable() {
|
||||||
}
|
System.out.println("mcMMO was disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,171 +1,171 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
|
|
||||||
public class mcPermissions {
|
public class mcPermissions {
|
||||||
//Thanks to myWarp source code for helping me figure this shit out!
|
//Thanks to myWarp source code for helping me figure this shit out!
|
||||||
private static Permissions permissionsPlugin;
|
private static Permissions permissionsPlugin;
|
||||||
private static boolean permissionsEnabled = false;
|
private static boolean permissionsEnabled = false;
|
||||||
private static volatile mcPermissions instance;
|
private static volatile mcPermissions instance;
|
||||||
|
|
||||||
public static void initialize(Server server) {
|
public static void initialize(Server server) {
|
||||||
Plugin test = server.getPluginManager().getPlugin("Permissions");
|
Plugin test = server.getPluginManager().getPlugin("Permissions");
|
||||||
if (test != null) {
|
if (test != null) {
|
||||||
Logger log = Logger.getLogger("Minecraft");
|
Logger log = Logger.getLogger("Minecraft");
|
||||||
permissionsPlugin = ((Permissions) test);
|
permissionsPlugin = ((Permissions) test);
|
||||||
permissionsEnabled = true;
|
permissionsEnabled = true;
|
||||||
log.log(Level.INFO, "[mcMMO] Permissions enabled.");
|
log.log(Level.INFO, "[mcMMO] Permissions enabled.");
|
||||||
} else {
|
} else {
|
||||||
Logger log = Logger.getLogger("Minecraft");
|
Logger log = Logger.getLogger("Minecraft");
|
||||||
log.log(Level.SEVERE, "[mcMMO] Permissions isn't loaded, there are no restrictions.");
|
log.log(Level.SEVERE, "[mcMMO] Permissions isn't loaded, there are no restrictions.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private boolean permission(Player player, String string) {
|
private boolean permission(Player player, String string) {
|
||||||
return permissionsPlugin.Security.permission(player, string);
|
return permissionsPlugin.Security.permission(player, string);
|
||||||
}
|
}
|
||||||
public boolean mmoedit(Player player) {
|
public boolean mmoedit(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.tools.mmoedit");
|
return permission(player, "mcmmo.tools.mmoedit");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean motd(Player player) {
|
public boolean motd(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.motd");
|
return permission(player, "mcmmo.motd");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean mySpawn(Player player) {
|
public boolean mySpawn(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.commands.myspawn");
|
return permission(player, "mcmmo.commands.myspawn");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean setMySpawn(Player player) {
|
public boolean setMySpawn(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.commands.setmyspawn");
|
return permission(player, "mcmmo.commands.setmyspawn");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean partyChat(Player player) {
|
public boolean partyChat(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.chat.partychat");
|
return permission(player, "mcmmo.chat.partychat");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean partyTeleport(Player player) {
|
public boolean partyTeleport(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.commands.ptp");
|
return permission(player, "mcmmo.commands.ptp");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean whois(Player player) {
|
public boolean whois(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.commands.whois");
|
return permission(player, "mcmmo.commands.whois");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean party(Player player) {
|
public boolean party(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.commands.party");
|
return permission(player, "mcmmo.commands.party");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean adminChat(Player player) {
|
public boolean adminChat(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.chat.adminchat");
|
return permission(player, "mcmmo.chat.adminchat");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static mcPermissions getInstance() {
|
public static mcPermissions getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new mcPermissions();
|
instance = new mcPermissions();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
public boolean mining(Player player) {
|
public boolean mining(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.mining");
|
return permission(player, "mcmmo.skills.mining");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean woodcutting(Player player) {
|
public boolean woodcutting(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.woodcutting");
|
return permission(player, "mcmmo.skills.woodcutting");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean repair(Player player) {
|
public boolean repair(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.repair");
|
return permission(player, "mcmmo.skills.repair");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean unarmed(Player player) {
|
public boolean unarmed(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.unarmed");
|
return permission(player, "mcmmo.skills.unarmed");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean archery(Player player) {
|
public boolean archery(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.archery");
|
return permission(player, "mcmmo.skills.archery");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean herbalism(Player player) {
|
public boolean herbalism(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.herbalism");
|
return permission(player, "mcmmo.skills.herbalism");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean excavation(Player player) {
|
public boolean excavation(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.excavation");
|
return permission(player, "mcmmo.skills.excavation");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean swords(Player player) {
|
public boolean swords(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.swords");
|
return permission(player, "mcmmo.skills.swords");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean axes(Player player) {
|
public boolean axes(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.axes");
|
return permission(player, "mcmmo.skills.axes");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean acrobatics(Player player) {
|
public boolean acrobatics(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.acrobatics");
|
return permission(player, "mcmmo.skills.acrobatics");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,375 +1,377 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.event.player.PlayerItemEvent;
|
import org.bukkit.event.player.PlayerItemEvent;
|
||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
|
|
||||||
public class mcPlayerListener extends PlayerListener {
|
public class mcPlayerListener extends PlayerListener {
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
public Location spawn = null;
|
public Location spawn = null;
|
||||||
private mcMMO plugin;
|
private mcMMO plugin;
|
||||||
|
|
||||||
public mcPlayerListener(mcMMO instance) {
|
public mcPlayerListener(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(mcPermissions.getInstance().mySpawn(player)){
|
if(mcPermissions.getInstance().mySpawn(player)){
|
||||||
if(mcUsers.getProfile(player).getMySpawn(player) != null)
|
if(mcUsers.getProfile(player).getMySpawn(player) != null)
|
||||||
event.setRespawnLocation(mcUsers.getProfile(player).getMySpawn(player));
|
event.setRespawnLocation(mcUsers.getProfile(player).getMySpawn(player));
|
||||||
}
|
}
|
||||||
//HELLO CODE PEAKERS!
|
//HELLO CODE PEAKERS!
|
||||||
}
|
}
|
||||||
public Player[] getPlayersOnline() {
|
public Player[] getPlayersOnline() {
|
||||||
return plugin.getServer().getOnlinePlayers();
|
return plugin.getServer().getOnlinePlayers();
|
||||||
}
|
}
|
||||||
public boolean isPlayer(String playerName){
|
public boolean isPlayer(String playerName){
|
||||||
for(Player herp : getPlayersOnline()){
|
for(Player herp : getPlayersOnline()){
|
||||||
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public Player getPlayer(String playerName){
|
public Player getPlayer(String playerName){
|
||||||
for(Player herp : getPlayersOnline()){
|
for(Player herp : getPlayersOnline()){
|
||||||
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
||||||
return herp;
|
return herp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public int partyCount(Player player){
|
public int partyCount(Player player){
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(Player hurrdurr: getPlayersOnline()){
|
for(Player hurrdurr: getPlayersOnline()){
|
||||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty()))
|
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty()))
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
public void informPartyMembers(Player player){
|
public void informPartyMembers(Player player){
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(Player p : getPlayersOnline()){
|
for(Player p : getPlayersOnline()){
|
||||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has joined your party");
|
p.sendMessage(player.getName() + ChatColor.GREEN + " has joined your party");
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void informPartyMembersQuit(Player player){
|
public void informPartyMembersQuit(Player player){
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(Player p : getPlayersOnline()){
|
for(Player p : getPlayersOnline()){
|
||||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has left your party");
|
p.sendMessage(player.getName() + ChatColor.GREEN + " has left your party");
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void onPlayerJoin(PlayerEvent event) {
|
public void onPlayerJoin(PlayerEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
mcUsers.addUser(player);
|
mcUsers.addUser(player);
|
||||||
if(mcPermissions.getInstance().motd(player)){
|
if(mcPermissions.getInstance().motd(player)){
|
||||||
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type "+ChatColor.YELLOW+"/mcmmo "+ChatColor.BLUE+ "for help.");
|
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Check if string is a player
|
//Check if string is a player
|
||||||
|
|
||||||
public void onPlayerItem(PlayerItemEvent event) {
|
public void onPlayerItem(PlayerItemEvent event) {
|
||||||
Block block = event.getBlockClicked();
|
Block block = event.getBlockClicked();
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
ItemStack is = player.getItemInHand();
|
ItemStack is = player.getItemInHand();
|
||||||
if(mcPermissions.getInstance().herbalism(player)){
|
if(mcPermissions.getInstance().herbalism(player)){
|
||||||
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||||
mcm.getInstance().breadCheck(player, is);
|
mcm.getInstance().breadCheck(player, is);
|
||||||
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||||
mcm.getInstance().stewCheck(player, is);
|
mcm.getInstance().stewCheck(player, is);
|
||||||
}
|
}
|
||||||
if(mcPermissions.getInstance().repair(player)){
|
if(mcPermissions.getInstance().repair(player)){
|
||||||
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
||||||
mcm.getInstance().repairCheck(player, is, block);
|
mcm.getInstance().repairCheck(player, is, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerCommand(PlayerChatEvent event) {
|
public void onPlayerCommand(PlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
String[] split = event.getMessage().split(" ");
|
String[] split = event.getMessage().split(" ");
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
//Check if the command is an mcMMO related help command
|
//Check if the command is an mcMMO related help command
|
||||||
mcm.getInstance().mcmmoHelpCheck(split, player, event);
|
mcm.getInstance().mcmmoHelpCheck(split, player, event);
|
||||||
if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/mmoedit")){
|
if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){
|
||||||
if(split.length < 3){
|
if(split.length < 3){
|
||||||
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
|
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.mmoedit+" playername skillname newvalue");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length == 4){
|
if(split.length == 4){
|
||||||
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcm.getInstance().isSkill(split[2])){
|
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcm.getInstance().isSkill(split[2])){
|
||||||
int newvalue = Integer.valueOf(split[3]);
|
int newvalue = Integer.valueOf(split[3]);
|
||||||
mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]);
|
mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]);
|
||||||
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(split.length == 3){
|
else if(split.length == 3){
|
||||||
if(mcm.getInstance().isInt(split[2]) && mcm.getInstance().isSkill(split[1])){
|
if(mcm.getInstance().isInt(split[2]) && mcm.getInstance().isSkill(split[1])){
|
||||||
int newvalue = Integer.valueOf(split[2]);
|
int newvalue = Integer.valueOf(split[2]);
|
||||||
mcUsers.getProfile(player).modifyskill(newvalue, split[1]);
|
mcUsers.getProfile(player).modifyskill(newvalue, split[1]);
|
||||||
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
|
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
|
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(!mcPermissions.getInstance().partyTeleport(player)){
|
if(!mcPermissions.getInstance().partyTeleport(player)){
|
||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length < 2){
|
if(split.length < 2){
|
||||||
player.sendMessage(ChatColor.RED+"Usage is /ptp <playername>");
|
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.ptp+" <playername>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(isPlayer(split[1])){
|
if(isPlayer(split[1])){
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){
|
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){
|
||||||
player.teleportTo(target);
|
player.teleportTo(target);
|
||||||
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
||||||
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
|
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/whois")){
|
if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/"+mcLoadProperties.whois)){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(split.length < 2){
|
if(split.length < 2){
|
||||||
player.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
|
player.sendMessage(ChatColor.RED + "Proper usage is /"+mcLoadProperties.whois+" <playername>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if split[1] is a player
|
//if split[1] is a player
|
||||||
if(isPlayer(split[1])){
|
if(isPlayer(split[1])){
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
double x,y,z;
|
double x,y,z;
|
||||||
x = target.getLocation().getX();
|
x = target.getLocation().getX();
|
||||||
y = target.getLocation().getY();
|
y = target.getLocation().getY();
|
||||||
z = target.getLocation().getZ();
|
z = target.getLocation().getZ();
|
||||||
player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~");
|
player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~");
|
||||||
player.sendMessage(target.getName());
|
player.sendMessage(target.getName());
|
||||||
if(mcUsers.getProfile(target).inParty())
|
if(mcUsers.getProfile(target).inParty())
|
||||||
player.sendMessage("Party: "+mcUsers.getProfile(target).getParty());
|
player.sendMessage("Party: "+mcUsers.getProfile(target).getParty());
|
||||||
player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)");
|
player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)");
|
||||||
player.sendMessage("OP: " + target.isOp());
|
player.sendMessage("OP: " + target.isOp());
|
||||||
player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~");
|
player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~");
|
||||||
player.sendMessage("Mining Skill: "+mcUsers.getProfile(target).getMining());
|
player.sendMessage("Mining Skill: "+mcUsers.getProfile(target).getMining());
|
||||||
player.sendMessage("Repair Skill: "+mcUsers.getProfile(target).getRepair());
|
player.sendMessage("Repair Skill: "+mcUsers.getProfile(target).getRepair());
|
||||||
player.sendMessage("Woodcutting Skill: "+mcUsers.getProfile(target).getWoodCutting());
|
player.sendMessage("Woodcutting Skill: "+mcUsers.getProfile(target).getWoodCutting());
|
||||||
player.sendMessage("Unarmed Skill: "+mcUsers.getProfile(target).getUnarmed());
|
player.sendMessage("Unarmed Skill: "+mcUsers.getProfile(target).getUnarmed());
|
||||||
player.sendMessage("Herbalism Skill: "+mcUsers.getProfile(target).getHerbalism());
|
player.sendMessage("Herbalism Skill: "+mcUsers.getProfile(target).getHerbalism());
|
||||||
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation());
|
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation());
|
||||||
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery());
|
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery());
|
||||||
player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords());
|
player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords());
|
||||||
player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes());
|
player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes());
|
||||||
player.sendMessage("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics());
|
player.sendMessage("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics());
|
||||||
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
||||||
player.sendMessage("X: "+x);
|
player.sendMessage("X: "+x);
|
||||||
player.sendMessage("Y: "+y);
|
player.sendMessage("Y: "+y);
|
||||||
player.sendMessage("Z: "+z);
|
player.sendMessage("Z: "+z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/setmyspawn")){
|
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){
|
||||||
if(!mcPermissions.getInstance().setMySpawn(player)){
|
if(!mcPermissions.getInstance().setMySpawn(player)){
|
||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
double x = player.getLocation().getX();
|
double x = player.getLocation().getX();
|
||||||
double y = player.getLocation().getY();
|
double y = player.getLocation().getY();
|
||||||
double z = player.getLocation().getZ();
|
double z = player.getLocation().getZ();
|
||||||
mcUsers.getProfile(player).setMySpawn(x, y, z);
|
mcUsers.getProfile(player).setMySpawn(x, y, z);
|
||||||
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
|
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/stats")){
|
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
|
player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
|
||||||
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining());
|
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair());
|
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting());
|
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed());
|
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism());
|
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation());
|
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery());
|
player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords());
|
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords());
|
||||||
player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes());
|
player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics());
|
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics());
|
||||||
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+
|
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+
|
||||||
(mcUsers.getProfile(player).getAcrobaticsInt()+
|
(mcUsers.getProfile(player).getAcrobaticsInt()+
|
||||||
mcUsers.getProfile(player).getArcheryInt()+
|
mcUsers.getProfile(player).getArcheryInt()+
|
||||||
mcUsers.getProfile(player).getAxesInt()+
|
mcUsers.getProfile(player).getAxesInt()+
|
||||||
mcUsers.getProfile(player).getExcavationInt()+
|
mcUsers.getProfile(player).getExcavationInt()+
|
||||||
mcUsers.getProfile(player).getHerbalismInt()+
|
mcUsers.getProfile(player).getHerbalismInt()+
|
||||||
mcUsers.getProfile(player).getMiningInt()+
|
mcUsers.getProfile(player).getMiningInt()+
|
||||||
mcUsers.getProfile(player).getRepairInt()+
|
mcUsers.getProfile(player).getRepairInt()+
|
||||||
mcUsers.getProfile(player).getSwordsInt()+
|
mcUsers.getProfile(player).getSwordsInt()+
|
||||||
mcUsers.getProfile(player).getUnarmedInt()+
|
mcUsers.getProfile(player).getUnarmedInt()+
|
||||||
mcUsers.getProfile(player).getWoodCuttingint())
|
mcUsers.getProfile(player).getWoodCuttingint())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//Invite Command
|
//Invite Command
|
||||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/invite")){
|
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
|
||||||
if(!mcUsers.getProfile(player).inParty()){
|
if(!mcUsers.getProfile(player).inParty()){
|
||||||
player.sendMessage(ChatColor.RED+"You are not in a party.");
|
player.sendMessage(ChatColor.RED+"You are not in a party.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length < 2){
|
if(split.length < 2){
|
||||||
player.sendMessage(ChatColor.RED+"Usage is /invite <playername");
|
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.invite+" <playername>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).inParty() && split.length >= 2 && isPlayer(split[1])){
|
if(mcUsers.getProfile(player).inParty() && split.length >= 2 && isPlayer(split[1])){
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty());
|
mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty());
|
||||||
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
|
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
|
||||||
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite());
|
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite());
|
||||||
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/accept"+ChatColor.YELLOW+" to accept the invite");
|
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/"+mcLoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Accept invite
|
//Accept invite
|
||||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/accept")){
|
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
|
||||||
if(mcUsers.getProfile(player).hasPartyInvite()){
|
if(mcUsers.getProfile(player).hasPartyInvite()){
|
||||||
if(mcUsers.getProfile(player).inParty()){
|
if(mcUsers.getProfile(player).inParty()){
|
||||||
informPartyMembersQuit(player);
|
informPartyMembersQuit(player);
|
||||||
}
|
}
|
||||||
mcUsers.getProfile(player).acceptInvite();
|
mcUsers.getProfile(player).acceptInvite();
|
||||||
informPartyMembers(player);
|
informPartyMembers(player);
|
||||||
player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")");
|
player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")");
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED+"You have no invites at this time");
|
player.sendMessage(ChatColor.RED+"You have no invites at this time");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Party command
|
//Party command
|
||||||
if(split[0].equalsIgnoreCase("/party")){
|
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.party)){
|
||||||
if(!mcPermissions.getInstance().party(player)){
|
if(!mcPermissions.getInstance().party(player)){
|
||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){
|
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){
|
||||||
player.sendMessage("Proper usage is /party <name> or 'q' to quit");
|
player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length == 1 && mcUsers.getProfile(player).inParty()){
|
if(split.length == 1 && mcUsers.getProfile(player).inParty()){
|
||||||
String tempList = "";
|
String tempList = "";
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){
|
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){
|
||||||
if(p != null && x+1 >= partyCount(player)){
|
if(p != null && x+1 >= partyCount(player)){
|
||||||
tempList+= p.getName();
|
tempList+= p.getName();
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
if(p != null && x < partyCount(player)){
|
if(p != null && x < partyCount(player)){
|
||||||
tempList+= p.getName() +", ";
|
tempList+= p.getName() +", ";
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.sendMessage(ChatColor.GREEN+"You are in party \""+mcUsers.getProfile(player).getParty()+"\"");
|
player.sendMessage(ChatColor.GREEN+"You are in party \""+mcUsers.getProfile(player).getParty()+"\"");
|
||||||
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
|
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
|
||||||
}
|
}
|
||||||
if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){
|
if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){
|
||||||
informPartyMembersQuit(player);
|
informPartyMembersQuit(player);
|
||||||
mcUsers.getProfile(player).removeParty();
|
mcUsers.getProfile(player).removeParty();
|
||||||
player.sendMessage(ChatColor.RED + "You have left that party");
|
player.sendMessage(ChatColor.RED + "You have left that party");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length >= 2){
|
if(split.length >= 2){
|
||||||
mcUsers.getProfile(player).setParty(split[1]);
|
if(mcUsers.getProfile(player).inParty())
|
||||||
player.sendMessage("Joined Party: " + split[1]);
|
informPartyMembersQuit(player);
|
||||||
informPartyMembers(player);
|
mcUsers.getProfile(player).setParty(split[1]);
|
||||||
}
|
player.sendMessage("Joined Party: " + split[1]);
|
||||||
}
|
informPartyMembers(player);
|
||||||
if(split[0].equalsIgnoreCase("/p")){
|
}
|
||||||
if(!mcPermissions.getInstance().party(player)){
|
}
|
||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
if(split[0].equalsIgnoreCase("/p")){
|
||||||
return;
|
if(!mcPermissions.getInstance().party(player)){
|
||||||
}
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
event.setCancelled(true);
|
return;
|
||||||
if(mcConfig.getInstance().isAdminToggled(player.getName()))
|
}
|
||||||
mcConfig.getInstance().toggleAdminChat(playerName);
|
event.setCancelled(true);
|
||||||
mcConfig.getInstance().togglePartyChat(playerName);
|
if(mcConfig.getInstance().isAdminToggled(player.getName()))
|
||||||
if(mcConfig.getInstance().isPartyToggled(playerName)){
|
mcConfig.getInstance().toggleAdminChat(playerName);
|
||||||
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On");
|
mcConfig.getInstance().togglePartyChat(playerName);
|
||||||
} else {
|
if(mcConfig.getInstance().isPartyToggled(playerName)){
|
||||||
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
|
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On");
|
||||||
}
|
} else {
|
||||||
}
|
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
|
||||||
if(split[0].equalsIgnoreCase("/a") && (player.isOp() || mcPermissions.getInstance().adminChat(player))){
|
}
|
||||||
if(!mcPermissions.getInstance().adminChat(player) && !player.isOp()){
|
}
|
||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
if(split[0].equalsIgnoreCase("/a") && (player.isOp() || mcPermissions.getInstance().adminChat(player))){
|
||||||
return;
|
if(!mcPermissions.getInstance().adminChat(player) && !player.isOp()){
|
||||||
}
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
event.setCancelled(true);
|
return;
|
||||||
if(mcConfig.getInstance().isPartyToggled(player.getName()))
|
}
|
||||||
mcConfig.getInstance().togglePartyChat(playerName);
|
event.setCancelled(true);
|
||||||
mcConfig.getInstance().toggleAdminChat(playerName);
|
if(mcConfig.getInstance().isPartyToggled(player.getName()))
|
||||||
if(mcConfig.getInstance().isAdminToggled(playerName)){
|
mcConfig.getInstance().togglePartyChat(playerName);
|
||||||
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
|
mcConfig.getInstance().toggleAdminChat(playerName);
|
||||||
} else {
|
if(mcConfig.getInstance().isAdminToggled(playerName)){
|
||||||
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
|
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
|
||||||
}
|
} else {
|
||||||
}
|
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
|
||||||
if(split[0].equalsIgnoreCase("/myspawn")){
|
}
|
||||||
if(!mcPermissions.getInstance().mySpawn(player)){
|
}
|
||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.myspawn)){
|
||||||
return;
|
if(!mcPermissions.getInstance().mySpawn(player)){
|
||||||
}
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
event.setCancelled(true);
|
return;
|
||||||
if(mcUsers.getProfile(player).getMySpawn(player) != null){
|
}
|
||||||
player.getInventory().clear();
|
event.setCancelled(true);
|
||||||
player.setHealth(20);
|
if(mcUsers.getProfile(player).getMySpawn(player) != null){
|
||||||
player.teleportTo(mcUsers.getProfile(player).getMySpawn(player));
|
player.getInventory().clear();
|
||||||
player.sendMessage("Inventory cleared & health restored");
|
player.setHealth(20);
|
||||||
}else{
|
player.teleportTo(mcUsers.getProfile(player).getMySpawn(player));
|
||||||
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
player.sendMessage("Inventory cleared & health restored");
|
||||||
}
|
}else{
|
||||||
}
|
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
||||||
}
|
}
|
||||||
public void onPlayerChat(PlayerChatEvent event) {
|
}
|
||||||
Player player = event.getPlayer();
|
}
|
||||||
String[] split = event.getMessage().split(" ");
|
public void onPlayerChat(PlayerChatEvent event) {
|
||||||
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
|
Player player = event.getPlayer();
|
||||||
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
|
String[] split = event.getMessage().split(" ");
|
||||||
if(mcConfig.getInstance().isPartyToggled(player.getName())){
|
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
|
||||||
event.setCancelled(true);
|
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
|
||||||
log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
if(mcConfig.getInstance().isPartyToggled(player.getName())){
|
||||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
event.setCancelled(true);
|
||||||
if(mcUsers.getProfile(herp).inParty()){
|
log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
||||||
if(mcm.getInstance().inSameParty(herp, player)){
|
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||||
herp.sendMessage(x+event.getMessage());
|
if(mcUsers.getProfile(herp).inParty()){
|
||||||
}
|
if(mcm.getInstance().inSameParty(herp, player)){
|
||||||
}
|
herp.sendMessage(x+event.getMessage());
|
||||||
}
|
}
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
if((player.isOp() || mcPermissions.getInstance().adminChat(player))
|
return;
|
||||||
&& mcConfig.getInstance().isAdminToggled(player.getName())){
|
}
|
||||||
log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage());
|
if((player.isOp() || mcPermissions.getInstance().adminChat(player))
|
||||||
event.setCancelled(true);
|
&& mcConfig.getInstance().isAdminToggled(player.getName())){
|
||||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage());
|
||||||
if(herp.isOp()){
|
event.setCancelled(true);
|
||||||
herp.sendMessage(y+event.getMessage());
|
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||||
}
|
if(herp.isOp()){
|
||||||
}
|
herp.sendMessage(y+event.getMessage());
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,3 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.gmail.nossr50.mcMMO
|
main: com.gmail.nossr50.mcMMO
|
||||||
version: 0.6
|
version: 0.6.2
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.gmail.nossr50.vPlayersOnline;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle events for all Player related events
|
||||||
|
* @author nossr50
|
||||||
|
*/
|
||||||
|
public class vPlayerListener extends PlayerListener {
|
||||||
|
private final vPlayersOnline plugin;
|
||||||
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
|
public vPlayerListener(vPlayersOnline instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
//Function to count the players
|
||||||
|
public int playerCount(){
|
||||||
|
Player players[] = plugin.getServer().getOnlinePlayers();
|
||||||
|
int x = 0;
|
||||||
|
for(Player hurrdurr: players){
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Message to be sent when a player joins
|
||||||
|
public void onPlayerJoin(PlayerEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
//English Version
|
||||||
|
player.sendMessage(ChatColor.GREEN + "There are " + playerCount() + " players online.");
|
||||||
|
}
|
||||||
|
//Message to be sent when a player uses /list
|
||||||
|
public void onPlayerCommand(PlayerChatEvent event) {
|
||||||
|
String[] split = event.getMessage().split(" ");
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if(split[0].equalsIgnoreCase("/list") || split[0].equalsIgnoreCase("/who")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
String tempList = "";
|
||||||
|
int x = 0;
|
||||||
|
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||||
|
{
|
||||||
|
if(p != null && x+1 >= playerCount()){
|
||||||
|
tempList+= p.getName();
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
if(p != null && x < playerCount()){
|
||||||
|
tempList+= p.getName() +", ";
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Output the player list
|
||||||
|
player.sendMessage(ChatColor.RED + "Player List"+ChatColor.WHITE+" ("+ChatColor.WHITE + tempList+")");
|
||||||
|
player.sendMessage(ChatColor.RED + "Total Players: " + ChatColor.GREEN + playerCount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.gmail.nossr50.vPlayersOnline;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.Event.Priority;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
import org.bukkit.plugin.PluginLoader;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vPlayersOnline for Bukkit
|
||||||
|
*
|
||||||
|
* @author nossr50
|
||||||
|
*/
|
||||||
|
public class vPlayersOnline extends JavaPlugin {
|
||||||
|
private final vPlayerListener playerListener = new vPlayerListener(this);
|
||||||
|
private final String name = "vPlayersOnline";
|
||||||
|
|
||||||
|
public void onEnable() {
|
||||||
|
PluginManager pm = getServer().getPluginManager();
|
||||||
|
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||||
|
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
|
||||||
|
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||||
|
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
||||||
|
//Displays a message when plugin is loaded
|
||||||
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
|
}
|
||||||
|
public void onDisable() {
|
||||||
|
System.out.println("vPlayersOnline disabled.");
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,3 @@
|
|||||||
name: vPlayersOnline
|
name: vPlayersOnline
|
||||||
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
|
main: com.gmail.nossr50.vPlayersOnline.vPlayersOnline
|
||||||
version: 1.3
|
version: 1.5
|
@ -1,29 +1,28 @@
|
|||||||
package com.bukkit.nossr50.vStopFire;
|
package com.bukkit.nossr50.vStopFire;
|
||||||
|
|
||||||
import org.bukkit.Block;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.BlockFace;
|
import org.bukkit.event.block.BlockCanBuildEvent;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockCanBuildEvent;
|
import org.bukkit.event.block.BlockListener;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
|
||||||
|
/**
|
||||||
/**
|
* vStopFire block listener
|
||||||
* vStopFire block listener
|
* @author nossr50
|
||||||
* @author nossr50
|
*/
|
||||||
*/
|
public class vBlockListener extends BlockListener {
|
||||||
public class vBlockListener extends BlockListener {
|
private final vStopFire plugin;
|
||||||
private final vStopFire plugin;
|
|
||||||
|
public vBlockListener(final vStopFire plugin) {
|
||||||
public vBlockListener(final vStopFire plugin) {
|
this.plugin = plugin;
|
||||||
this.plugin = plugin;
|
}
|
||||||
}
|
//This should stop fire from spreading but still allow players to light stuff up with flint and steel
|
||||||
//This should stop fire from spreading but still allow players to light stuff up with flint and steel
|
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
String cause = event.getCause().toString();
|
||||||
String cause = event.getCause().toString();
|
if(cause.equals("SPREAD"))
|
||||||
if(cause.equals("SPREAD"))
|
event.setCancelled(true);
|
||||||
event.setCancelled(true);
|
if(!cause.equals("FLINT_AND_STEEL"))
|
||||||
if(!cause.equals("FLINT_AND_STEEL"))
|
event.setCancelled(true);
|
||||||
event.setCancelled(true);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
package com.bukkit.nossr50.vStopFire;
|
package com.bukkit.nossr50.vStopFire;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle events for all Player related events
|
* Handle events for all Player related events
|
||||||
* @author nossr50
|
* @author nossr50
|
||||||
*/
|
*/
|
||||||
public class vPlayerListener extends PlayerListener {
|
public class vPlayerListener extends PlayerListener {
|
||||||
private final vStopFire plugin;
|
private final vStopFire plugin;
|
||||||
|
|
||||||
public vPlayerListener(vStopFire instance) {
|
public vPlayerListener(vStopFire instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Insert Player related code here
|
//Insert Player related code here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,50 +1,29 @@
|
|||||||
package com.bukkit.nossr50.vStopFire;
|
package com.bukkit.nossr50.vStopFire;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.Player;
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.plugin.PluginLoader;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.PluginLoader;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
/**
|
||||||
import org.bukkit.plugin.PluginManager;
|
* vStopFire for Bukkit
|
||||||
|
*
|
||||||
/**
|
* @author nossr50
|
||||||
* vStopFire for Bukkit
|
*/
|
||||||
*
|
public class vStopFire extends JavaPlugin {
|
||||||
* @author nossr50
|
private final vPlayerListener playerListener = new vPlayerListener(this);
|
||||||
*/
|
private final vBlockListener blockListener = new vBlockListener(this);
|
||||||
public class vStopFire extends JavaPlugin {
|
private final String name = "vStopFire";
|
||||||
private final vPlayerListener playerListener = new vPlayerListener(this);
|
|
||||||
private final vBlockListener blockListener = new vBlockListener(this);
|
public void onEnable() {
|
||||||
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this);
|
||||||
private final String name = "vStopFire";
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
public vStopFire(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
}
|
||||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
public void onDisable() {
|
||||||
}
|
System.out.println("vStopFire disabled!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onEnable() {
|
|
||||||
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this);
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
|
||||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
|
||||||
}
|
|
||||||
public void onDisable() {
|
|
||||||
System.out.println("vStopFire disabled!");
|
|
||||||
}
|
|
||||||
public boolean isDebugging(final Player player) {
|
|
||||||
if (debugees.containsKey(player)) {
|
|
||||||
return debugees.get(player);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDebugging(final Player player, final boolean value) {
|
|
||||||
debugees.put(player, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name: vStopFire
|
name: vStopFire
|
||||||
main: com.bukkit.nossr50.vStopFire.vStopFire
|
main: com.bukkit.nossr50.vStopFire.vStopFire
|
||||||
version: 1.0
|
version: 1.1
|
11
woolplus/com/gmail/nossr50/woolplus/wBlockListener.java
Normal file
11
woolplus/com/gmail/nossr50/woolplus/wBlockListener.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.gmail.nossr50.woolplus;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.event.block.BlockListener;
|
||||||
|
|
||||||
|
public class wBlockListener extends BlockListener {
|
||||||
|
private final woolplus plugin;
|
||||||
|
|
||||||
|
public wBlockListener(final woolplus plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
}
|
306
woolplus/com/gmail/nossr50/woolplus/wPlayerListener.java
Normal file
306
woolplus/com/gmail/nossr50/woolplus/wPlayerListener.java
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
package com.gmail.nossr50.woolplus;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
import org.bukkit.event.player.PlayerItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
|
public class wPlayerListener extends PlayerListener {
|
||||||
|
private final woolplus plugin;
|
||||||
|
|
||||||
|
public wPlayerListener(woolplus instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
public void onPlayerItem(PlayerItemEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
ItemStack item = event.getPlayer().getItemInHand();
|
||||||
|
Block block = event.getBlockClicked();
|
||||||
|
if(block != null && item != null && isDye(item) && isWool(block)){
|
||||||
|
dyeWool(block, item, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isDye(ItemStack item){
|
||||||
|
int type = item.getTypeId();
|
||||||
|
if(type == 351 || type == 352){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isWool(Block block){
|
||||||
|
int type = block.getTypeId();
|
||||||
|
if(type == 35){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isBoneMeal(ItemStack item){
|
||||||
|
int type = item.getTypeId();
|
||||||
|
short durability = item.getDurability();
|
||||||
|
if(type == 351 && durability == 15){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void consumeDye(short type, Player player){
|
||||||
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
|
for (ItemStack x : inventory){
|
||||||
|
if(x.getTypeId() == 351 && x.getDurability() == type){
|
||||||
|
if(x.getAmount() == 1){
|
||||||
|
x.setAmount(0);
|
||||||
|
x.setTypeId(0);
|
||||||
|
}
|
||||||
|
if(x.getAmount() > 1)
|
||||||
|
x.setAmount(x.getAmount() - 1);
|
||||||
|
player.getInventory().setContents(inventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.updateInventory();
|
||||||
|
}
|
||||||
|
public boolean isLightColoredWool(byte wool){
|
||||||
|
if(wool == 4 || wool == 5 || wool == 6 || wool == 9 || wool == 2 || wool == 3){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void dyeWool(Block block, ItemStack item, Player player){
|
||||||
|
MaterialData mdye = item.getData();
|
||||||
|
byte dye = mdye.getData();
|
||||||
|
byte wool = block.getData();
|
||||||
|
short durability = item.getDurability();
|
||||||
|
/*
|
||||||
|
* WOOL LIGHTENING
|
||||||
|
*/
|
||||||
|
//Black dyes everything you know!
|
||||||
|
if(durability == 0 && wool != 15){
|
||||||
|
block.setData((byte) 15);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//BLACK -> GRAY
|
||||||
|
if(wool == 15 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 7);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//GRAY -> LGRAY
|
||||||
|
if(wool == 7 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 8);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//BROWN -> GRAY
|
||||||
|
if(wool == 12 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 7);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//LGRAY -> WHITE
|
||||||
|
if(wool == 8 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 0);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//RED (14) -> PINK (6)
|
||||||
|
if(wool == 14 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 6);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//GREEN13 -> LIME5
|
||||||
|
if(wool == 13 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 5);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//BLUE11 -> CYAN9
|
||||||
|
if(wool == 11 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 9);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//CYAN9 -> LIGHT BLUE3
|
||||||
|
if(wool == 9 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 3);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//PURPLE10 -> MAGENTA2
|
||||||
|
if(wool == 10 && isBoneMeal(item)){
|
||||||
|
block.setData((byte) 2);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* WOOL COMBINATIONS
|
||||||
|
*/
|
||||||
|
//Red + Yellow = Orange
|
||||||
|
//If wool is red, dye is yellow
|
||||||
|
if(wool == 14 && durability == 11){
|
||||||
|
block.setData((byte) 1);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//If wool is yellow, dye is red
|
||||||
|
if(wool == 4 && durability == 1){
|
||||||
|
block.setData((byte) 1);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Lapis + Green = Cyan
|
||||||
|
//if wool is Lapis/Blue, dye is green
|
||||||
|
if(wool == 11 && durability == 2){
|
||||||
|
block.setData((byte) 9);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if wool is Green, dye is lapis
|
||||||
|
if(wool == 13 && durability == 4){
|
||||||
|
block.setData((byte) 9);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Red + Lapis = Purple
|
||||||
|
//if wool is Red, dye is Lapis
|
||||||
|
if(wool == 14 && durability == 4){
|
||||||
|
block.setData((byte) 10);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if wool is Lapis/Blue, dye is red
|
||||||
|
if(wool == 11 && durability == 1){
|
||||||
|
block.setData((byte) 10);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Purple + Pink = Magenta
|
||||||
|
//if wool is Purple, dye is pink
|
||||||
|
if(wool == 10 && durability == 9){
|
||||||
|
block.setData((byte) 2);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if wool is pink, dye is purple
|
||||||
|
if(wool == 6 && durability == 5){
|
||||||
|
block.setData((byte) 2);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* REGULAR DYE SECTION
|
||||||
|
*/
|
||||||
|
if(wool == 0){
|
||||||
|
//orange
|
||||||
|
if(durability == 14){
|
||||||
|
block.setData((byte) 1);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//magenta
|
||||||
|
if (durability == 13){
|
||||||
|
block.setData((byte) 2);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//light blue
|
||||||
|
if(durability == 12){
|
||||||
|
block.setData((byte) 3);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//yellow
|
||||||
|
if(durability == 11){
|
||||||
|
block.setData((byte) 4);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//lime
|
||||||
|
if(durability == 10){
|
||||||
|
block.setData((byte) 5);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//pink
|
||||||
|
if(durability == 9){
|
||||||
|
block.setData((byte) 6);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//gray
|
||||||
|
if(durability == 8){
|
||||||
|
block.setData((byte) 7);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//light gray
|
||||||
|
if(durability == 7){
|
||||||
|
block.setData((byte) 8);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//cyan
|
||||||
|
if(durability == 6){
|
||||||
|
block.setData((byte) 9);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//purple
|
||||||
|
if(durability == 5){
|
||||||
|
block.setData((byte) 10);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//lapis or blue
|
||||||
|
if(durability == 4){
|
||||||
|
block.setData((byte) 11);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//coco or brown
|
||||||
|
if(durability == 3){
|
||||||
|
block.setData((byte) 12);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//green
|
||||||
|
if(durability == 2){
|
||||||
|
block.setData((byte) 13);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//red
|
||||||
|
if(durability == 1){
|
||||||
|
block.setData((byte) 14);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* BROWN CONVERSION
|
||||||
|
*/
|
||||||
|
if(!isBoneMeal(item) && durability != 0 && wool != 12){
|
||||||
|
block.setData((byte) 12);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(isBoneMeal(item) && wool != 0 && !isLightColoredWool(wool)){
|
||||||
|
block.setData((byte) 7);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(isBoneMeal(item) && wool != 0 && isLightColoredWool(wool)){
|
||||||
|
block.setData((byte) 0);
|
||||||
|
consumeDye(item.getDurability(), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
woolplus/com/gmail/nossr50/woolplus/woolplus.java
Normal file
29
woolplus/com/gmail/nossr50/woolplus/woolplus.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package com.gmail.nossr50.woolplus;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.Event.Priority;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
import org.bukkit.plugin.PluginLoader;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wool Plus for Bukkit
|
||||||
|
*
|
||||||
|
* @author nossr50
|
||||||
|
*/
|
||||||
|
public class woolplus extends JavaPlugin {
|
||||||
|
private final wPlayerListener playerListener = new wPlayerListener(this);
|
||||||
|
private final wBlockListener blockListener = new wBlockListener(this);
|
||||||
|
private final String name = "Wool Plus";
|
||||||
|
|
||||||
|
public void onEnable() {
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
|
||||||
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
|
}
|
||||||
|
public void onDisable() {
|
||||||
|
System.out.println("Wool Plus disabled!");
|
||||||
|
}
|
||||||
|
}
|
3
woolplus/plugin.yml
Normal file
3
woolplus/plugin.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name: woolplus
|
||||||
|
main: com.gmail.nossr50.woolplus.woolplus
|
||||||
|
version: 1.2
|
Loading…
Reference in New Issue
Block a user