Skip to content

Commit

Permalink
Remove todo's that weren't really todo's!
Browse files Browse the repository at this point in the history
  • Loading branch information
Staartvin committed Nov 16, 2019
1 parent 636daf0 commit 92abe0f
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 166 deletions.
252 changes: 119 additions & 133 deletions src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,155 +17,141 @@
* <a href="https://www.spigotmc.org/resources/autorank.3239/">link</a>.
* <p>
* Date created: 14:21:44 12 aug. 2015
*
* @author Staartvin
*
* @author Staartvin
*/
public class AutorankHook extends LibraryHook {

private Autorank autorank;

/*
* (non-Javadoc)
*
* @see me.staartvin.plugins.pluginlibrary.LibraryHook#isAvailable()
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub
private Autorank autorank;

/*
* (non-Javadoc)
*
* @see me.staartvin.plugins.pluginlibrary.LibraryHook#isAvailable()
*/
@Override
public boolean isAvailable() {
return true;
}

/*
* (non-Javadoc)
*
* @see me.staartvin.plugins.pluginlibrary.LibraryHook#hook()
*/
@Override
public boolean hook() {
// TODO Auto-generated method stub

if (!isAvailable())
return false;

autorank = (Autorank) this.getPlugin().getServer().getPluginManager()
}

/*
* (non-Javadoc)
*
* @see me.staartvin.plugins.pluginlibrary.LibraryHook#hook()
*/
@Override
public boolean hook() {
if (!isAvailable())
return false;

autorank = (Autorank) this.getPlugin().getServer().getPluginManager()
.getPlugin(Library.AUTORANK.getInternalPluginName());

return autorank != null;
}

/**
* Gets playtime of a player in minutes on this local server.
*
* @param uuid
* UUID of the player
* @return amount of minutes a player has played.
*/
public int getLocalPlayTime(UUID uuid) {
return autorank != null;
}

/**
* Gets playtime of a player in minutes on this local server.
*
* @param uuid UUID of the player
* @return amount of minutes a player has played.
*/
public int getLocalPlayTime(UUID uuid) {
if (!this.isAvailable()) return -1;
return autorank.getAPI().getLocalPlayTime(uuid);
}

/**
* When Autorank is set up on multiple servers in the same network, it will
* sum a player's time across all servers. <br>
* If a player plays on server A for 10 minutes and on server B for 15
* minutes, the global time will be 25 minutes. <br>
* This method allows you to get the global time of a player in minutes.
*
* @param uuid
* UUID of the player
* @return amount of minutes a player has played across all servers in the
* network.
*/
public int getGlobalPlayTime(UUID uuid) {
return autorank.getAPI().getLocalPlayTime(uuid);
}

/**
* When Autorank is set up on multiple servers in the same network, it will
* sum a player's time across all servers. <br>
* If a player plays on server A for 10 minutes and on server B for 15
* minutes, the global time will be 25 minutes. <br>
* This method allows you to get the global time of a player in minutes.
*
* @param uuid UUID of the player
* @return amount of minutes a player has played across all servers in the
* network.
*/
public int getGlobalPlayTime(UUID uuid) {
if (!this.isAvailable()) return -1;
return autorank.getAPI().getGlobalPlayTime(uuid);
}

/**
* When a player is in a permission group that has requirements before the
* player can rank up, <br>
* this method will show all the requirements that the player should
* complete before he ranks up. <br>
* This method does not take into account which requirements are already
* completed by the player. <br>
* If you only want the requirements that have yet to be completed by the
* player, <br>
* use {@link #getFailedRequirements(Player)}. <br>
* This method merely copies the config of Autorank and is used for getting
* all the requirements of a player's permission group.
*
* @param player
* Player to get the requirements for.
* @return A list of all requirements
*/
public List<CompositeRequirement> getAllRequirements(Player player) {
return autorank.getAPI().getGlobalPlayTime(uuid);
}

/**
* When a player is in a permission group that has requirements before the
* player can rank up, <br>
* this method will show all the requirements that the player should
* complete before he ranks up. <br>
* This method does not take into account which requirements are already
* completed by the player. <br>
* If you only want the requirements that have yet to be completed by the
* player, <br>
* use {@link #getFailedRequirements(Player)}. <br>
* This method merely copies the config of Autorank and is used for getting
* all the requirements of a player's permission group.
*
* @param player Player to get the requirements for.
* @return A list of all requirements
*/
public List<CompositeRequirement> getAllRequirements(Player player) {
if (!this.isAvailable()) return new ArrayList<>();
return autorank.getAPI().getAllRequirements(player);
}

/**
* See {@link #getAllRequirements(Player)} for more info. <br>
* This method only returns the requirements that have yet to be completed
* by the player.
*
* @param player
* Player to get the requirements for.
* @return A list of all requirements that should still be completed.
*/
public List<CompositeRequirement> getFailedRequirements(Player player) {
return autorank.getAPI().getAllRequirements(player);
}

/**
* See {@link #getAllRequirements(Player)} for more info. <br>
* This method only returns the requirements that have yet to be completed
* by the player.
*
* @param player Player to get the requirements for.
* @return A list of all requirements that should still be completed.
*/
public List<CompositeRequirement> getFailedRequirements(Player player) {
if (!this.isAvailable()) return new ArrayList<>();
return autorank.getAPI().getFailedRequirements(player);
}

/**
* Gets a list of all permission groups a player is currently in. <br>
* Most permission plugins only allow a player to be in one group at the
* time, but some allow multiple.
*
* @param player
* Player to get the groups of.
* @return a list of groups a player is part of.
*/
public Collection<String> getPermissionGroups(Player player) {
return autorank.getAPI().getFailedRequirements(player);
}

/**
* Gets a list of all permission groups a player is currently in. <br>
* Most permission plugins only allow a player to be in one group at the
* time, but some allow multiple.
*
* @param player Player to get the groups of.
* @return a list of groups a player is part of.
*/
public Collection<String> getPermissionGroups(Player player) {
if (!this.isAvailable()) return new ArrayList<>();
return autorank.getPermPlugHandler().getPermissionPlugin().getPlayerGroups(player);
}

/**
* Registers a custom requirement to Autorank. <br>
* Users of Autorank can use different requirements already coded by the
* author, <br>
* but it's also possible to add your own requirements. <br>
* For more info about custom requirements and results, see: <br>
* <a href=
* "https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom-requirements">
* https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom-
* requirements</a>
*
* @param requirementName
* Name of the requirement.
* @param req
* The custom requirement class for Autorank to use.
*/
return autorank.getPermPlugHandler().getPermissionPlugin().getPlayerGroups(player);
}

