Skip to content

Commit

Permalink
Final bugcheck done! pushing for 1.0.3
Browse files Browse the repository at this point in the history
FUUUUCK YEAH! FINALLY DONE! 1.0.3 HERE WE GO! :D
  • Loading branch information
Carlgo11 authored and Carlgo11 committed Jul 29, 2013
1 parent 577e1ee commit 8fa0652
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Mon, 29 Jul 2013 00:42:04 +0200
#Mon, 29 Jul 2013 15:27:18 +0200


C\:\\Users\\Carl\\Documents\\GitHub\\SimpleAutomessage=
Binary file modified build/classes/com/carlgo11/simpleautomessage/Main$1.class
Binary file not shown.
Binary file modified build/classes/com/carlgo11/simpleautomessage/Main.class
Binary file not shown.
39 changes: 30 additions & 9 deletions build/classes/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
############################################################
# +------------------------------------------------------+ #
# | Notes | #
# +------------------------------------------------------+ #
############################################################
# Config for SimpleAutoMessage
# SimpleAutoMessage is a Bukkit plugin created by Carlgo11.
# http://youtube.com/Carlgo11
#

# COLORS:
# When adding colors use the minecraft colorcodes and replace the '&' with a '§'.
# When adding colors use the minecraft colorcodes.
# Example: &a = green, &d = purple.

# When this config.yml is broken it's often because of the msg strings! ALWAYS USE '' AROUND A MESSAGE!
# Example: msg1: 'This is an example'

#Don't Change the version! If version is changed this config.yml will be deleted!
version: 1.0.3

############################################################
# +------------------------------------------------------+ #
# | Settings | #
# +------------------------------------------------------+ #
############################################################
# Do you want to automatically get updates and bug-fixes when available?
auto-update: true

Expand All @@ -16,22 +32,27 @@
debug: false

# Prefix is the nick that will show up as the sender.
Prefix: §d[Server]
prefix: '&d[Server]'

# Time is the time between each message.
# TIME SHOULD BE IN SECONDS!
Time: 10

# Messages:
time: 10

############################################################
# +------------------------------------------------------+ #
# | Messages | #
# +------------------------------------------------------+ #
############################################################
# MESSAGES:
# Below are the messages that will be broadcasted.
# To add more messages just write 'msg<number>'.
# DO NOT use the same number on multiple messages!
# ALWAYS use '' outside a message!
# Remove the '#' in front of the msg<number> when you want to enable them!
# Remove the '#' in front of the msg<number> when you want to enable it!

#msg1: 'Remove the '#' in front of this msg to enable it!'
#msg1: 'Remove the "#" in front of this msg to enable it!'
#msg2: 'You can add how many msgs as you want!'
#msg3: '&dYou can also use colorcodes! §aThis is GREEN §cThis is RED'
#msg3: '&dYou can also use colorcodes! &aThis is GREEN &cAnd this is RED'
#msg4: 'Remember to alsways use '' outside the message!'


Expand Down
Binary file modified jar/SimpleAutomessage.jar
Binary file not shown.
36 changes: 23 additions & 13 deletions src/com/carlgo11/simpleautomessage/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ public class Main extends JavaPlugin {
public void onEnable() {
this.getLogger().info(getDescription().getName() + getDescription().getVersion() + " is enabled!");
this.reloadConfig();
if (!getConfig().contains("auto-update")) {
this.getLogger().info("Config.yml outdated! Creating a new one.");
this.saveDefaultConfig();
}
checkVersion();
Time();
Broadcast();
Expand Down Expand Up @@ -65,16 +61,26 @@ public void checkConfig() {
this.saveDefaultConfig();
System.out.println("[" + getDescription().getName() + "] No config.yml detected, config.yml created");
}
// if (getConfig().contains("version")) { Not needed at the moment. I'll see if I want to use this later on.
// if (getConfig().getString("version").equals(getDescription().getVersion())) {
// } else {
// this.getLogger().warning("Config.yml outdated! creating a new one!");
// this.saveDefaultConfig();
// }
// } else {
// this.getLogger().warning("Could not find a version strin in the config! config.yml will be reset to default!");
// this.saveDefaultConfig();
// }
}

public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
String plainprefix = getConfig().getString("Prefix").toString().replaceAll("Â", "");
String prefix = "[" + plainprefix + "] ";
String prefixToSend = getConfig().getString("prefix");
String prefix = ChatColor.translateAlternateColorCodes('&', prefixToSend);
String badperm = prefix + ChatColor.RED + "Error: You don't have permission to use that command!";
if (cmd.getName().equalsIgnoreCase("simpleautomessage")) {
if (args.length == 0) {
if (sender.hasPermission("SimpleAutoMessage.cmd.main") || sender.hasPermission("SimpleAutoMessage.cmd.*")) {
sender.sendMessage(ChatColor.GREEN + "======== " + ChatColor.YELLOW + plainprefix + ChatColor.GREEN + " ======== ");
sender.sendMessage(ChatColor.GREEN + "======== " + ChatColor.YELLOW + prefix + ChatColor.GREEN + " ======== ");
sender.sendMessage(ChatColor.GRAY + "- /" + ChatColor.RED + "SimpleAutoMessage" + ChatColor.YELLOW + " Shows the commands");
sender.sendMessage(ChatColor.GRAY + "- /" + ChatColor.RED + "SimpleAutoMessage Reload" + ChatColor.YELLOW + " Reloads the config.yml");
} else {
Expand All @@ -86,23 +92,27 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
// this.reloadConfig();
getServer().getPluginManager().disablePlugin(this);
getServer().getPluginManager().enablePlugin(this);
sender.sendMessage(ChatColor.LIGHT_PURPLE + ChatColor.stripColor(plainprefix) + ChatColor.GREEN + "SimpleAutoMessage reloaded!");
sender.sendMessage(ChatColor.LIGHT_PURPLE + ChatColor.stripColor(prefix) + ChatColor.GREEN + "SimpleAutoMessage reloaded!");
} else {
sender.sendMessage(badperm);
}
} else {
sender.sendMessage(plainprefix + ChatColor.RED + "Error: Unknown command!");
sender.sendMessage(prefix + ChatColor.RED + "Error: Unknown command!");
}
} else if (args.length > 1) {
sender.sendMessage(plainprefix + ChatColor.RED + "Error: Unknown command!");
sender.sendMessage(prefix + ChatColor.RED + "Error: Unknown command!");
}
}
return true;
}

