Skip to content

Commit 7a1f4f6

Browse files
committed
Version 1.5
Added support for NyxEffect and NyxMarket And some improvements
1 parent fae55d9 commit 7a1f4f6

File tree

11 files changed

+542
-96
lines changed

11 files changed

+542
-96
lines changed

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ buildscript {
2727
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
2828
classpath "org.spongepowered:SpongeGradle:0.11.5"
2929
classpath "gradle.plugin.net.minecrell:licenser:0.4.1"
30+
classpath "net.kyori:blossom:1.+"
3031
}
3132
}
3233

@@ -42,11 +43,22 @@ applyPlugin('com.github.johnrengelman.shadow')
4243
applyPlugin('net.minecrell.licenser')
4344
applyPlugin('org.spongepowered.mixin')
4445
applyPlugin('org.spongepowered.gradle.plugin')
46+
applyPlugin('net.kyori.blossom')
4547

4648
group = "${getProjectProperty('m_group')}" as Object
4749
version = "${getProjectProperty('minecraft_version')}-${getProjectProperty('m_major')}.${getProjectProperty('m_minor')}-${getProjectProperty('m_api')}-${getProjectProperty('m_suffix')}" as Object
4850
description = "${getProjectProperty('m_description')}"
4951

52+
blossom {
53+
replaceToken("@version@", "${getProjectProperty('m_major')}.${getProjectProperty('m_minor')}")
54+
replaceToken("@description@", description)
55+
replaceToken("@id@", m_id)
56+
replaceToken("@name@", m_name)
57+
replaceToken("@organization@", m_organization)
58+
replaceToken("@authors@", m_authors)
59+
replaceToken("@url@", m_url)
60+
}
61+
5062
if (System.getenv().BUILD_NUMBER != null) {
5163
version += "+${System.getenv().BUILD_NUMBER}"
5264
}

gradle.properties

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ m_description=Core plugin for all of my Nyx plugins.
1818

1919
## Version
2020
m_major=1
21-
m_minor=1
22-
m_api=S7.3.0
21+
m_minor=5
22+
m_api=S7.4
2323
m_suffix=STABLE
2424

2525
## Dependencies
26-
spongeapi=7.3.0
27-
##spongeforge=7.1.6
28-
##spongeforgeServerFolder=run/spongeforge
29-
26+
spongeapi=7.4.+
3027
minecraft_version=1.12.2
3128
forge_rundir=run/forge
32-
forgeVersion=1.12.2-14.23.5.2854
29+
forgeVersion=1.12.2-14.23.5.2860
3330
mappings_channel=snapshot
3431
mappings_version=20180814-1.12

src/main/java/io/github/poqdavid/nyx/nyxcore/NyxCore.java

Lines changed: 126 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222

2323
import com.google.inject.Inject;
2424
import io.github.poqdavid.nyx.nyxcore.Permissions.BackpackPermission;
25+
import io.github.poqdavid.nyx.nyxcore.Permissions.MarketPermission;
2526
import io.github.poqdavid.nyx.nyxcore.Permissions.ToolsPermission;
2627
import io.github.poqdavid.nyx.nyxcore.Utils.CText;
2728
import io.github.poqdavid.nyx.nyxcore.Utils.NCLogger;
28-
import io.github.poqdavid.nyx.nyxcore.Utils.Setting.NyxTools.Settings;
29+
import io.github.poqdavid.nyx.nyxcore.Utils.Setting.NyxMarket.NMSettings;
30+
import io.github.poqdavid.nyx.nyxcore.Utils.Setting.NyxTools.NTSettings;
2931
import org.bstats.sponge.Metrics;
3032
import org.slf4j.Logger;
3133
import org.spongepowered.api.Game;
@@ -48,7 +50,7 @@
4850
import java.nio.file.Paths;
4951
import java.util.Optional;
5052