/**
* Registers a custom requirement to Autorank. <br>
* Users of Autorank can use different requirements already coded by the
* author, <br>
* but it's also possible to add your own requirements. <br>
* For more info about custom requirements and results, see: <br>
* <a href=
* "https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom-requirements">
* https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom-
* requirements</a>
*
* @param requirementName Name of the requirement.
* @param req The custom requirement class for Autorank to use.
*/
public void registerRequirement(String requirementName, Class<? extends AbstractRequirement> req) {
if (!this.isAvailable()) return;
autorank.getAPI().registerRequirement(requirementName, req);
}

/**
* @see #registerRequirement(String, Class)
* @param resultName
* The name of the result.
* @param res
* The custom result class for Autorank to use.
*/
public void registerResult(String resultName,
autorank.getAPI().registerRequirement(requirementName, req);
}

/**
* @param resultName The name of the result.
* @param res The custom result class for Autorank to use.
* @see #registerRequirement(String, Class)
*/
public void registerResult(String resultName,
Class<? extends AbstractResult> res) {
if (!this.isAvailable()) return;
autorank.getAPI().registerResult(resultName, res);
}
autorank.getAPI().registerResult(resultName, res);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public class EssentialsXHook extends LibraryHook {
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub

return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.ESSENTIALSX.getInternalPluginName());
}

Expand All @@ -37,8 +35,6 @@ public boolean isAvailable() {
*/
@Override
public boolean hook() {
// TODO Auto-generated method stub

if (!isAvailable())
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public class FactionsHook extends LibraryHook {
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub

return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.FACTIONS.getInternalPluginName());
}

Expand All @@ -46,8 +44,6 @@ public boolean isAvailable() {
*/
@Override
public boolean hook() {
// TODO Auto-generated method stub

if (!isAvailable())
return false;

Expand Down
4 changes: 0 additions & 4 deletions src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public class McMMOHook extends LibraryHook {
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub

return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.MCMMO.getInternalPluginName());
}

Expand All @@ -46,8 +44,6 @@ public boolean isAvailable() {
*/
@Override
public boolean hook() {
// TODO Auto-generated method stub

if (!isAvailable())
return false;

Expand Down
2 changes: 0 additions & 2 deletions src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public class OnTimeHook extends LibraryHook {
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub

return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.ONTIME.getInternalPluginName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class QuestsAlternative extends LibraryHook {
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub
Plugin plugin = this.getPlugin().getServer().getPluginManager().getPlugin(Library.QUESTS_ALTERNATIVE
.getInternalPluginName());

Expand All @@ -45,8 +44,6 @@ public boolean isAvailable() {
*/
@Override
public boolean hook() {
// TODO Auto-generated method stub

if (!isAvailable())
return false;

Expand Down
2 changes: 0 additions & 2 deletions src/me/staartvin/plugins/pluginlibrary/hooks/QuestsHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public boolean isAvailable() {
*/
@Override
public boolean hook() {
// TODO Auto-generated method stub

if (!isAvailable())
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public class SavageFactionsHook extends LibraryHook {
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub

return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.SAVAGE_FACTIONS
.getInternalPluginName());
}
Expand All @@ -49,8 +47,6 @@ public boolean isAvailable() {
*/
@Override
public boolean hook() {
// TODO Auto-generated method stub

if (!isAvailable())
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class StatsHook extends LibraryHook {
*/
@Override
public boolean isAvailable() {
// TODO Auto-generated method stub
return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.STATS.getInternalPluginName());
}

Expand Down
Loading

0 comments on commit 92abe0f

Please sign in to comment.