@EventHandler
public void Time() {
time = getConfig().getInt("Time");
if (!getConfig().contains("time")) {
debugmsg = "No time string found!";
onDebug();
}
time = getConfig().getInt("time");
if (getConfig().contains("Time-setup")) {
debugmsg = "Time-setup: string found!";
onDebug();
Expand All @@ -127,7 +137,7 @@ public void run() {
debugmsg = "time: " + d;
onDebug();
}
String prefixToSend = getConfig().getString("Prefix");
String prefixToSend = getConfig().getString("prefix");
String prefixToMC = ChatColor.translateAlternateColorCodes('&', prefixToSend);

if (getConfig().contains("msg" + tick)) {
Expand All @@ -146,7 +156,7 @@ public void run() {
getServer().broadcast("" + prefixToMC + " " + ChatColor.RESET + msgToMC, "SimpleAutoMessage.seemsg");
tick = 2;
} else {
System.out.println(getConfig().getString("Prefix") + " Error: No msg1 set in the config.yml!");
System.out.println(ChatColor.stripColor(prefixToMC) + " Error: No msg1 set in the config.yml! ");
}
}
}
Expand Down
39 changes: 30 additions & 9 deletions src/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
############################################################
# +------------------------------------------------------+ #
# | Notes | #
# +------------------------------------------------------+ #
############################################################
# Config for SimpleAutoMessage
# SimpleAutoMessage is a Bukkit plugin created by Carlgo11.
# http://youtube.com/Carlgo11
#

# COLORS:
# When adding colors use the minecraft colorcodes and replace the '&' with a '§'.
# When adding colors use the minecraft colorcodes.
# Example: &a = green, &d = purple.

# When this config.yml is broken it's often because of the msg strings! ALWAYS USE '' AROUND A MESSAGE!
# Example: msg1: 'This is an example'

#Don't Change the version! If version is changed this config.yml will be deleted!
version: 1.0.3

############################################################
# +------------------------------------------------------+ #
# | Settings | #
# +------------------------------------------------------+ #
############################################################
# Do you want to automatically get updates and bug-fixes when available?
auto-update: true

Expand All @@ -16,22 +32,27 @@
debug: false

# Prefix is the nick that will show up as the sender.
Prefix: §d[Server]
prefix: '&d[Server]'

# Time is the time between each message.
# TIME SHOULD BE IN SECONDS!
Time: 10

# Messages:
time: 10

############################################################
# +------------------------------------------------------+ #
# | Messages | #
# +------------------------------------------------------+ #
############################################################
# MESSAGES:
# Below are the messages that will be broadcasted.
# To add more messages just write 'msg<number>'.
# DO NOT use the same number on multiple messages!
# ALWAYS use '' outside a message!
# Remove the '#' in front of the msg<number> when you want to enable them!
# Remove the '#' in front of the msg<number> when you want to enable it!

#msg1: 'Remove the '#' in front of this msg to enable it!'
#msg1: 'Remove the "#" in front of this msg to enable it!'
#msg2: 'You can add how many msgs as you want!'
#msg3: '&dYou can also use colorcodes! §aThis is GREEN §cThis is RED'
#msg3: '&dYou can also use colorcodes! &aThis is GREEN &cAnd this is RED'
#msg4: 'Remember to alsways use '' outside the message!'


Expand Down

0 comments on commit 8fa0652

Please sign in to comment.