Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from heyimblake/dev
Browse files Browse the repository at this point in the history
Merge #1 and Fixes to master
  • Loading branch information
heyimblake authored Apr 13, 2017
2 parents cc46198 + a0c4dc9 commit 74d8368
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ target/
.idea/
*.iml
*.class

.classpath
.project
.settings/
# Mobile Tools for Java (J2ME)
.mtj.tmp/

Expand Down
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>me.heyimblake</groupId>
<artifactId>hiveranks</artifactId>
<name>HiveRanks</name>
<version>1.1.1-MC1.8.8</version>
<version>1.1.2-MC1.8.8</version>
<description>A Bukkit plugin to retrieve a player's HiveMC rank.</description>
<build>
<defaultGoal>clean package</defaultGoal>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.heyimblake</groupId>
<artifactId>hiveranks</artifactId>
<version>1.1.1-MC1.8.8</version>
<version>1.1.2-MC1.8.8</version>
<packaging>jar</packaging>

<name>HiveRanks</name>
Expand Down
Empty file modified src/main/java/me/heyimblake/hiveranks/CachedPlayerManager.java
100644 → 100755
Empty file.
11 changes: 10 additions & 1 deletion src/main/java/me/heyimblake/hiveranks/HiveRanks.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.logging.Level;

public class HiveRanks extends JavaPlugin {
private static HiveRanks instance;
private Metrics metrics;
private final int SERVER_VERSION = Bukkit.getVersion().contains("1.8") ? 8 : 9;

/**
* Gets the instance of this class.
Expand All @@ -20,15 +23,21 @@ public static HiveRanks getInstance() {
return instance;
}

public int getServerVersion(){
return SERVER_VERSION;
}

@Override
public void onEnable() {
instance = this;
PluginManager pluginManager = Bukkit.getPluginManager();

CachedPlayerManager.getInstance().initializeDirectory();
ScoreboardManager.getInstance().initializeScoreboard();

metrics = new Metrics(this);

getLogger().log(Level.INFO, "Detected server version: " + Bukkit.getVersion() + ". Features will be adjusted for this version.");

pluginManager.registerEvents(new PlayerJoinListener(), this);
getCommand("hiveranks").setExecutor(new HiveRanksCommand());
Expand Down
Empty file modified src/main/java/me/heyimblake/hiveranks/ScoreboardManager.java
100644 → 100755
Empty file.
Empty file.
6 changes: 3 additions & 3 deletions src/main/java/me/heyimblake/hiveranks/commands/HiveRanksCommand.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
* @param sender who to send the screen to
*/
private void showHelpScreen(Command command, CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "/" + command.getName() + " Sub-Commands:");
sender.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "/" + command.getName() + " Sub-Commands:");
for (Class<? extends AnnotatedHiveRanksSubCommand> clazz : subCommandClasses.values()) {
HiveRanksSubCommandExecutor executor = getSubCommandClassAnnotation(clazz);
sender.sendMessage(ChatColor.GRAY + "" + '\u25CF' + " " +
ChatColor.AQUA + executor.subCommand() + " " + ChatColor.DARK_AQUA + executor.syntax() + ChatColor.DARK_GRAY + " - " +
ChatColor.GOLD + executor.description());
ChatColor.GOLD + executor.subCommand() + " " + ChatColor.DARK_GRAY + executor.syntax() + ChatColor.DARK_GRAY + " - " +
ChatColor.GRAY + executor.description());
}
}

Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified src/main/java/me/heyimblake/hiveranks/util/CachedPlayer.java
100644 → 100755
Empty file.
Empty file modified src/main/java/me/heyimblake/hiveranks/util/HiveRank.java
100644 → 100755
Empty file.
12 changes: 8 additions & 4 deletions src/main/java/me/heyimblake/hiveranks/util/MessageUtils.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public class MessageUtils {
*/
public static void sendSuccessfulMessage(Player player, String string, boolean playSound) {
player.sendMessage(PREFIX + ChatColor.GRAY + string);
//I really don't feel like supporting 1.8 and 1.9 base servers because of sound. So I'm just going to quietly remove it.
if (playSound)
player.playSound(player.getEyeLocation(), ServerSound.LEVEL_UP.getSound(), 2, 2);
}

/**
Expand All @@ -35,7 +36,8 @@ public static void sendSuccessfulMessage(Player player, String string, boolean p
*/
public static void sendVariableSuccessfulMessage(Player player, boolean playSound, String base, String... variables) {
player.sendMessage(PREFIX + String.format(ChatColor.GRAY + base, variables));
//I really don't feel like supporting 1.8 and 1.9 base servers because of sound. So I'm just going to quietly remove it.
if (playSound)
player.playSound(player.getEyeLocation(), ServerSound.LEVEL_UP.getSound(), 2, 2);
}

/**
Expand All @@ -47,7 +49,8 @@ public static void sendVariableSuccessfulMessage(Player player, boolean playSoun
*/
public static void sendErrorMessage(Player player, String string, boolean playSound) {
player.sendMessage(PREFIX + ChatColor.DARK_RED + string);
//I really don't feel like supporting 1.8 and 1.9 base servers because of sound. So I'm just going to quietly remove it.
if (playSound)
player.playSound(player.getEyeLocation(), ServerSound.NOTE_BASS.getSound(), 2, 2);
}

/**
Expand All @@ -60,7 +63,8 @@ public static void sendErrorMessage(Player player, String string, boolean playSo
*/
public static void sendVariableErrorMessage(Player player, boolean playSound, String base, String... variables) {
player.sendMessage(PREFIX + String.format(ChatColor.DARK_RED + base, variables));
//I really don't feel like supporting 1.8 and 1.9 base servers because of sound. So I'm just going to quietly remove it.
if (playSound)
player.playSound(player.getEyeLocation(), ServerSound.NOTE_BASS.getSound(), 2, 2);
}

/**
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/me/heyimblake/hiveranks/util/ServerSound.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package me.heyimblake.hiveranks.util;

import org.bukkit.Sound;

import me.heyimblake.hiveranks.HiveRanks;

public enum ServerSound {
LEVEL_UP("LEVEL_UP", "ENTITY_PLAYER_LEVELUP"),
NOTE_BASS("NOTE_BASS", "BLOCK_NOTE_BASS");

private String name18;
private String name19;

ServerSound(String name18, String name19){
this.name18 = name18.toUpperCase();
this.name19 = name19.toUpperCase();
}

/**
* Gets the name of the current ServerSound based on the server's version.
*
* @return current sound version name
*/
private String getName() {
if (HiveRanks.getInstance().getServerVersion() >= 9) {
return this.name19;
}
return this.name18;
}

/**
* Gets the Sound object of the specified ServerSound.
*
* @return sound
*/
public Sound getSound(){
return Sound.valueOf(getName());
}
}
Empty file modified src/main/resources/cache.json
100644 → 100755
Empty file.
Empty file modified src/main/resources/plugin.yml
100644 → 100755
Empty file.

2 comments on commit 74d8368

@roccodev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the server is 1.7?

@heyimblake
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roccodev Not supporting 1.7. 1.8 or higher only.

Please sign in to comment.