Skip to content

Commit

Permalink
Add LuckPerms Context.
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Dec 20, 2023
1 parent adacd36 commit e6f4955
Show file tree
Hide file tree
Showing 22 changed files with 79 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .changelog/0.1.2.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
## Proxies
This release requires updating your proxy jars if you run them on your bungee/velocity instances.

Velocity: https://github.com/TheNewEconomy/EconomyCore/releases/download/Velocity-0.1.2.6-Pre1/TNE-VelocityCore-0.1.2.6-Pre1.jar
Bungee: https://github.com/TheNewEconomy/EconomyCore/releases/download/Bungee-0.1.2.6-Pre1/TNE-BungeeCore-0.1.2.6-Pre1.jar
Velocity: https://github.com/TheNewEconomy/EconomyCore/releases/download/Velocity-0.1.2.6-Pre2/TNE-VelocityCore-0.1.2.6-Pre2.jar
Bungee: https://github.com/TheNewEconomy/EconomyCore/releases/download/Bungee-0.1.2.6-Pre2/TNE-BungeeCore-0.1.2.6-Pre2.jar
2 changes: 1 addition & 1 deletion Bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
27 changes: 27 additions & 0 deletions Bukkit/src/net/tnemc/bukkit/command/CurrencyCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.tnemc.bukkit.command;
/*
* The New Economy
* Copyright (C) 2022 - 2023 Daniel "creatorfromhell" Vidmar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* CurrencyCommand
*
* @author creatorfromhell
* @since 0.1.2.0
*/
public class CurrencyCommand {
}
4 changes: 2 additions & 2 deletions Bukkit/src/net/tnemc/bukkit/hook/misc/LuckPermsHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import net.luckperms.api.LuckPerms;
import net.tnemc.bukkit.TNE;
import org.bukkit.Bukkit;

