Skip to content

Commit

Permalink
latest changes, pretty solid stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
xnite committed Jun 9, 2021
1 parent 0f993a5 commit c83bb90
Show file tree
Hide file tree
Showing 8 changed files with 838 additions and 838 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# BobRewards
BobRewards provides a simple key + "crate" rewards system for your players.
It is very simple to setup and use, and configuring the rewards that will be possible to obtain from each crate is all done through an Inventory GUI!

# Commands & Permissions

- `/givebox <green|blue|red|black>`: Gives you a Rewards Box that players can bring keys to in order to collect rewards. Requires permission: `bob.rewards.give.box`.
- `/givekey <green|blue|red|black> <player>`: Gives a key to a player. Requires permission: `bob.rewards.give.key`.
# BobRewards
BobRewards provides a simple key + "crate" rewards system for your players.
It is very simple to setup and use, and configuring the rewards that will be possible to obtain from each crate is all done through an Inventory GUI!

# Commands & Permissions

- `/givebox <green|blue|red|black>`: Gives you a Rewards Box that players can bring keys to in order to collect rewards. Requires permission: `bob.rewards.give.box`.
- `/givekey <green|blue|red|black> <player>`: Gives a key to a player. Requires permission: `bob.rewards.give.key`.
- `/setrewards <green|blue|red|black>`: Opens up the rewards pool inventory so that you can set the items for the given box. Requires permission: `bob.rewards.set`.
174 changes: 87 additions & 87 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.survivorbob</groupId>
<artifactId>bobrewards</artifactId>
<version>1.0-RC1</version>
<packaging>jar</packaging>

<name>BobRewards</name>

<description>Rewards system that uses boxes which are unlocked with keys to distribute configured rewards.
</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>https://www.SurvivorBob.com/</url>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.survivorbob</groupId>
<artifactId>bobrewards</artifactId>
<version>1.0-RC1</version>
<packaging>jar</packaging>

<name>BobRewards</name>

<description>Rewards system that uses boxes which are unlocked with keys to distribute configured rewards.
</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>https://www.SurvivorBob.com/</url>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
168 changes: 84 additions & 84 deletions src/main/java/com/survivorbob/bobrewards/Commands/GiveKey.java
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
package com.survivorbob.bobrewards.Commands;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.List;

public class GiveKey implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if(!sender.hasPermission("bob.rewards.give.key"))
{
return false;
}
Player p = null;
if(!args[1].isEmpty())
{
p = (Player) sender.getServer().getPlayer(args[1]);
if(p == null) {
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.RESET + " Could not find player: " + args[1] + "!");
return true;
}
} else {
p = (Player) sender;
}
ItemStack theKey;
ItemMeta theKeyMeta;
List<String> theLore = new ArrayList<String>();
switch(args[0].toLowerCase()) {
case "green":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.GREEN + "Green Key");
theLore.add("Use this " + ChatColor.GREEN + "Green Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.GREEN + "Green Key" + ChatColor.RESET + " should now be in your inventory!");
break;
case "blue":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.BLUE + "Blue Key");
theLore.add("Use this " + ChatColor.BLUE + "Blue Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.BLUE + "Blue Key" + ChatColor.RESET + " should now be in your inventory!");
break;
case "red":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.RED + "Red Key");
theLore.add("Use this " + ChatColor.RED + "Red Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.RED + "Red Key" + ChatColor.RESET + " should now be in your inventory!");
break;
case "black":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.BLACK + "Black Key");
theLore.add("Use this " + ChatColor.BLACK + "Black Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.BLACK + "Black Key" + ChatColor.RESET + " should now be in your inventory!");
break;
default:
sender.sendMessage("You must specify a Key of green, blue, red, or black!");
break;
}
return true;
}
}
package com.survivorbob.bobrewards.Commands;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.List;

public class GiveKey implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if(!sender.hasPermission("bob.rewards.give.key"))
{
return false;
}
Player p = null;
if(!args[1].isEmpty())
{
p = (Player) sender.getServer().getPlayer(args[1]);
if(p == null) {
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.RESET + " Could not find player: " + args[1] + "!");
return true;
}
} else {
p = (Player) sender;
}
ItemStack theKey;
ItemMeta theKeyMeta;
List<String> theLore = new ArrayList<String>();
switch(args[0].toLowerCase()) {
case "green":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.GREEN + "Green Key");
theLore.add("Use this " + ChatColor.GREEN + "Green Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.GREEN + "Green Key" + ChatColor.RESET + " should now be in your inventory!");
break;
case "blue":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.BLUE + "Blue Key");
theLore.add("Use this " + ChatColor.BLUE + "Blue Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.BLUE + "Blue Key" + ChatColor.RESET + " should now be in your inventory!");
break;
case "red":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.RED + "Red Key");
theLore.add("Use this " + ChatColor.RED + "Red Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.RED + "Red Key" + ChatColor.RESET + " should now be in your inventory!");
break;
case "black":
theKey = new ItemStack(Material.PAPER, 1);
theKeyMeta = theKey.getItemMeta();
theKeyMeta.setDisplayName(ChatColor.BLACK + "Black Key");
theLore.add("Use this " + ChatColor.BLACK + "Black Key" + ChatColor.RESET + " to claim rewards!");
theKeyMeta.setLore(theLore);
theKey.setItemMeta(theKeyMeta);
p.getInventory().addItem(theKey);
sender.sendMessage("A " + ChatColor.BLACK + "Black Key" + ChatColor.RESET + " should now be in your inventory!");
break;
default:
sender.sendMessage("You must specify a Key of green, blue, red, or black!");
break;
}
return true;
}
}
Loading

0 comments on commit c83bb90

Please sign in to comment.