mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Vminecraft.java renamed to vminecraftPlugin.java, settings tweaked.
Compatible with 116 Signed-off-by: nossr50 <nossr50@gmail.com>
This commit is contained in:
parent
153e677faf
commit
1b9b57889c
132
other.java
Normal file
132
other.java
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
//Contains all the java methods for vminecraft
|
||||||
|
public class other {
|
||||||
|
public static other gmsg;
|
||||||
|
public static other gmsg(String msg){
|
||||||
|
for (Player p : etc.getServer().getPlayerList()) {
|
||||||
|
if (p != null) {
|
||||||
|
p.sendMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean lengthCheck(String str)
|
||||||
|
{
|
||||||
|
int length = 0;
|
||||||
|
for(int x = 0; x<str.length(); x++)
|
||||||
|
{
|
||||||
|
if("i;,.:|!".indexOf(str.charAt(x)) != -1)
|
||||||
|
{
|
||||||
|
length+=2;
|
||||||
|
}
|
||||||
|
else if("l'".indexOf(str.charAt(x)) != -1)
|
||||||
|
{
|
||||||
|
length+=3;
|
||||||
|
}
|
||||||
|
else if("tI[]".indexOf(str.charAt(x)) != -1)
|
||||||
|
{
|
||||||
|
length+=4;
|
||||||
|
}
|
||||||
|
else if("kf{}<>\"*()".indexOf(str.charAt(x)) != -1)
|
||||||
|
{
|
||||||
|
length+=5;
|
||||||
|
}
|
||||||
|
else if("hequcbrownxjmpsvazydgTHEQUCKBROWNFXJMPSVLAZYDG1234567890#\\/?$%-=_+&".indexOf(str.charAt(x)) != -1)
|
||||||
|
{
|
||||||
|
length+=6;
|
||||||
|
}
|
||||||
|
else if("@~".indexOf(str.charAt(x)) != -1)
|
||||||
|
{
|
||||||
|
length+=7;
|
||||||
|
}
|
||||||
|
else if(str.charAt(x)==' ')
|
||||||
|
{
|
||||||
|
length+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(length<=316)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else { return false; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String colorChange(char colour)
|
||||||
|
{
|
||||||
|
String color = "";
|
||||||
|
switch(colour)
|
||||||
|
{
|
||||||
|
case '0':
|
||||||
|
color = Colors.Black;
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
color = Colors.Navy;
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
color = Colors.Green;
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
color = Colors.Blue;
|
||||||
|
break;
|
||||||
|
case '4':
|
||||||
|
color = Colors.Red;
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
color = Colors.Purple;
|
||||||
|
break;
|
||||||
|
case '6':
|
||||||
|
color = Colors.Gold;
|
||||||
|
break;
|
||||||
|
case '7':
|
||||||
|
color = Colors.LightGray;
|
||||||
|
break;
|
||||||
|
case '8':
|
||||||
|
color = Colors.Gray;
|
||||||
|
break;
|
||||||
|
case '9':
|
||||||
|
color = Colors.DarkPurple;
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
color = Colors.LightGreen;
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
color = Colors.LightBlue;
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
color = Colors.Rose;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
color = Colors.LightPurple;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
color = Colors.Yellow;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
color = Colors.White;
|
||||||
|
break;
|
||||||
|
case 'A':
|
||||||
|
color = Colors.LightGreen;
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
color = Colors.LightBlue;
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
color = Colors.Rose;
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
color = Colors.LightPurple;
|
||||||
|
break;
|
||||||
|
case 'E':
|
||||||
|
color = Colors.Yellow;
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
color = Colors.White;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
color = Colors.White;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
/* Class of all ranks so I don't need to type them in */
|
|
||||||
|
|
||||||
public class ranks {
|
|
||||||
public static final String[] Def = {"default"};
|
|
||||||
public static final String[] Trusted = {"trusted"};
|
|
||||||
public static final String[] Mods = {"mods"};
|
|
||||||
public static final String[] Admins = {"admins"};
|
|
||||||
public static final String[] SuperAdmins = {"superadmins"};
|
|
||||||
}
|
|
161
settings.java
161
settings.java
@ -1,8 +1,7 @@
|
|||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
|
||||||
public class settings {
|
public class settings {
|
||||||
private final static Object syncLock = new Object();
|
private final static Object syncLock = new Object();
|
||||||
@ -26,143 +25,39 @@ public class settings {
|
|||||||
String file = "vminecraft.properties";
|
String file = "vminecraft.properties";
|
||||||
public String rules[] = null;
|
public String rules[] = null;
|
||||||
|
|
||||||
public void rules() {
|
|
||||||
try{
|
|
||||||
rules = properties.getString("rules", "Rules@#1: No griefing").split("@");
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
log.log(Level.SEVERE, "Vminecraft: "+ e.getMessage() );
|
|
||||||
rules = new String[]{"Rules@#1: No griefing"};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void loadSettings()
|
public void loadSettings()
|
||||||
//Will create a file if it doesn't exist
|
|
||||||
{
|
{
|
||||||
if (properties == null) {
|
|
||||||
|
if(properties == null)
|
||||||
|
{
|
||||||
properties = new PropertiesFile("vminecraft.properties");
|
properties = new PropertiesFile("vminecraft.properties");
|
||||||
} else {
|
} else {
|
||||||
properties.load();
|
properties.load();
|
||||||
}
|
}
|
||||||
try{
|
|
||||||
Scanner scanner = new Scanner(new File(file));
|
|
||||||
while (scanner.hasNextLine()) {
|
|
||||||
String line = scanner.nextLine();
|
|
||||||
if( line.startsWith("#") || line.equals(""))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String[] split = line.split("=");
|
|
||||||
if(split[0].equalsIgnoreCase("adminchat"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
adminChat = true;
|
|
||||||
}
|
|
||||||
else adminChat = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdTp"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdTp = true;
|
|
||||||
}
|
|
||||||
else cmdTp = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdTphere"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdTphere = true;
|
|
||||||
}
|
|
||||||
else cmdTphere = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("globalmessages"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
globalmessages = true;
|
|
||||||
}
|
|
||||||
else globalmessages = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdSay"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdSay = true;
|
|
||||||
}
|
|
||||||
else cmdSay = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdRules"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdRules = true;
|
|
||||||
}
|
|
||||||
else cmdRules = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("Greentext"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
greentext = true;
|
|
||||||
}
|
|
||||||
else greentext = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("FFF"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
FFF = true;
|
|
||||||
}
|
|
||||||
else FFF = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("QuakeColors"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
quakeColors = true;
|
|
||||||
}
|
|
||||||
else quakeColors = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdFabulous"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdFabulous = true;
|
|
||||||
}
|
|
||||||
else cmdFabulous = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdPromote"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdPromote = true;
|
|
||||||
}
|
|
||||||
else cmdPromote = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdDemote"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdDemote = true;
|
|
||||||
}
|
|
||||||
else cmdDemote = false;
|
|
||||||
}
|
|
||||||
if(split[0].equalsIgnoreCase("cmdWhoIs"))
|
|
||||||
{
|
|
||||||
if(split[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
cmdWhoIs = true;
|
|
||||||
}
|
|
||||||
else cmdWhoIs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scanner.close();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
log.log(Level.SEVERE, "Vminecraft: "+ e.getMessage() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
adminChat = properties.getBoolean("adminchat",true);
|
||||||
|
greentext = properties.getBoolean("greentext",true);
|
||||||
|
FFF = properties.getBoolean("FFF",true);
|
||||||
|
quakeColors = properties.getBoolean("quakeColors",true);
|
||||||
|
cmdFabulous = properties.getBoolean("cmdFabulous",true);
|
||||||
|
cmdPromote = properties.getBoolean("cmdPromote",true);
|
||||||
|
cmdDemote = properties.getBoolean("cmdDemote",true);
|
||||||
|
cmdWhoIs = properties.getBoolean("cmdWhoIs",true);
|
||||||
|
cmdRules = properties.getBoolean("cmdRules",true);
|
||||||
|
cmdTp = properties.getBoolean("cmdTp",true);
|
||||||
|
cmdTphere = properties.getBoolean("cmdTphere",true);
|
||||||
|
globalmessages = properties.getBoolean("globalmessages",true);
|
||||||
|
cmdSay = properties.getBoolean("cmdSay",true);
|
||||||
|
rules = properties.getString("rules", "").split("@");
|
||||||
|
id.a.log(Level.INFO, "vminecraft plugin successfully loaded");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, "vminecraft Error: ERROR LOADING PROPERTIES FILE");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean adminchat() {return adminChat;}
|
public boolean adminchat() {return adminChat;}
|
||||||
|
@ -1,29 +1,18 @@
|
|||||||
//This is where the bulk of the plugin is
|
//Vminecraft plugin by nossr50 & TrapAlice
|
||||||
import java.util.Locale;
|
import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.logging.Level;
|
public class vminecraftListener extends PluginListener {
|
||||||
public class vminecraft extends Plugin {
|
|
||||||
@Override
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
//I have to include this to compile, not sure why.
|
id.a.log(Level.INFO, "vminecraft disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void enable() {
|
public void enable() {
|
||||||
//I have to include this to compile, not sure why.
|
settings.getInstance().loadSettings(); //Load the settings files
|
||||||
|
id.a.log(Level.INFO, "vminecraft enabled");
|
||||||
}
|
}
|
||||||
static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLogin(Player player)
|
|
||||||
{
|
|
||||||
settings.getInstance().rules();
|
|
||||||
settings.getInstance().loadSettings();
|
|
||||||
}
|
|
||||||
private String rules[];
|
|
||||||
public boolean onChat(Player player, String message){
|
public boolean onChat(Player player, String message){
|
||||||
settings.getInstance().rules();
|
|
||||||
settings.getInstance().loadSettings(); //So you can disable/enable things in the txt files without having to reload the server
|
|
||||||
String temp2 = "<" + player.getColor() + player.getName() + Colors.White +"> "; //Copies the formatting of id.java
|
String temp2 = "<" + player.getColor() + player.getName() + Colors.White +"> "; //Copies the formatting of id.java
|
||||||
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
|
||||||
@ -44,8 +33,9 @@ public class vminecraft extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.log(Level.INFO, "@"+temp2+message); //So you can read adminchat from the server console
|
id.a.log(Level.INFO, "@"+temp2+message); //So you can read adminchat from the server console
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
//Greentext
|
//Greentext
|
||||||
if (settings.getInstance().greentext()&&message.startsWith(">")) {
|
if (settings.getInstance().greentext()&&message.startsWith(">")) {
|
||||||
@ -64,20 +54,20 @@ public class vminecraft extends Plugin {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//QuakeColors
|
//QuakeColors
|
||||||
if(settings.getInstance().quakeColors()&&message.length()>2 && lengthCheck(check)) {
|
if(settings.getInstance().quakeColors()&&message.length()>2 && other.lengthCheck(check)) {
|
||||||
String temp = "";
|
String temp = "";
|
||||||
for(int x = 0; x< message.length(); x++)
|
for(int x = 0; x< message.length(); x++)
|
||||||
{
|
{
|
||||||
if(message.charAt(x)=='^'&&x!=message.length()-1)
|
if(message.charAt(x)=='^'&&x!=message.length()-1)
|
||||||
{
|
{
|
||||||
temp+=colorChange(message.charAt(x+1));
|
temp+=other.colorChange(message.charAt(x+1));
|
||||||
x+=1;
|
x+=1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
temp+=message.charAt(x);
|
temp+=message.charAt(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.log(Level.INFO, "<"+player.getName()+"> "+message);
|
id.a.log(Level.INFO, "<"+player.getName()+"> "+message);
|
||||||
message = temp2 + temp + " ";
|
message = temp2 + temp + " ";
|
||||||
for (Player p : etc.getServer().getPlayerList()) {
|
for (Player p : etc.getServer().getPlayerList()) {
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
@ -88,6 +78,7 @@ public class vminecraft extends Plugin {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(Player player, String[] split) {
|
public boolean onCommand(Player player, String[] split) {
|
||||||
if(!player.canUseCommand(split[0])) {
|
if(!player.canUseCommand(split[0])) {
|
||||||
return false;
|
return false;
|
||||||
@ -113,7 +104,7 @@ public class vminecraft extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (playerTarget != null) {
|
if (playerTarget != null) {
|
||||||
log.log(Level.INFO, player.getName() + " teleported to " + playerTarget.getName());
|
id.a.log(Level.INFO, player.getName() + " teleported to " + playerTarget.getName());
|
||||||
player.teleportTo(playerTarget);
|
player.teleportTo(playerTarget);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -141,7 +132,7 @@ public class vminecraft extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (playerTarget != null) {
|
if (playerTarget != null) {
|
||||||
log.log(Level.INFO, player.getName() + " teleported " + player.getName() + " to their self.");
|
id.a.log(Level.INFO, player.getName() + " teleported " + player.getName() + " to their self.");
|
||||||
playerTarget.teleportTo(player);
|
playerTarget.teleportTo(player);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(Colors.Rose + "Can't find user " + split[1] + ".");
|
player.sendMessage(Colors.Rose + "Can't find user " + split[1] + ".");
|
||||||
@ -172,6 +163,11 @@ public class vminecraft extends Plugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Should only reload vminecraft settings if the player is able to use /reload
|
||||||
|
if(split[0].equalsIgnoreCase("/reload") && player.canUseCommand("/reload")) {
|
||||||
|
settings.getInstance().loadSettings();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//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");
|
etc.getInstance().addCommand("/rules", "Displays the rules");
|
||||||
@ -190,7 +186,7 @@ public class vminecraft extends Plugin {
|
|||||||
String temp2 = "<" + player.getName() + "> "+str;
|
String temp2 = "<" + player.getName() + "> "+str;
|
||||||
String[] rainbow = new String[] {Colors.Red, Colors.Rose, Colors.Yellow, Colors.Green, Colors.Blue, Colors.LightPurple, Colors.Purple};
|
String[] rainbow = new String[] {Colors.Red, Colors.Rose, Colors.Yellow, Colors.Green, Colors.Blue, Colors.LightPurple, Colors.Purple};
|
||||||
int counter=0;
|
int counter=0;
|
||||||
if(lengthCheck(temp2))
|
if(other.lengthCheck(temp2))
|
||||||
{
|
{
|
||||||
id.a.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
|
id.a.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
|
||||||
for(int x=0; x<str.length(); x++)
|
for(int x=0; x<str.length(); x++)
|
||||||
@ -205,6 +201,7 @@ public class vminecraft extends Plugin {
|
|||||||
String message = "<" + player.getColor() + player.getName() + Colors.White + "> " + str;
|
String message = "<" + player.getColor() + player.getName() + Colors.White + "> " + str;
|
||||||
|
|
||||||
other.gmsg(message);
|
other.gmsg(message);
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(Colors.Rose + "Message is too long");
|
player.sendMessage(Colors.Rose + "Message is too long");
|
||||||
}
|
}
|
||||||
@ -215,10 +212,11 @@ public class vminecraft extends Plugin {
|
|||||||
if(split.length != 2)
|
if(split.length != 2)
|
||||||
{
|
{
|
||||||
player.sendMessage(Colors.Rose + "Usage is /promote [Player]");
|
player.sendMessage(Colors.Rose + "Usage is /promote [Player]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player playerTarget = null;
|
Player playerTarget = null;
|
||||||
|
if(split.length==2){
|
||||||
for( Player p : etc.getServer().getPlayerList())
|
for( Player p : etc.getServer().getPlayerList())
|
||||||
{
|
{
|
||||||
if (p.getName().equalsIgnoreCase(split[1]))
|
if (p.getName().equalsIgnoreCase(split[1]))
|
||||||
@ -229,25 +227,31 @@ public class vminecraft extends Plugin {
|
|||||||
|
|
||||||
if( playerTarget!=null)
|
if( playerTarget!=null)
|
||||||
{
|
{
|
||||||
if(playerTarget.isInGroup("admins"))
|
String playerTargetGroup[] = playerTarget.getGroups();
|
||||||
|
String playerGroup[] = player.getGroups();
|
||||||
|
player.sendMessage("Debug data:");
|
||||||
|
player.sendMessage("PlayerTarget: "+playerTargetGroup[0]);
|
||||||
|
player.sendMessage("Player: "+playerGroup[0]);
|
||||||
|
if(playerTargetGroup[0].equals("admins"))
|
||||||
{
|
{
|
||||||
player.sendMessage(Colors.Rose + "You can not promote " + split[1] + " any higher.");
|
player.sendMessage(Colors.Rose + "You can not promote " + split[1] + " any higher.");
|
||||||
}
|
}
|
||||||
if(playerTarget.isInGroup("mods") && (player.isInGroup("superadmins")))
|
if(playerTargetGroup[0].equals("mods") && (playerGroup[0].equals("owner")))
|
||||||
{
|
{
|
||||||
playerTarget.setGroups(ranks.Admins);
|
playerTarget.setGroups(ranks.Admins);
|
||||||
etc.getInstance().getDataSource().modifyPlayer(playerTarget);
|
etc.getInstance().getDataSource().modifyPlayer(playerTarget);
|
||||||
String message = Colors.Yellow + split[1] + " was promoted to" + Colors.Rose + " Admin";
|
String message = Colors.Yellow + split[1] + " was promoted to" + Colors.Rose + " Admin";
|
||||||
other.gmsg(message);
|
other.gmsg(message);
|
||||||
}
|
}
|
||||||
else if (playerTarget.isInGroup("trusted") && (player.isInGroup("admins") || player.isInGroup("superadmins")))
|
else if (playerTargetGroup[0].equals("trusted") && (playerGroup[0].equals("admins") || playerGroup[0].equals("owner")))
|
||||||
{
|
{
|
||||||
playerTarget.setGroups(ranks.Mods);
|
playerTarget.setGroups(ranks.Mods);
|
||||||
|
playerTargetGroup[0]="Mods";
|
||||||
etc.getInstance().getDataSource().modifyPlayer(playerTarget);
|
etc.getInstance().getDataSource().modifyPlayer(playerTarget);
|
||||||
String message = Colors.Yellow + split[1] + " was promoted to" + Colors.DarkPurple + " Mod";
|
String message = Colors.Yellow + split[1] + " was promoted to" + Colors.DarkPurple + " Mod";
|
||||||
other.gmsg(message);
|
other.gmsg(message);
|
||||||
}
|
}
|
||||||
else if (playerTarget.isInGroup("default") && (player.isInGroup("mods") || player.isInGroup("admins") || player.isInGroup("superadmins")))
|
else if (playerTargetGroup[0].equals("default") && (playerGroup[0].equals("mods") || playerGroup[0].equals("admins") || player.isInGroup("owner")))
|
||||||
{
|
{
|
||||||
playerTarget.setGroups(ranks.Trusted);
|
playerTarget.setGroups(ranks.Trusted);
|
||||||
etc.getInstance().getDataSource().modifyPlayer(playerTarget);
|
etc.getInstance().getDataSource().modifyPlayer(playerTarget);
|
||||||
@ -259,8 +263,9 @@ public class vminecraft extends Plugin {
|
|||||||
else{
|
else{
|
||||||
player.sendMessage(Colors.Rose + "Player not found");
|
player.sendMessage(Colors.Rose + "Player not found");
|
||||||
}
|
}
|
||||||
log.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" ");
|
id.a.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" ");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Demote
|
//Demote
|
||||||
if (settings.getInstance().cmdPromote() && split[0].equalsIgnoreCase("/promote"))
|
if (settings.getInstance().cmdPromote() && split[0].equalsIgnoreCase("/promote"))
|
||||||
{
|
{
|
||||||
@ -310,7 +315,7 @@ public class vminecraft extends Plugin {
|
|||||||
else{
|
else{
|
||||||
player.sendMessage(Colors.Rose + "Player not found");
|
player.sendMessage(Colors.Rose + "Player not found");
|
||||||
}
|
}
|
||||||
log.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
|
||||||
@ -377,124 +382,8 @@ public class vminecraft extends Plugin {
|
|||||||
//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
|
||||||
//Calculates how long the specified String is to prevent linebreaks when using scripts that insert color codes, designed to be used with playername included
|
public void onLogin(Player player) {
|
||||||
private boolean lengthCheck(String str)
|
settings.getInstance().loadSettings();
|
||||||
{
|
|
||||||
int length = 0;
|
|
||||||
for(int x = 0; x<str.length(); x++)
|
|
||||||
{
|
|
||||||
if("i;,.:|!".indexOf(str.charAt(x)) != -1)
|
|
||||||
{
|
|
||||||
length+=2;
|
|
||||||
}
|
|
||||||
else if("l'".indexOf(str.charAt(x)) != -1)
|
|
||||||
{
|
|
||||||
length+=3;
|
|
||||||
}
|
|
||||||
else if("tI[]".indexOf(str.charAt(x)) != -1)
|
|
||||||
{
|
|
||||||
length+=4;
|
|
||||||
}
|
|
||||||
else if("kf{}<>\"*()".indexOf(str.charAt(x)) != -1)
|
|
||||||
{
|
|
||||||
length+=5;
|
|
||||||
}
|
|
||||||
else if("hequcbrownxjmpsvazydgTHEQUCKBROWNFXJMPSVLAZYDG1234567890#\\/?$%-=_+&".indexOf(str.charAt(x)) != -1)
|
|
||||||
{
|
|
||||||
length+=6;
|
|
||||||
}
|
|
||||||
else if("@~".indexOf(str.charAt(x)) != -1)
|
|
||||||
{
|
|
||||||
length+=7;
|
|
||||||
}
|
|
||||||
else if(str.charAt(x)==' ')
|
|
||||||
{
|
|
||||||
length+=4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(length<=316)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
} else { return false; }
|
|
||||||
|
|
||||||
}
|
|
||||||
//QuakeColors Part 2
|
|
||||||
private String colorChange(char colour)
|
|
||||||
{
|
|
||||||
String color = "";
|
|
||||||
switch(colour)
|
|
||||||
{
|
|
||||||
case '0':
|
|
||||||
color = Colors.Black;
|
|
||||||
break;
|
|
||||||
case '1':
|
|
||||||
color = Colors.Navy;
|
|
||||||
break;
|
|
||||||
case '2':
|
|
||||||
color = Colors.Green;
|
|
||||||
break;
|
|
||||||
case '3':
|
|
||||||
color = Colors.Blue;
|
|
||||||
break;
|
|
||||||
case '4':
|
|
||||||
color = Colors.Red;
|
|
||||||
break;
|
|
||||||
case '5':
|
|
||||||
color = Colors.Purple;
|
|
||||||
break;
|
|
||||||
case '6':
|
|
||||||
color = Colors.Gold;
|
|
||||||
break;
|
|
||||||
case '7':
|
|
||||||
color = Colors.LightGray;
|
|
||||||
break;
|
|
||||||
case '8':
|
|
||||||
color = Colors.Gray;
|
|
||||||
break;
|
|
||||||
case '9':
|
|
||||||
color = Colors.DarkPurple;
|
|
||||||
break;
|
|
||||||
case 'a':
|
|
||||||
color = Colors.LightGreen;
|
|
||||||
break;
|
|
||||||
case 'b':
|
|
||||||
color = Colors.LightBlue;
|
|
||||||
break;
|
|
||||||
case 'c':
|
|
||||||
color = Colors.Rose;
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
color = Colors.LightPurple;
|
|
||||||
break;
|
|
||||||
case 'e':
|
|
||||||
color = Colors.Yellow;
|
|
||||||
break;
|
|
||||||
case 'f':
|
|
||||||
color = Colors.White;
|
|
||||||
break;
|
|
||||||
case 'A':
|
|
||||||
color = Colors.LightGreen;
|
|
||||||
break;
|
|
||||||
case 'B':
|
|
||||||
color = Colors.LightBlue;
|
|
||||||
break;
|
|
||||||
case 'C':
|
|
||||||
color = Colors.Rose;
|
|
||||||
break;
|
|
||||||
case 'D':
|
|
||||||
color = Colors.LightPurple;
|
|
||||||
break;
|
|
||||||
case 'E':
|
|
||||||
color = Colors.Yellow;
|
|
||||||
break;
|
|
||||||
case 'F':
|
|
||||||
color = Colors.White;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
color = Colors.White;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
22
vminecraftPlugin.java
Normal file
22
vminecraftPlugin.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* vminecraft Plugin
|
||||||
|
* @author Robert, TrapAlice
|
||||||
|
*/
|
||||||
|
//This is how we setup the listener
|
||||||
|
public class vminecraftPlugin extends Plugin {
|
||||||
|
static final vminecraftListener listener = new vminecraftListener();
|
||||||
|
|
||||||
|
public void enable() {
|
||||||
|
//If we had commands we would add them here.
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disable() {
|
||||||
|
//And remove the commands here.
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initialize() {
|
||||||
|
//Here we add the hook we're going to use. In this case it's the arm swing event.
|
||||||
|
etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM);
|
||||||
|
etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user