51-
@Plugin(id = PluginData.id, name = PluginData.name, version = PluginData.version, description = PluginData.description, url = PluginData.url, authors = {PluginData.author1})
53+
@Plugin(id = "nyxcore", name = "@name@", version = "@version@", description = "@description@", url = "https://github.com/poqdavid/NyxCore", authors = {"@authors@"})
5254
public class NyxCore {
5355

5456
public static NyxCore nyxcore;
@@ -58,33 +60,40 @@ public class NyxCore {
5860
private final Path backpackDir;
5961
private final Path toolsDir;
6062
private final Path backpacksDir;
63+
private final Path effectDir;
64+
private final Path marketDir;
6165
private final PluginContainer pluginContainer;
6266
private final Metrics metrics;
6367
public NCLogger logger;
6468
public PermissionService permService;
6569
public PermissionDescription.Builder permDescBuilder;
6670
public Path recordsDir;
67-
public Settings nytSettings;
71+
public NTSettings nytSettings;
72+
public NMSettings nmSettings;
6873
@Inject
6974
private Game game;
7075
private CommandManager cmdManager;
7176

7277
@Inject
7378
public NyxCore(Metrics.Factory metricsFactory, @ConfigDir(sharedRoot = true) Path path, Logger logger, PluginContainer container) {
7479
nyxcore = this;
75-
this.dataDir = Sponge.getGame().getSavesDirectory().resolve(PluginData.id);
7680
this.pluginContainer = container;
81+
82+
this.dataDir = Sponge.getGame().getSavesDirectory().resolve(this.getPluginContainer().getId());
83+
7784
this.logger = new NCLogger();
78-
this.nytSettings = new Settings();
79-
this.configDirPath = path.resolve(PluginData.shortName);
85+
this.nytSettings = new NTSettings();
86+
this.nmSettings = new NMSettings();
87+
this.configDirPath = path.resolve("Nyx");
8088
this.configFullPath = Paths.get(this.getConfigPath().toString(), "config.json");
8189
this.backpackDir = Paths.get(this.getConfigPath().toString(), "NyxBackpack");
8290
this.toolsDir = Paths.get(this.getConfigPath().toString(), "NyxTools");
8391
this.backpacksDir = Paths.get(this.backpackDir.toString(), "backpacks");
84-
92+
this.effectDir = Paths.get(this.getConfigPath().toString(), "NyxEffect");
93+
this.marketDir = Paths.get(this.getConfigPath().toString(), "NyxMarket");
8594

8695
this.logger.info(" ");
87-
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "NyxCore") + CText.get(CText.Colors.YELLOW, 0, " v" + PluginData.version));
96+
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "@name@") + CText.get(CText.Colors.YELLOW, 0, " v" + this.getVersion()));
8897
this.logger.info("Starting...");
8998
this.logger.info(" ");
9099

@@ -117,21 +126,40 @@ public Path getBackpacksPath() {
117126
return this.backpacksDir;
118127
}
119128

129+
@Nonnull
130+
public Path getEffectPath() {
131+
return this.effectDir;
132+
}
133+
134+
@Nonnull
135+
public Path getMarketPath() {
136+
return this.marketDir;
137+
}
138+
120139
@Nonnull
121140
public PluginContainer getPluginContainer() {
122141
return this.pluginContainer;
123142
}
124143

125144
@Nonnull
126145
public String getVersion() {
127-
return PluginData.version;
146+
if (this.getPluginContainer().getVersion().isPresent()) {
147+
return this.getPluginContainer().getVersion().get();
148+
} else {
149+
return "@version@";
150+
}
128151
}
129152

