PDA

View Full Version : [317] Some commands like Unban & Unmute [317] C&P



Xdragon
June 20th, 2010, 14:33
Here are the Commands :

Unban Command

if (command.startsWith("unban") && playerRights >= 2)
{
try {
String name = command.substring(6);
java.util.List<String> bannedUsers = new java.util.ArrayList<String>();
BufferedReader input = new BufferedReader(new FileReader("./config/bans.txt"));
String s;
String unbanned = null;
while ((s = input.readLine()) != null)
{
if(!s.equalsIgnoreCase(name))
bannedUsers.add(s);
else
unbanned = s;
}
input.close();
BufferedWriter output = new BufferedWriter(new FileWriter("./config/bans.txt"));
for (String s1 : bannedUsers)
{
output.write(s1);
output.newLine();
}
output.close();
if(unbanned != null)
sM("User "+name+" Successfully unbanned.");
return;
} catch(Exception e) {
e.printStackTrace();
}
}

Unmute Command

if (command.startsWith("unmute") && playerRights >= 1)
{
try {
String name = command.substring(7);
java.util.List<String> bannedUsers = new java.util.ArrayList<String>();
BufferedReader input = new BufferedReader(new FileReader("./config/mutes.txt"));
String s;
String unbanned = null;
while ((s = input.readLine()) != null)
{
if(!s.equalsIgnoreCase(name))
bannedUsers.add(s);
else
unbanned = s;
}
input.close();
BufferedWriter output = new BufferedWriter(new FileWriter("./config/mutes.txt"));
for (String s1 : bannedUsers)
{
output.write(s1);
output.newLine();
}
output.close();
if(unbanned != null)
sM("User "+name+" successfully unmuted.");
return;
} catch(Exception e) {
e.printStackTrace();
}
}

Here are some commands Beginners need :

A tele Command :

if(command.startsWith("home") && (playerRights >= 0)) {
triggerTele(xxxx, yyyy, 0);
brightness = 4;
}
Explanation:

if(command.startsWith("home") && (playerRights >= 0)) {
the first part [if(command.startsWith("home")] that means how the code begins mine begins whith ::home
the 2th part : [&& (playerRights >= 0)) {] that means who can do it like 0 = players 1 = mod 2 = admin 3 = owner 4 = hidden admin 5 = hidden owner
[CODE]triggerTele(xxxx, yyyy, 0);
Thsi code mean where it goes xxxx = X coords yyyy = Y coords
the 0 means height 0 is floor 1 is up 2 is up up 3 is underground

brightness = 4;
Thats is just the brightness its goes only from 1 to 4
Btw u can get the x coords and y coords whith the command : ::mypos
or u can see it at the client
If u want the code here it is :

if(command.startsWith("mypos") && playerRights > 0){
sM("AbsX: "+absX+" AbsY: "+absY+"");
}

If u want more commands feel free to pm me
Rep only if u want. Its not mine i only added bc it was all gone bc the crash.

XxBryantD
June 20th, 2010, 16:01
simple but good job

Xdragon
June 20th, 2010, 16:09
Thanks

Elitekrull
June 28th, 2010, 23:06
Thanks Lol The source I have been using had ::mute but not ::unmuted so I had to go into the mute files to change it.
Great job.

Malik
June 28th, 2010, 23:33
Thanks for this :)

Xdragon
June 29th, 2010, 11:28
Yw :D

Silvr magic6
February 16th, 2011, 03:07
hey xdragon

im still stuck on the unban thing like how u even use the code?

Xdragon
February 24th, 2011, 08:01
Typ ::unban (username) Whithout the ( ) than press enter

HonorScape
June 19th, 2011, 09:08
Can you give me the code for unipmute and unipban aswell?