mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Permissions among other things. v04.1.
This commit is contained in:
parent
b38c682c8c
commit
1798a9ff39
@ -1,7 +1,7 @@
|
|||||||
package com.bukkit.nossr50.mcMMO;
|
package com.bukkit.nossr50.mcMMO;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
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;
|
||||||
@ -10,6 +10,8 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class mcConfig {
|
public class mcConfig {
|
||||||
private static volatile mcConfig instance;
|
private static volatile mcConfig instance;
|
||||||
|
String location = "mcmmo.properties";
|
||||||
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
static ArrayList<String> adminChatList = new ArrayList<String>();
|
static ArrayList<String> adminChatList = 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>();
|
||||||
|
@ -88,13 +88,13 @@ public class mcEntityListener extends EntityListener {
|
|||||||
defender.setHealth(calculateDamage(defender, 8));
|
defender.setHealth(calculateDamage(defender, 8));
|
||||||
}
|
}
|
||||||
//XP
|
//XP
|
||||||
if(x instanceof Skeleton && Math.random() * 10 > 8){
|
if(x instanceof Skeleton && Math.random() * 100 > 95){
|
||||||
if(defender.getHealth() != 0){
|
if(defender.getHealth() != 0){
|
||||||
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
||||||
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(x instanceof Spider&& Math.random() * 10 > 7){
|
if(x instanceof Spider&& Math.random() * 10 > 9){
|
||||||
if(defender.getHealth() != 0){
|
if(defender.getHealth() != 0){
|
||||||
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
||||||
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
@ -106,7 +106,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(x instanceof Creeper && Math.random() * 10 > 7){
|
if(x instanceof Creeper && Math.random() * 100 > 90){
|
||||||
if(defender.getHealth() != 0){
|
if(defender.getHealth() != 0){
|
||||||
mcUsers.getProfile(attacker).skillUpUnarmed(2);
|
mcUsers.getProfile(attacker).skillUpUnarmed(2);
|
||||||
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 2. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 2. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
|
@ -2,6 +2,8 @@ package com.bukkit.nossr50.mcMMO;
|
|||||||
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.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.IOException;
|
import java.io.IOException;
|
||||||
@ -26,7 +28,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
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 Permissions = null;
|
public static PermissionHandler PermissionsHandler = null;
|
||||||
|
private Permissions permissions;
|
||||||
|
|
||||||
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
||||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
||||||
@ -50,21 +53,23 @@ public class mcMMO extends JavaPlugin {
|
|||||||
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
||||||
//Displays a message when plugin is loaded
|
//Displays a message when plugin is loaded
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
mcPermissions.initialize(getServer());
|
||||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
}
|
}
|
||||||
public void setupPermissions() {
|
public void setupPermissions() {
|
||||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||||
|
if(this.PermissionsHandler == null) {
|
||||||
|
|
||||||
if(this.Permissions == null) {
|
|
||||||
if(test != null) {
|
if(test != null) {
|
||||||
this.Permissions = ((Permissions)test).getHandler();
|
this.PermissionsHandler = ((Permissions)test).getHandler();
|
||||||
} else {
|
} else {
|
||||||
log.info(Messaging.bracketize(name) + " Permission system not enabled. Disabling plugin.");
|
log.info(Messaging.bracketize(name) + " Permission system not enabled. Disabling plugin.");
|
||||||
this.getServer().getPluginManager().disablePlugin(this);
|
this.getServer().getPluginManager().disablePlugin(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Permissions getPermissions() {
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
System.out.println("mcMMO disabled.");
|
System.out.println("mcMMO disabled.");
|
||||||
}
|
}
|
||||||
|
87
mcMMO/com/bukkit/nossr50/mcMMO/mcPermissions.java
Normal file
87
mcMMO/com/bukkit/nossr50/mcMMO/mcPermissions.java
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
package com.bukkit.nossr50.mcMMO;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
|
|
||||||
|
public class mcPermissions {
|
||||||
|
//Thanks to myWarp source code for helping me figure this shit out!
|
||||||
|
private static Permissions permissionsPlugin;
|
||||||
|
private static boolean permissionsEnabled = false;
|
||||||
|
private static volatile mcPermissions instance;
|
||||||
|
|
||||||
|
public static void initialize(Server server) {
|
||||||
|
Plugin test = server.getPluginManager().getPlugin("Permissions");
|
||||||
|
if (test != null) {
|
||||||
|
Logger log = Logger.getLogger("Minecraft");
|
||||||
|
permissionsPlugin = ((Permissions) test);
|
||||||
|
permissionsEnabled = true;
|
||||||
|
log.log(Level.INFO, "[mcMMO] Permissions enabled.");
|
||||||
|
} else {
|
||||||
|
Logger log = Logger.getLogger("Minecraft");
|
||||||
|
log.log(Level.SEVERE, "[mcMMO] Permissions isn't loaded, there are no restrictions.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private boolean permission(Player player, String string) {
|
||||||
|
return permissionsPlugin.Security.permission(player, string);
|
||||||
|
}
|
||||||
|
public boolean motd(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.motd");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean mySpawn(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.commands.myspawn");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean partyChat(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.chat.partychat");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean partyTeleport(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.commands.ptp");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean whois(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.commands.whois");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean party(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.commands.party");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean adminChat(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.chat.adminchat");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static mcPermissions getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcPermissions();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,8 @@ 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;
|
||||||
|
|
||||||
public class mcPlayerListener extends PlayerListener {
|
public class mcPlayerListener extends PlayerListener {
|
||||||
public Location spawn = null;
|
public Location spawn = null;
|
||||||
private mcMMO plugin;
|
private mcMMO plugin;
|
||||||
@ -21,10 +23,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
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));
|
||||||
if(spawn != null)
|
}
|
||||||
event.setRespawnLocation(spawn);
|
|
||||||
}
|
}
|
||||||
public Player[] getPlayersOnline() {
|
public Player[] getPlayersOnline() {
|
||||||
return plugin.getServer().getOnlinePlayers();
|
return plugin.getServer().getOnlinePlayers();
|
||||||
@ -74,9 +76,11 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
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)){
|
||||||
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+"/mcmmo "+ChatColor.BLUE+ "for help.");
|
||||||
player.sendMessage(ChatColor.RED+"WARNING: "+ChatColor.DARK_GRAY+ "Using /myspawn will clear your inventory!");
|
player.sendMessage(ChatColor.RED+"WARNING: "+ChatColor.DARK_GRAY+ "Using /myspawn will clear your inventory!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Check if string is a player
|
//Check if string is a player
|
||||||
|
|
||||||
public void onPlayerItem(PlayerItemEvent event) {
|
public void onPlayerItem(PlayerItemEvent event) {
|
||||||
@ -168,7 +172,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Chop down trees.");
|
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Chop down trees.");
|
||||||
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 10 woodcutting skill");
|
player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 10 woodcutting skill");
|
||||||
player.sendMessage(ChatColor.GRAY+"it gets more frequent from there.");
|
player.sendMessage(ChatColor.GRAY+"and it gets more frequent from there.");
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/mining")){
|
if(split[0].equalsIgnoreCase("/mining")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -197,7 +201,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
player.sendMessage(ChatColor.GRAY+"Damage scales with unarmed skill. The first damage increase");
|
player.sendMessage(ChatColor.GRAY+"Damage scales with unarmed skill. The first damage increase");
|
||||||
player.sendMessage(ChatColor.DARK_GRAY+"happens at 50 skill. At very high skill levels, you will");
|
player.sendMessage(ChatColor.DARK_GRAY+"happens at 50 skill. At very high skill levels, you will");
|
||||||
player.sendMessage(ChatColor.DARK_GRAY+"gain a proc to disarm opponents on hit");
|
player.sendMessage(ChatColor.DARK_GRAY+"gain a proc to disarm player opponents on hit");
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/herbalism")){
|
if(split[0].equalsIgnoreCase("/herbalism")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -253,11 +257,15 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.GRAY+"/mining - displays info about the skill");
|
player.sendMessage(ChatColor.GRAY+"/mining - displays info about the skill");
|
||||||
player.sendMessage(ChatColor.GRAY+"/repair - displays info about the skill");
|
player.sendMessage(ChatColor.GRAY+"/repair - displays info about the skill");
|
||||||
player.sendMessage(ChatColor.GRAY+"/unarmed - displays info about the skill");
|
player.sendMessage(ChatColor.GRAY+"/unarmed - displays info about the skill");
|
||||||
player.sendMessage(ChatColor.GRAY+"/herbalist - displays info about the skill");
|
player.sendMessage(ChatColor.GRAY+"/herbalism - displays info about the skill");
|
||||||
player.sendMessage(ChatColor.GRAY+"/excavation - displays info about the skill");
|
player.sendMessage(ChatColor.GRAY+"/excavation - displays info about the skill");
|
||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
|
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if(!mcPermissions.getInstance().partyTeleport(player)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(split.length < 2){
|
if(split.length < 2){
|
||||||
player.sendMessage(ChatColor.RED+"Usage is /ptp <playername>");
|
player.sendMessage(ChatColor.RED+"Usage is /ptp <playername>");
|
||||||
return;
|
return;
|
||||||
@ -271,7 +279,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(player.isOp() && split[0].equalsIgnoreCase("/whois")){
|
if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/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 /whois <playername>");
|
||||||
@ -304,6 +312,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/setmyspawn")){
|
if(split[0].equalsIgnoreCase("/setmyspawn")){
|
||||||
|
if(!mcPermissions.getInstance().mySpawn(player)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
|
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();
|
||||||
@ -311,11 +323,6 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
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(player.isOp() && split[0].equalsIgnoreCase("/setspawn")){
|
|
||||||
event.setCancelled(true);
|
|
||||||
spawn = player.getLocation();
|
|
||||||
player.sendMessage("Spawn set to current location");
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("/stats")){
|
if(split[0].equalsIgnoreCase("/stats")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(ChatColor.DARK_GREEN + "mcMMO stats");
|
player.sendMessage(ChatColor.DARK_GREEN + "mcMMO stats");
|
||||||
@ -328,6 +335,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
//Party command
|
//Party command
|
||||||
if(split[0].equalsIgnoreCase("/party")){
|
if(split[0].equalsIgnoreCase("/party")){
|
||||||
|
if(!mcPermissions.getInstance().party(player)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
|
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 /party <name> or 'q' to quit");
|
||||||
@ -365,6 +376,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/p")){
|
if(split[0].equalsIgnoreCase("/p")){
|
||||||
|
if(!mcPermissions.getInstance().party(player)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(mcConfig.getInstance().isAdminToggled(player.getName()))
|
if(mcConfig.getInstance().isAdminToggled(player.getName()))
|
||||||
mcConfig.getInstance().toggleAdminChat(playerName);
|
mcConfig.getInstance().toggleAdminChat(playerName);
|
||||||
@ -375,7 +390,11 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
|
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/a") && player.isOp()){
|
if(split[0].equalsIgnoreCase("/a") && (player.isOp() || mcPermissions.getInstance().adminChat(player))){
|
||||||
|
if(!mcPermissions.getInstance().adminChat(player)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(mcConfig.getInstance().isPartyToggled(player.getName()))
|
if(mcConfig.getInstance().isPartyToggled(player.getName()))
|
||||||
mcConfig.getInstance().togglePartyChat(playerName);
|
mcConfig.getInstance().togglePartyChat(playerName);
|
||||||
@ -387,6 +406,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/myspawn")){
|
if(split[0].equalsIgnoreCase("/myspawn")){
|
||||||
|
if(!mcPermissions.getInstance().mySpawn(player)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(mcUsers.getProfile(player).getMySpawn(player) != null){
|
if(mcUsers.getProfile(player).getMySpawn(player) != null){
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
@ -397,15 +420,6 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/spawn")){
|
|
||||||
event.setCancelled(true);
|
|
||||||
if(spawn != null){
|
|
||||||
player.teleportTo(spawn);
|
|
||||||
player.sendMessage("Welcome to spawn, home of the feeble.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
player.sendMessage("Spawn isn't configured. Have an OP set it with /setspawn");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void onItemHeldChange(PlayerItemHeldEvent event) {
|
public void onItemHeldChange(PlayerItemHeldEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -430,7 +444,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(player.isOp() && mcConfig.getInstance().isAdminToggled(player.getName())){
|
if((player.isOp() || mcPermissions.getInstance().adminChat(player)) && mcConfig.getInstance().isAdminToggled(player.getName())){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||||
if(herp.isOp()){
|
if(herp.isOp()){
|
||||||
@ -439,12 +453,5 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(player.isOp()){
|
|
||||||
event.setCancelled(true);
|
|
||||||
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
|
||||||
String z = ChatColor.RED + "<" + ChatColor.WHITE + player.getName() + ChatColor.RED + "> "+ChatColor.WHITE;
|
|
||||||
derp.sendMessage(z+event.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -358,7 +358,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
//DIRT SAND OR GRAVEL
|
//DIRT SAND OR GRAVEL
|
||||||
if(type == 3 || type == 13 || type == 2){
|
if(type == 3 || type == 13 || type == 2){
|
||||||
if(Math.random() * 10 > 9){
|
if(Math.random() * 100 > 95){
|
||||||
mcUsers.getProfile(player).skillUpExcavation(1);
|
mcUsers.getProfile(player).skillUpExcavation(1);
|
||||||
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by 1. Total ("+mcUsers.getProfile(player).getExcavationInt()+")");
|
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by 1. Total ("+mcUsers.getProfile(player).getExcavationInt()+")");
|
||||||
|
|
||||||
@ -411,14 +411,6 @@ public class mcm {
|
|||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
}
|
}
|
||||||
//CHANCE TO GET COAL
|
|
||||||
if(mcUsers.getProfile(player).getExcavationInt() > 125){
|
|
||||||
if(Math.random() * 2000 > 1999){
|
|
||||||
mat = Material.getMaterial(263);
|
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//GRASS OR DIRT
|
//GRASS OR DIRT
|
||||||
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
|
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
|
||||||
@ -446,6 +438,14 @@ public class mcm {
|
|||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//CHANCE TO GET COAL
|
||||||
|
if(mcUsers.getProfile(player).getExcavationInt() > 125){
|
||||||
|
if(Math.random() * 100 > 99){
|
||||||
|
mat = Material.getMaterial(263);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void woodCuttingProcCheck(Player player, Block block, Location loc){
|
public void woodCuttingProcCheck(Player player, Block block, Location loc){
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.bukkit.nossr50.mcMMO.mcMMO
|
main: com.bukkit.nossr50.mcMMO.mcMMO
|
||||||
version: 0.3.4
|
version: 0.4.1
|
Loading…
Reference in New Issue
Block a user