mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Mass teleport implemented, adminchat can be used by groups/users with /adminchat permissions.
This commit is contained in:
parent
9a68fa78dc
commit
842001f8ac
@ -129,4 +129,6 @@ public class other {
|
|||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
@ -26,13 +26,12 @@ public class settings {
|
|||||||
String file = "vminecraft.properties";
|
String file = "vminecraft.properties";
|
||||||
public String rules[] = null;
|
public String rules[] = null;
|
||||||
|
|
||||||
|
|
||||||
public void loadSettings()
|
public void loadSettings()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(properties == null)
|
if(properties == null)
|
||||||
{
|
{
|
||||||
String location = etc.getInstance().getUsersLocation();
|
String location = "vminecraft.properties";
|
||||||
properties = new PropertiesFile("vminecraft.properties");
|
properties = new PropertiesFile("vminecraft.properties");
|
||||||
FileWriter writer = null;
|
FileWriter writer = null;
|
||||||
try {
|
try {
|
||||||
|
@ -17,15 +17,15 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
|||||||
String adminchat = Colors.DarkPurple + "{" + player.getColor() + player.getName() + Colors.DarkPurple +"}" + Colors.White + " "; //Special formatting for adminchat
|
String adminchat = Colors.DarkPurple + "{" + player.getColor() + player.getName() + Colors.DarkPurple +"}" + Colors.White + " "; //Special formatting for adminchat
|
||||||
String message2 = ""; //Used for greentext and FFF
|
String message2 = ""; //Used for greentext and FFF
|
||||||
String check = temp2+message; //Calculates how long your message will be including your name in the equation, this prevents minecraft clients from crashing when a color code is inserted after a linebreak
|
String check = temp2+message; //Calculates how long your message will be including your name in the equation, this prevents minecraft clients from crashing when a color code is inserted after a linebreak
|
||||||
if (settings.getInstance().adminchat()&&message.startsWith("@") && (player.isAdmin())) {
|
if (settings.getInstance().adminchat()&&message.startsWith("@") && (player.isAdmin() || player.canUseCommand("/adminchat"))) {
|
||||||
for (Player p : etc.getServer().getPlayerList()) {
|
for (Player p : etc.getServer().getPlayerList()) {
|
||||||
String blaa = "";
|
String blaa = "";
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
if (player.isAdmin()) {
|
if (player.isAdmin() || player.canUseCommand("/adminchat")) {
|
||||||
for ( int x = 1; x< message.length(); x++) {
|
for ( int x = 1; x< message.length(); x++) {
|
||||||
blaa+=message.charAt(x);
|
blaa+=message.charAt(x);
|
||||||
}
|
}
|
||||||
if (p.isAdmin()){
|
if (p.isAdmin() || player.canUseCommand("/adminchat")){
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
p.sendMessage(adminchat+blaa);
|
p.sendMessage(adminchat+blaa);
|
||||||
}
|
}
|
||||||
@ -84,19 +84,13 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(settings.getInstance().cmdMasstp() && split[0].equalsIgnoreCase("/masstp")) {
|
if(settings.getInstance().cmdMasstp() && split[0].equalsIgnoreCase("/masstp")) {
|
||||||
etc.getInstance().addCommand("/masstp", "Teleports those with lower permissions to you");
|
|
||||||
if (split.length < 2) {
|
|
||||||
player.sendMessage(Colors.Rose + "Correct usage is: /masstp group");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player p : etc.getServer().getPlayerList()) {
|
for (Player p : etc.getServer().getPlayerList()) {
|
||||||
if (!p.hasControlOver(player)) {
|
if (!p.hasControlOver(player)) {
|
||||||
p.teleportTo(player);
|
p.teleportTo(player);
|
||||||
}
|
}
|
||||||
player.sendMessage("Summoning successful.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
player.sendMessage(Colors.Blue+"Summoning successful.");
|
||||||
}
|
}
|
||||||
//Replacement for /tp
|
//Replacement for /tp
|
||||||
if(settings.getInstance().cmdTp() && split[0].equalsIgnoreCase("/tp")) {
|
if(settings.getInstance().cmdTp() && split[0].equalsIgnoreCase("/tp")) {
|
||||||
@ -185,7 +179,6 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
|||||||
}
|
}
|
||||||
//Rules
|
//Rules
|
||||||
if(settings.getInstance().cmdRules() && split[0].equalsIgnoreCase("/rules")) {
|
if(settings.getInstance().cmdRules() && split[0].equalsIgnoreCase("/rules")) {
|
||||||
etc.getInstance().addCommand("/rules", "Displays the rules");
|
|
||||||
for (String str : settings.getInstance().getRules()) {
|
for (String str : settings.getInstance().getRules()) {
|
||||||
player.sendMessage(Colors.Blue+str);
|
player.sendMessage(Colors.Blue+str);
|
||||||
}
|
}
|
||||||
@ -193,7 +186,6 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
|||||||
}
|
}
|
||||||
//Fabulous
|
//Fabulous
|
||||||
if(split[0].equalsIgnoreCase("/fabulous") && settings.getInstance().cmdFabulous()) {
|
if(split[0].equalsIgnoreCase("/fabulous") && settings.getInstance().cmdFabulous()) {
|
||||||
etc.getInstance().addCommand("/fabulous", "makes text SUUUPER");
|
|
||||||
if (split.length == 1) {return false;}
|
if (split.length == 1) {return false;}
|
||||||
String temp = "";
|
String temp = "";
|
||||||
String str = "";
|
String str = "";
|
||||||
@ -222,6 +214,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
//Promote
|
//Promote
|
||||||
if (settings.getInstance().cmdPromote() && split[0].equalsIgnoreCase("/promote")) {
|
if (settings.getInstance().cmdPromote() && split[0].equalsIgnoreCase("/promote")) {
|
||||||
if(split.length != 2)
|
if(split.length != 2)
|
||||||
@ -333,9 +326,10 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
|||||||
id.a.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" ");
|
id.a.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" ");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
*
|
||||||
|
*/
|
||||||
//Whois will display info about a player
|
//Whois will display info about a player
|
||||||
if (settings.getInstance().cmdWhoIs() && split[0].equalsIgnoreCase("/whois")) {
|
if (settings.getInstance().cmdWhoIs() && split[0].equalsIgnoreCase("/whois")) {
|
||||||
etc.getInstance().addCommand("/whois", "/whois [user]");
|
|
||||||
if (split.length < 2) {
|
if (split.length < 2) {
|
||||||
player.sendMessage(Colors.Rose + "Usage is /whois [player]");
|
player.sendMessage(Colors.Rose + "Usage is /whois [player]");
|
||||||
}
|
}
|
||||||
@ -397,8 +391,4 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
|||||||
//Needs to be included
|
//Needs to be included
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//Temporary until I can figure out how to make my plugin load on startup
|
|
||||||
public void onLogin(Player player) {
|
|
||||||
settings.getInstance().loadSettings();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,11 @@ public class vminecraftPlugin extends Plugin {
|
|||||||
|
|
||||||
public void enable() {
|
public void enable() {
|
||||||
//If we had commands we would add them here.
|
//If we had commands we would add them here.
|
||||||
|
etc.getInstance().addCommand("/masstp", "Teleports those with lower permissions to you");
|
||||||
|
etc.getInstance().addCommand("/rules", "Displays the rules");
|
||||||
|
etc.getInstance().addCommand("/fabulous", "makes text SUUUPER");
|
||||||
|
etc.getInstance().addCommand("/whois", "/whois [user]");
|
||||||
|
settings.getInstance().loadSettings(); //Hopefully this will make the plugin load right away
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
|
Loading…
Reference in New Issue
Block a user