Skip to content

Commit

Permalink
Merge pull request #1 from Sarinsa/Merge
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
monsterwhat authored Mar 4, 2023
2 parents ff2fd35 + bb0b1c6 commit c5e6098
Show file tree
Hide file tree
Showing 56 changed files with 189 additions and 14 deletions.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added .gradle/7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file added .gradle/7.1/fileChanges/last-build.bin
Binary file not shown.
Binary file added .gradle/7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file added .gradle/7.1/fileHashes/fileHashes.lock
Binary file not shown.
Empty file added .gradle/7.1/gc.properties
Empty file.
Binary file added .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 2 additions & 0 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Sat Feb 25 16:34:07 CST 2023
gradle.version=7.1
Binary file added .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file added .gradle/checksums/checksums.lock
Binary file not shown.
Binary file added .gradle/checksums/md5-checksums.bin
Binary file not shown.
Binary file added .gradle/checksums/sha1-checksums.bin
Binary file not shown.
Empty file added .gradle/vcs-1/gc.properties
Empty file.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/modules/DecaAddons.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

group = 'sarinsa'
// MC, MAJOR, MINOR
version = '2.0.0'
version = '2.2.1'

repositories {
mavenCentral()
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/libs/DecaAddons-2.2.1.jar
Binary file not shown.
67 changes: 67 additions & 0 deletions build/resources/main/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: DecaAddons
version: 2.2.1
description: "Some nifty features for Deca"
api-version: 1.19
author: Sarinsa, MonsterWhat
main: com.sarinsa.core.DecaAddons
depend: [Vault]

commands:

ride:
description: "Ride any living entity close to you."
permission: "decaaddons.ride"
usage: "/ride [player]"

fireride:
description: "Ride a fireball in the direction you are looking."
permission: "decaaddons.fireride"
permission-message: "You are not allowed to ride balls made out of fire."
usage: "/fireride"

skullride:
description: "Ride a wither skull in the direction you are looking."
permission: "decaaddons.skullride"
permission-message: "You are not allowed to cruise the air currents while sitting on a skull."
usage: "/skullride"

guardians:
description: "Base command for guardians."
usage: "/guardians"

bottlexp:
description: "Store all your experience in one consumable bottle."
usage: "/bottlexp"

nopickup:
description: "Toggle item pickup."
usage: "/nopickup"

punch:
description: "Punch a friend into The End!"
permission: "decaaddons.punch"
permission-message: "It is rude to punch people."
usage: "/punch (player)"

fakejoin:
aliases: "fjoin"
description: "Broadcast a fake join message with the specified player."
permission: "decaaddons.fake"
permission-message: "omg ur so fake"
usage: "/fakejoin (player)"

fakeleave:
aliases: "fleave"
description: "Broadcast a fake leave message with the specified player"
permission: "decaaddons.fake"
permission-message: "omg ur so fake"
usage: "/fakeleave (player)"

decaaddons:
aliases: "da"
description: "Base command for DecaAddons related commands."
usage: "/decaaddons help|permissions"

permissions:
decaaddons.permissions:
default: op
Binary file not shown.
2 changes: 2 additions & 0 deletions build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

13 changes: 9 additions & 4 deletions src/main/java/com/sarinsa/commands/GuardiansExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.Objects;

public class GuardiansExecutor implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
int guardians = DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString()).getInt("guardians");
int guardians = Objects.requireNonNull(DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString())).getInt("guardians");

String status = ChatColor.RED + "OFF";

Expand All @@ -37,7 +39,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
if (args.length == 1) {
if (money >= cost) {
DecaAddons.economy.withdrawPlayer(player, cost);
DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString()).set("guardians", ++guardians);
Objects.requireNonNull(DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString())).set("guardians", ++guardians);
DecaAddons.INSTANCE.saveConfiguration("playerProps.yml", DecaAddons.PLAYER_PROPS);

player.sendMessage(ChatColor.GREEN + "You purchased a Guardian.");
Expand All @@ -50,8 +52,11 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String

