forked from CyberFlameGO/Reclaim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ba7db56
Showing
14 changed files
with
291 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="test" value="true"/> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | ||
<attributes> | ||
<attribute name="test" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry exported="true" kind="lib" path="/Users/cyberflame/Documents/Projects/minecraft/BuildTools/Vault.jar"/> | ||
<classpathentry kind="lib" path="/Users/cyberflame/Documents/Projects/minecraft/BuildTools/spigot-1.8.8.jar"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>reclaim</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.5 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>me.cyberfla.reclaim</groupId> | ||
<artifactId>reclaim</artifactId> | ||
<version>420</version> | ||
<name>Reclaim</name> | ||
<repositories> | ||
<repository> | ||
<id>spigot-repo</id> | ||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> | ||
</repository> | ||
<repository> | ||
<id>vault-repo</id> | ||
<url>http://nexus.hc.to/content/repositories/pub_releases</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot-api</artifactId> | ||
<version>1.8.8-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.milkbowl.vault</groupId> | ||
<artifactId>VaultAPI</artifactId> | ||
<version>1.7</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<defaultGoal>clean install</defaultGoal> | ||
<finalName>${project.name}</finalName> | ||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory> | ||
<resources> | ||
<resource> | ||
<targetPath>.</targetPath> | ||
<filtering>true</filtering> | ||
<directory>${basedir}/src/main/resources/</directory> | ||
<includes> | ||
<include>*.yml</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>2.3</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<createDependencyReducedPom>false</createDependencyReducedPom> | ||
<filters> | ||
<filter> | ||
<artifact>*:*</artifact> | ||
<excludes> | ||
<exclude>META-INF/*.SF</exclude> | ||
<exclude>META-INF/*.DSA</exclude> | ||
<exclude>META-INF/*.RSA</exclude> | ||
</excludes> | ||
</filter> | ||
</filters> | ||
|
||
<artifactSet> | ||
<excludes> | ||
<exclude>org.bukkit:*</exclude> | ||
</excludes> | ||
</artifactSet> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package me.cyberfla.reclaim; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public class Main extends JavaPlugin { | ||
private static Main plugin; | ||
|
||
List<String> used = new ArrayList<>(); | ||
|
||
public static Main getPlugin() { | ||
return plugin; | ||
} | ||
|
||
public void onEnable() { | ||
plugin = this; | ||
saveDefaultConfig(); | ||
} | ||
|
||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { | ||
if (sender instanceof Player) { | ||
Player p = (Player)sender; | ||
FileConfiguration config = getConfig(); | ||
String groupName = VaultChecker.getVaultPermission().getPlayerGroups(p)[0]; | ||
String redeemedPlayers = "Reclaim.redeemedPlayers."; | ||
String groups = "Reclaim.groups."; | ||
if (commandLabel.equalsIgnoreCase("reclaim")) | ||
if (config.getString(String.valueOf(groups) + groupName) == null) { | ||
p.sendMessage(ChatColor.RED + "You dont have anything to reclaim!"); | ||
} else { | ||
if (config.getStringList(String.valueOf(redeemedPlayers) + groupName) != null) | ||
this.used.addAll(config.getStringList(String.valueOf(redeemedPlayers) + groupName)); | ||
if (this.used.contains(p.getName().toLowerCase())) { | ||
p.sendMessage(ChatColor.RED + "You have already reclaimed your rewards."); | ||
} else { | ||
this.used.add(p.getName().toLowerCase()); | ||
config.set(String.valueOf(redeemedPlayers) + groupName, this.used); | ||
saveConfig(); | ||
for (String reclaimCommand : config.getStringList(String.valueOf(groups) + groupName)) | ||
Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), reclaimCommand.replace("{PLAYER}", p.getName())); | ||
if (config.getBoolean("Broadcast")) | ||
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', config.getString("Message").replace("{PLAYER}", p.getName()).replace("{GROUP}", groupName))); | ||
} | ||
} | ||
if (commandLabel.equalsIgnoreCase("resetreclaim")) | ||
if (args.length == 0) { | ||
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6&m----------&6[&eReclaim&6]&6&m----------")); | ||
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aDeveloper: &cCyberFlame")); | ||
} else if (args.length >= 1) { | ||
if (sender.hasPermission("reclaim.reload")) { | ||
if (args[0].equalsIgnoreCase("reload")) { | ||
reloadConfig(); | ||
sender.sendMessage(ChatColor.GREEN + "You have reloaded the config."); | ||
} | ||
} else { | ||
sender.sendMessage(ChatColor.RED + "You do not have permission to perform this action."); | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package me.cyberfla.reclaim; | ||
|
||
import net.milkbowl.vault.permission.Permission; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.plugin.Plugin; | ||
import org.bukkit.plugin.RegisteredServiceProvider; | ||
|
||
public class VaultChecker { | ||
private static Permission permission; | ||
|
||
public static void checkVault() { | ||
if (Bukkit.getPluginManager().getPlugin("Vault").isEnabled()) { | ||
Bukkit.getConsoleSender().sendMessage("[Reclaim] §cVault is not enabled or installed. Aborting..."); | ||
Bukkit.getPluginManager().disablePlugin((Plugin)Main.getPlugin()); | ||
} | ||
} | ||
public static void setupVault() { | ||
RegisteredServiceProvider<Permission> rsp = Bukkit.getServicesManager().getRegistration(Permission.class); | ||
if (rsp != null) { | ||
permission = (Permission)rsp.getProvider(); | ||
} else { | ||
Bukkit.getConsoleSender().sendMessage("[Reclaim] §cAn error occured whilst registering permissions with Vault..."); | ||
checkVault(); | ||
return; | ||
} | ||
Bukkit.getConsoleSender().sendMessage("[Reclaim] Successfully hooked into Vault."); | ||
} | ||
|
||
public static void unregisterVault() { | ||
if (permission != null) | ||
permission = null; | ||
} | ||
|
||
public static Permission getVaultPermission() { | ||
if (permission != null) | ||
return permission; | ||
checkVault(); | ||
return permission; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: ${project.name} | ||
main: me.cyberfla.reclaim.Main | ||
version: ${project.version} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: Reclaim | ||
main: me.cyberfla.reclaim.Main | ||
version: 420 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Generated by Maven | ||
#Fri Dec 04 17:18:40 NZDT 2020 | ||
version=420 | ||
groupId=me.cyberfla.reclaim | ||
artifactId=reclaim |
Binary file not shown.