/**
* LuckPermsHook
Expand All @@ -29,7 +29,7 @@
public class LuckPermsHook {

public static void register() {
final LuckPerms luckAPI = TNE.instance().getServer().getServicesManager().load(LuckPerms.class);
final LuckPerms luckAPI = Bukkit.getServer().getServicesManager().load(LuckPerms.class);
if(luckAPI != null) {
luckAPI.getContextManager().registerCalculator(new LuckBalanceContext());
}
Expand Down
2 changes: 1 addition & 1 deletion Bungee/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
</parent>
</project>
2 changes: 1 addition & 1 deletion Core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
13 changes: 13 additions & 0 deletions Core/src/net/tnemc/core/command/CurrencyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,20 @@
*/
public class CurrencyCommand {

public static void onCreate(CmdSource<?> sender, final String name, final String type) {

}

public static void onInstall(CmdSource<?> sender, final String template) {

}


public static void onList(CmdSource<?> sender) {

}

public static void onSet(CmdSource<?> sender) {

}
}
13 changes: 11 additions & 2 deletions Core/src/net/tnemc/core/command/MoneyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import net.tnemc.core.currency.Currency;
import net.tnemc.core.currency.Note;
import net.tnemc.core.currency.format.CurrencyFormatter;
import net.tnemc.core.currency.item.ItemCurrency;
import net.tnemc.core.currency.type.MixedType;
import net.tnemc.core.io.message.MessageData;
import net.tnemc.core.manager.TopManager;
Expand Down Expand Up @@ -358,11 +359,19 @@ public static void onOther(CmdSource<?> sender, Account account, String region,
amount = amount.add(entry.getAmount());

if(entry.getHandler().asID().equalsIgnoreCase(EconomyManager.INVENTORY_ONLY.asID())) {
entryMSG.addReplacement("$inventory", CurrencyFormatter.format(account, entry));
if(currency.type().supportsItems()) {
entryMSG.addReplacement("$inventory", CurrencyFormatter.format(account, entry));
} else {
entryMSG.addReplacement("$inventory", "0");
}
}

if(entry.getHandler().asID().equalsIgnoreCase(EconomyManager.E_CHEST.asID())) {
entryMSG.addReplacement("$ender", CurrencyFormatter.format(account, entry));
if(currency.type().supportsItems()) {
entryMSG.addReplacement("$ender", CurrencyFormatter.format(account, entry));
} else {
entryMSG.addReplacement("$ender", "0");
}
}

if(entry.getHandler().asID().equalsIgnoreCase(EconomyManager.VIRTUAL.asID())) {
Expand Down
10 changes: 5 additions & 5 deletions Core/src/net/tnemc/core/currency/format/impl/MinorNameRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public String format(@Nullable Account account, HoldingsEntry entry, String form
/*
[15:52:47 WARN]: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
[15:52:47 WARN]: at java.base/java.lang.String.replace(String.java:2956)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre1.jar//net.tnemc.core.currency.format.impl.MinorNameRule.lambda$format$0(MinorNameRule.java:42)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre2.jar//net.tnemc.core.currency.format.impl.MinorNameRule.lambda$format$0(MinorNameRule.java:42)
[15:52:47 WARN]: at java.base/java.util.Optional.map(Optional.java:260)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre1.jar//net.tnemc.core.currency.format.impl.MinorNameRule.format(MinorNameRule.java:42)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre1.jar//net.tnemc.core.currency.format.CurrencyFormatter.format(CurrencyFormatter.java:77)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre1.jar//net.tnemc.core.command.MoneyCommand.onSet(MoneyCommand.java:299)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre1.jar//net.tnemc.bukkit.command.MoneyCommand.onSet(MoneyCom
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre2.jar//net.tnemc.core.currency.format.impl.MinorNameRule.format(MinorNameRule.java:42)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre2.jar//net.tnemc.core.currency.format.CurrencyFormatter.format(CurrencyFormatter.java:77)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre2.jar//net.tnemc.core.command.MoneyCommand.onSet(MoneyCommand.java:299)
[15:52:47 WARN]: at BukkitCore-0.1.2.6-Pre2.jar//net.tnemc.bukkit.command.MoneyCommand.onSet(MoneyCom
*/

final Optional<Currency> currency = entry.currency();
Expand Down
1 change: 0 additions & 1 deletion Core/src/net/tnemc/core/io/storage/engine/sql/SQLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import net.tnemc.core.config.DataConfig;
import net.tnemc.core.io.storage.Dialect;
import net.tnemc.core.io.storage.SQLEngine;
import net.tnemc.core.io.storage.engine.StandardSQL;
Expand Down
2 changes: 1 addition & 1 deletion Currency Templates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
</parent>

<artifactId>TNETemplates</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion FabricCore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"

compileOnly(group:'net.tnemc', name: 'EconomyCore', version: '0.1.2.6-Pre1')
compileOnly(group:'net.tnemc', name: 'EconomyCore', version: '0.1.2.6-Pre2')
compileOnly(group:'net.tnemc', name: 'TNML-CORE', version: '1.0-SNAPSHOT-18')
}

Expand Down
2 changes: 1 addition & 1 deletion FabricCore/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
tne_version=0.1.2.6-Pre1
tne_version=0.1.2.6-Pre2
yarn_mappings=1.19.4+build.2
loader_version=0.14.19

Expand Down
6 changes: 3 additions & 3 deletions Folia/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>EconomyCore</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand All @@ -186,7 +186,7 @@
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>BukkitCore</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand Down Expand Up @@ -220,7 +220,7 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
4 changes: 2 additions & 2 deletions PaperCore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>EconomyCore</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand Down Expand Up @@ -282,7 +282,7 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
3 changes: 2 additions & 1 deletion PaperCore/src/net/tnemc/paper/hook/misc/LuckPermsHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import net.luckperms.api.LuckPerms;
import org.bukkit.Bukkit;

/**
* LuckPermsHook
Expand All @@ -28,7 +29,7 @@
public class LuckPermsHook {

public static void register() {
final LuckPerms luckAPI = TNE.instance().getServer().getServicesManager().load(LuckPerms.class);
final LuckPerms luckAPI = Bukkit.getServer().getServicesManager().load(LuckPerms.class);
if(luckAPI != null) {
luckAPI.getContextManager().registerCalculator(new LuckBalanceContext());
}
Expand Down
2 changes: 1 addition & 1 deletion Sponge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
2 changes: 1 addition & 1 deletion Sponge/resources/META-INF/sponge_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"license": "AGPL",
"global": {
"version": "0.1.2.6-Pre1",
"version": "0.1.2.6-Pre2",
"links": {
"homepage": "https://tnemc.net",
"source": "https://github.com/TheNewEconomy/EconomyCore",
Expand Down
2 changes: 1 addition & 1 deletion Sponge8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
2 changes: 0 additions & 2 deletions Sponge8/src/net/tnemc/sponge/command/ModuleCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import net.tnemc.core.TNECore;
import net.tnemc.sponge.impl.SpongeCMDSource;
import revxrsal.commands.annotation.Command;
import revxrsal.commands.annotation.Default;
import revxrsal.commands.annotation.DefaultFor;
import revxrsal.commands.annotation.Description;
import revxrsal.commands.annotation.Subcommand;
Expand Down
4 changes: 2 additions & 2 deletions Velocity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>BungeeCore</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<scope>compile</scope>
</dependency>
</dependencies>

<parent>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
</parent>
</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.tnemc</groupId>
<artifactId>TNE</artifactId>
<version>0.1.2.6-Pre1</version>
<version>0.1.2.6-Pre2</version>
<packaging>pom</packaging>
<name>The New Economy</name>

Expand Down

0 comments on commit e6f4955

Please sign in to comment.