//Buying multiple
else if (args.length == 2) {
if (!args[1].matches("\\d+")) {
player.sendMessage(ChatColor.RED + "\"" + args[1] + "\" is not a valid number.");
return true;
}
int amount;

try {
amount = Integer.parseInt(args[1]);
}
Expand All @@ -68,7 +73,7 @@ else if (args.length == 2) {

if (money >= cost) {
DecaAddons.economy.withdrawPlayer(player, cost);
DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString()).set("guardians", guardians + amount);
Objects.requireNonNull(DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString())).set("guardians", guardians + amount);
DecaAddons.INSTANCE.saveConfiguration("playerProps.yml", DecaAddons.PLAYER_PROPS);

player.sendMessage(ChatColor.GREEN + "You purchased " + ChatColor.AQUA + amount + ChatColor.GREEN + " guardians");
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/sarinsa/commands/PunchExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.bukkit.entity.Player;
import com.sarinsa.util.References;

import java.util.Objects;

public class PunchExecutor implements CommandExecutor {

// TODO - Sending people to the end is potentially dangerous; consider a special "spawn point"
Expand All @@ -33,7 +35,6 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
if (target != null) {
String worldName = DecaAddons.CONFIG.getString("punch_world_name");
String locString = DecaAddons.CONFIG.getString("punch_location");

if (worldName == null) {
player.sendMessage(ChatColor.RED + "World variable not set. Nag staff about this; preferably MoNsTeR_WhAt");
return true;
Expand All @@ -42,7 +43,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
player.sendMessage(ChatColor.RED + "Could not find the \"punch world\". Contact staff!");
return true;
}
target.teleport(Bukkit.getServer().getWorld(worldName).getSpawnLocation());
target.teleport(Objects.requireNonNull(Bukkit.getServer().getWorld(worldName)).getSpawnLocation());
String name = target.getName();

if (target.getName().equals(player.getName())) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/sarinsa/core/DecaAddons.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void onEnable() {
if (!setupEconomy()) {
getServer().getPluginManager().disablePlugin(this);
}

this.getServer().getPluginManager().registerEvents(new DAListener(), this);

this.createDir();
Expand Down Expand Up @@ -86,12 +87,13 @@ public FileConfiguration getConfiguration(String configFile) {
}

public void saveConfiguration(String configFile, FileConfiguration fileConfiguration) {
File config = new File(getDataFolder(), configFile);

if (fileConfiguration == null) {
throw new IllegalStateException("Tried saving a null config instance. File: " + configFile);
getLogger().warning("Attempted to save null configuration: " + configFile);
return;
}

File config = new File(getDataFolder(), configFile);

try {
fileConfiguration.save(config);
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/sarinsa/util/Utility.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.sarinsa.util;

import com.sarinsa.core.DecaAddons;

import java.util.Objects;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
Expand All @@ -14,7 +16,7 @@ public class Utility {
*/
public static boolean isGuardianActive(Player player) {
try {
return DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString()).getBoolean("isGuardianActive");
return Objects.requireNonNull(DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString())).getBoolean("isGuardianActive");
}
catch (Exception e) {
player.sendMessage(ChatColor.RED + "An error occurred while trying to fetch your active guardian entry.");
Expand All @@ -28,7 +30,7 @@ public static boolean isGuardianActive(Player player) {
*/
public static void setGuardianActive(Player player, boolean active) {
try {
DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString()).set("isGuardianActive", active);
Objects.requireNonNull(DecaAddons.PLAYER_PROPS.getConfigurationSection(player.getUniqueId().toString())).set("isGuardianActive", active);
}
catch (Exception e) {
player.sendMessage(ChatColor.RED + "An error occurred while trying to fetch your active guardian entry.");
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: DecaAddons
version: 2.0.0
version: 2.2.1
description: "Some nifty features for Deca"
api-version: 1.19
author: Sarinsa
author: Sarinsa, MonsterWhat
main: com.sarinsa.core.DecaAddons
depend: [Vault]

Expand Down

0 comments on commit c5e6098

Please sign in to comment.