130153
@Nonnull
131-
public Settings getToolsSettings() {
154+
public NTSettings getToolsSettings() {
132155
return this.nytSettings;
133156
}
134157

158+
@Nonnull
159+
public NMSettings getMarketSettings() {
160+
return this.nmSettings;
161+
}
162+
135163
@Nonnull
136164
public NCLogger getLogger(String name) {
137165
if (name == null || name.isEmpty()) {
@@ -154,7 +182,7 @@ public void setGame(Game game) {
154182
@Listener
155183
public void onGamePreInit(@Nullable final GamePreInitializationEvent event) {
156184
this.logger.info(" ");
157-
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "NyxCore") + CText.get(CText.Colors.YELLOW, 0, " v" + PluginData.version));
185+
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "@name@") + CText.get(CText.Colors.YELLOW, 0, " v" + this.getVersion()));
158186
this.logger.info("Initializing...");
159187
this.logger.info(" ");
160188
nyxcore = this;
@@ -415,6 +443,93 @@ public void onGameInit(@Nullable final GameInitializationEvent event) {
415443
.assign(PermissionDescription.ROLE_STAFF, true)
416444
.assign(PermissionDescription.ROLE_ADMIN, true)
417445
.register();
446+
447+
//Market
448+
this.permDescBuilder
449+
.id(MarketPermission.COMMAND_HELP)
450+
.description(Text.of("Allows the use of help command"))
451+
.assign(PermissionDescription.ROLE_USER, true)
452+
.assign(PermissionDescription.ROLE_STAFF, true)
453+
.assign(PermissionDescription.ROLE_ADMIN, true)
454+
.register();
455+
this.permDescBuilder
456+
.id(MarketPermission.COMMAND_MAIN)
457+
.description(Text.of("Allows the use of /sm, /NyxMarket"))
458+
.assign(PermissionDescription.ROLE_USER, true)
459+
.assign(PermissionDescription.ROLE_STAFF, true)
460+
.assign(PermissionDescription.ROLE_ADMIN, true)
461+
.register();
462+
this.permDescBuilder
463+
.id(MarketPermission.COMMAND_SELL)
464+
.description(Text.of("Allows the use of /market sell"))
465+
.assign(PermissionDescription.ROLE_USER, true)
466+
.assign(PermissionDescription.ROLE_STAFF, true)
467+
.assign(PermissionDescription.ROLE_ADMIN, true)
468+
.register();
469+
this.permDescBuilder
470+
.id(MarketPermission.COMMAND_BUY)
471+
.description(Text.of("Allows the use of /market buy"))
472+
.assign(PermissionDescription.ROLE_USER, true)
473+
.assign(PermissionDescription.ROLE_STAFF, true)
474+
.assign(PermissionDescription.ROLE_ADMIN, true)
475+
.register();
476+
this.permDescBuilder
477+
.id(MarketPermission.COMMAND_HISTORY)
478+
.description(Text.of("Allows the use of /market history"))
479+
.assign(PermissionDescription.ROLE_USER, false)
480+
.assign(PermissionDescription.ROLE_STAFF, true)
481+
.assign(PermissionDescription.ROLE_ADMIN, true)
482+
.register();
483+
this.permDescBuilder
484+
.id(MarketPermission.COMMAND_MAIL)
485+
.description(Text.of("Allows the use of /market mail"))
486+
.assign(PermissionDescription.ROLE_USER, true)
487+
.assign(PermissionDescription.ROLE_STAFF, true)
488+
.assign(PermissionDescription.ROLE_ADMIN, true)
489+
.register();
490+
this.permDescBuilder
491+
.id(MarketPermission.COMMAND_PRICECHECK)
492+
.description(Text.of("Allows the use of /market price"))
493+
.assign(PermissionDescription.ROLE_USER, true)
494+
.assign(PermissionDescription.ROLE_STAFF, true)
495+
.assign(PermissionDescription.ROLE_ADMIN, true)
496+
.register();
497+
this.permDescBuilder
498+
.id(MarketPermission.COMMAND_PRICELIMIT)
499+
.description(Text.of("Allows the use of /market pricelimit"))
500+
.assign(PermissionDescription.ROLE_USER, false)
501+
.assign(PermissionDescription.ROLE_STAFF, false)
502+
.assign(PermissionDescription.ROLE_ADMIN, true)
503+
.register();
504+
this.permDescBuilder
505+
.id(MarketPermission.COMMAND_RELOAD)
506+
.description(Text.of("Allows the use of /market reload"))
507+
.assign(PermissionDescription.ROLE_USER, false)
508+
.assign(PermissionDescription.ROLE_STAFF, false)
509+
.assign(PermissionDescription.ROLE_ADMIN, true)
510+
.register();
511+
this.permDescBuilder
512+
.id(MarketPermission.COMMAND_SEND)
513+
.description(Text.of("Allows the use of /market send"))
514+
.assign(PermissionDescription.ROLE_USER, true)
515+
.assign(PermissionDescription.ROLE_STAFF, true)
516+
.assign(PermissionDescription.ROLE_ADMIN, true)
517+
.register();
518+
519+
this.permDescBuilder
520+
.id(MarketPermission.ADMIN_CANCEL)
521+
.description(Text.of("Allows the the admin to cancel market items"))
522+
.assign(PermissionDescription.ROLE_USER, false)
523+
.assign(PermissionDescription.ROLE_STAFF, false)
524+
.assign(PermissionDescription.ROLE_ADMIN, true)
525+
.register();
526+
this.permDescBuilder
527+
.id(MarketPermission.COMMAND_SETTING)
528+
.description(Text.of("Allows the the admin to change settings"))
529+
.assign(PermissionDescription.ROLE_USER, false)
530+
.assign(PermissionDescription.ROLE_STAFF, false)
531+
.assign(PermissionDescription.ROLE_ADMIN, true)
532+
.register();
418533
}
419534

420535
this.logger.info("Plugin Initialized successfully!");
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* This file is part of NyxCore.
3+
*
4+
* NyxCore is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* NyxCore is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with NyxCore. If not, see <https://www.gnu.org/licenses/>.
16+
*
17+
* Copyright (c) POQDavid <https://github.com/poqdavid/NyxCore>
18+
* Copyright (c) contributors
19+
*/
20+
21+
package io.github.poqdavid.nyx.nyxcore.Permissions;
22+
23+
public class EffectPermission {
24+
public static final String COMMAND_HELP = "NyxCore.Effect.Command.Help";
25+
public static final String COMMAND_MAIN = "NyxCore.Effect.Command.Main";
26+
27+
public static final String COMMAND_CHECK = "NyxCore.Effect.Command.Check";
28+
public static final String COMMAND_CHECKOTHERS = "NyxCore.Effect.Command.CheckOthers";
29+
30+
public static final String COMMAND_DISABLEOTHERS = "NyxCore.Effect.Command.DisableOthers";
31+
32+
public static final String COMMAND_EFFECT = "NyxCore.Effect.Command.Effect";
33+
public static final String COMMAND_EFFECT_OTHER = "NyxCore.Effect.Command.EffectOther";
34+
35+
public static final String COMMAND_TASK = "NyxCore.Effect.Command.Task";
36+
public static final String COMMAND_LIST = "NyxCore.Effect.Command.List";
37+
38+
public static final String COMMAND_TASK_OTHER = "NyxCore.Effect.Command.TaskOther";
39+
40+
public static final String EFFECTS = "NyxCore.Effect.Effects";
41+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file is part of NyxCore.
3+
*
4+
* NyxCore is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* NyxCore is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with NyxCore. If not, see <https://www.gnu.org/licenses/>.
16+
*
17+
* Copyright (c) POQDavid <https://github.com/poqdavid/NyxCore>
18+
* Copyright (c) contributors
19+
*/
20+
21+
package io.github.poqdavid.nyx.nyxcore.Permissions;
22+
23+
public class MarketPermission {
24+
//Commands
25+
public static final String COMMAND_HELP = "NyxCore.Market.Command.Help";
26+
public static final String COMMAND_MAIN = "NyxCore.Market.Command.Main";
27+
public static final String COMMAND_SELL = "NyxCore.Market.Command.Sell";
28+
public static final String COMMAND_BUY = "NyxCore.Market.Command.Buy";
29+
public static final String COMMAND_HISTORY = "NyxCore.Market.Command.History";
30+
public static final String COMMAND_MAIL = "NyxCore.Market.Command.Mail";
31+
public static final String COMMAND_PRICECHECK = "NyxCore.Market.Command.PriceCheck";
32+
public static final String COMMAND_PRICELIMIT = "NyxCore.Market.Command.PriceLimit";
33+
public static final String COMMAND_RELOAD = "NyxCore.Market.Command.Reload";
34+
public static final String COMMAND_SEND = "NyxCore.Market.Command.Send";
35+
public static final String COMMAND_SETTING = "NyxCore.Market.Command.Setting";
36+
public static final String ADMIN_CANCEL = "NyxCore.Market.ADMIN_CANCEL";
37+
}

src/main/java/io/github/poqdavid/nyx/nyxcore/Permissions/ToolsPermission.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,4 @@ public class ToolsPermission {
4848
public static final String COMMAND_ENCHANTINGTABLE_POWER_13 = "NyxCore.Tools.Command.EnchantingtablePower.13";
4949
public static final String COMMAND_ENCHANTINGTABLE_POWER_14 = "NyxCore.Tools.Command.EnchantingtablePower.14";
5050
public static final String COMMAND_ENCHANTINGTABLE_POWER_15 = "NyxCore.Tools.Command.EnchantingtablePower.15";
51-
52-
public static final String OLD_COMMAND_ANVIL = "VirtualTool.command.anvil";
53-
public static final String OLD_COMMAND_HELP = "VirtualTool.command.help";
54-
public static final String OLD_COMMAND_MAIN = "VirtualTool.command.main";
55-
public static final String OLD_COMMAND_ENDERCHEST = "VirtualTool.command.enderchest";
56-
public static final String OLD_COMMAND_ENCHANTINGTABLE = "VirtualTool.command.enchantingtable";
57-
public static final String OLD_COMMAND_WORKBENCH = "VirtualTool.command.workbench";
58-
59-
60-
//Enchantment powers
61-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_0 = "VirtualTool.command.enchantingtablepower.0";
62-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_1 = "VirtualTool.command.enchantingtablepower.1";
63-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_2 = "VirtualTool.command.enchantingtablepower.2";
64-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_3 = "VirtualTool.command.enchantingtablepower.3";
65-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_4 = "VirtualTool.command.enchantingtablepower.4";
66-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_5 = "VirtualTool.command.enchantingtablepower.5";
67-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_6 = "VirtualTool.command.enchantingtablepower.6";
68-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_7 = "VirtualTool.command.enchantingtablepower.7";
69-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_8 = "VirtualTool.command.enchantingtablepower.8";
70-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_9 = "VirtualTool.command.enchantingtablepower.9";
71-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_10 = "VirtualTool.command.enchantingtablepower.10";
72-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_11 = "VirtualTool.command.enchantingtablepower.11";
73-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_12 = "VirtualTool.command.enchantingtablepower.12";
74-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_13 = "VirtualTool.command.enchantingtablepower.13";
75-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_14 = "VirtualTool.command.enchantingtablepower.14";
76-
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_15 = "VirtualTool.command.enchantingtablepower.15";
7751
}

0 commit comments

Comments
 (0)