Skip to content

Commit 1ec9655

Browse files
authored
Merge pull request #19 from JavaJava19/develop
tne対応
2 parents a891a87 + 2291b03 commit 1ec9655

File tree

6 files changed

+59
-67
lines changed

6 files changed

+59
-67
lines changed

pom.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@
115115
<version>1.7.1-SNAPSHOT</version>
116116
<scope>compile</scope>
117117
</dependency>
118-
<dependency>
119-
<groupId>com.github.MilkBowl</groupId>
120-
<artifactId>VaultAPI</artifactId>
121-
<version>1.7</version>
122-
<scope>provided</scope>
123-
</dependency>
124118
<dependency>
125119
<groupId>com.fatboyindustrial.gson-javatime-serialisers</groupId>
126120
<artifactId>gson-javatime-serialisers</artifactId>
@@ -158,5 +152,12 @@
158152
<artifactId>HikariCP</artifactId>
159153
<version>5.0.1</version>
160154
</dependency>
155+
<dependency>
156+
<groupId>net.tnemc.TNE</groupId>
157+
<artifactId>tne</artifactId>
158+
<version>1.1.9.2</version>
159+
<scope>system</scope>
160+
<systemPath>${project.basedir}/lib/TNE-0.1.1.16.jar</systemPath>
161+
</dependency>
161162
</dependencies>
162163
</project>

src/main/java/com/github/elic0de/thejpspit/TheJpsPit.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import com.github.elic0de.thejpspit.hook.EconomyHook;
1616
import com.github.elic0de.thejpspit.hook.Hook;
1717
import com.github.elic0de.thejpspit.hook.PlaceholderHook;
18-
import com.github.elic0de.thejpspit.hook.VaultEconomyHook;
18+
import com.github.elic0de.thejpspit.hook.TneEconomyHook;
1919
import com.github.elic0de.thejpspit.item.ItemManager;
2020
import com.github.elic0de.thejpspit.leveler.Levels;
2121
import com.github.elic0de.thejpspit.listener.BlockPlaceListener;
@@ -35,7 +35,6 @@
3535
import java.util.ArrayList;
3636
import java.util.List;
3737
import java.util.Optional;
38-
import java.util.concurrent.atomic.AtomicBoolean;
3938
import java.util.logging.Level;
4039
import net.william278.annotaml.Annotaml;
4140
import org.bukkit.Bukkit;
@@ -191,8 +190,8 @@ private void registerListener() {
191190

192191
private void registerHooks() {
193192
final PluginManager plugins = Bukkit.getPluginManager();
194-
if (plugins.getPlugin("Vault") != null) {
195-
this.registerHook(new VaultEconomyHook(this));
193+
if (plugins.getPlugin("TheNewEconomy") != null) {
194+
this.registerHook(new TneEconomyHook(this));
196195
}
197196
if (plugins.getPlugin("PlaceholderAPI") != null) {
198197
new PlaceholderHook().register();

src/main/java/com/github/elic0de/thejpspit/cosmetics/CosmeticManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public class CosmeticManager {
2424
ClassToInstanceMap<TrailCosmetic> trailCosmetics;
2525
ClassToInstanceMap<AuraCosmetic> auraCosmetics;
2626

27-
2827
public ClassToInstanceMap<AbstractCosmetic> allCosmetics;
2928

3029
public CosmeticManager() {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.github.elic0de.thejpspit.hook;
2+
3+
import com.github.elic0de.thejpspit.TheJpsPit;
4+
import com.github.elic0de.thejpspit.player.PitPlayer;
5+
import java.math.BigDecimal;
6+
import java.util.logging.Level;
7+
import net.tnemc.core.TNE;
8+
import net.tnemc.core.common.api.TNEAPI;
9+
import org.jetbrains.annotations.NotNull;
10+
11+
public class TneEconomyHook extends EconomyHook {
12+
13+
protected TNEAPI tneAPI;
14+
15+
public TneEconomyHook(TheJpsPit plugin) {
16+
super(plugin, "TheNewEconomy");
17+
}
18+
19+
@Override
20+
public void onEnable() throws IllegalStateException {
21+
this.tneAPI = TNE.instance().api();
22+
plugin.getLogger().log(Level.INFO, "Enabled Vault economy hook");
23+
}
24+
25+
private BigDecimal getBalance(@NotNull PitPlayer player) {
26+
return tneAPI.getAccount(player.getUniqueId()).getHoldings(player.getPlayer().getWorld().getName());
27+
}
28+
29+
@Override
30+
public boolean hasMoney(PitPlayer player, BigDecimal amount) {
31+
return getBalance(player).compareTo(amount) >= 0;
32+
}
33+
34+
@Override
35+
public void takeMoney(PitPlayer player, BigDecimal amount) {
36+
tneAPI.getAccount(player.getUniqueId()).addHoldings(amount);
37+
}
38+
39+
@Override
40+
public void giveMoney(PitPlayer player, BigDecimal amount) {
41+
tneAPI.getAccount(player.getUniqueId()).removeHoldings(amount);
42+
}
43+
44+
@Override
45+
public String formatMoney(BigDecimal amount) {
46+
return "tneAPI.format(amount.doubleValue(), world);";
47+
}
48+
49+
}

src/main/java/com/github/elic0de/thejpspit/hook/VaultEconomyHook.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/main/resources/plugin.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ main: com.github.elic0de.thejpspit.TheJpsPit
44
api-version: 1.19
55
author: 'Elic0de#0342'
66
softdepend:
7-
- Vault
87
- TheNewEconomy
98
- PlaceholderAPI

0 commit comments

Comments
 (0)