Skip to content

Commit

Permalink
Version 1.5
Browse files Browse the repository at this point in the history
Added support for NyxEffect and NyxMarket
And some improvements
  • Loading branch information
poqdavid committed Jan 29, 2022
1 parent fae55d9 commit 7a1f4f6
Show file tree
Hide file tree
Showing 11 changed files with 542 additions and 96 deletions.
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ buildscript {
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
classpath "org.spongepowered:SpongeGradle:0.11.5"
classpath "gradle.plugin.net.minecrell:licenser:0.4.1"
classpath "net.kyori:blossom:1.+"
}
}

Expand All @@ -42,11 +43,22 @@ applyPlugin('com.github.johnrengelman.shadow')
applyPlugin('net.minecrell.licenser')
applyPlugin('org.spongepowered.mixin')
applyPlugin('org.spongepowered.gradle.plugin')
applyPlugin('net.kyori.blossom')

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

blossom {
replaceToken("@version@", "${getProjectProperty('m_major')}.${getProjectProperty('m_minor')}")
replaceToken("@description@", description)
replaceToken("@id@", m_id)
replaceToken("@name@", m_name)
replaceToken("@organization@", m_organization)
replaceToken("@authors@", m_authors)
replaceToken("@url@", m_url)
}

if (System.getenv().BUILD_NUMBER != null) {
version += "+${System.getenv().BUILD_NUMBER}"
}
Expand Down
11 changes: 4 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ m_description=Core plugin for all of my Nyx plugins.

## Version
m_major=1
m_minor=1
m_api=S7.3.0
m_minor=5
m_api=S7.4
m_suffix=STABLE

## Dependencies
spongeapi=7.3.0
##spongeforge=7.1.6
##spongeforgeServerFolder=run/spongeforge

spongeapi=7.4.+
minecraft_version=1.12.2
forge_rundir=run/forge
forgeVersion=1.12.2-14.23.5.2854
forgeVersion=1.12.2-14.23.5.2860
mappings_channel=snapshot
mappings_version=20180814-1.12
137 changes: 126 additions & 11 deletions src/main/java/io/github/poqdavid/nyx/nyxcore/NyxCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@

import com.google.inject.Inject;
import io.github.poqdavid.nyx.nyxcore.Permissions.BackpackPermission;
import io.github.poqdavid.nyx.nyxcore.Permissions.MarketPermission;
import io.github.poqdavid.nyx.nyxcore.Permissions.ToolsPermission;
import io.github.poqdavid.nyx.nyxcore.Utils.CText;
import io.github.poqdavid.nyx.nyxcore.Utils.NCLogger;
import io.github.poqdavid.nyx.nyxcore.Utils.Setting.NyxTools.Settings;
import io.github.poqdavid.nyx.nyxcore.Utils.Setting.NyxMarket.NMSettings;
import io.github.poqdavid.nyx.nyxcore.Utils.Setting.NyxTools.NTSettings;
import org.bstats.sponge.Metrics;
import org.slf4j.Logger;
import org.spongepowered.api.Game;
Expand All @@ -48,7 +50,7 @@
import java.nio.file.Paths;
import java.util.Optional;

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

public static NyxCore nyxcore;
Expand All @@ -58,33 +60,40 @@ public class NyxCore {
private final Path backpackDir;
private final Path toolsDir;
private final Path backpacksDir;
private final Path effectDir;
private final Path marketDir;
private final PluginContainer pluginContainer;
private final Metrics metrics;
public NCLogger logger;
public PermissionService permService;
public PermissionDescription.Builder permDescBuilder;
public Path recordsDir;
public Settings nytSettings;
public NTSettings nytSettings;
public NMSettings nmSettings;
@Inject
private Game game;
private CommandManager cmdManager;

@Inject
public NyxCore(Metrics.Factory metricsFactory, @ConfigDir(sharedRoot = true) Path path, Logger logger, PluginContainer container) {
nyxcore = this;
this.dataDir = Sponge.getGame().getSavesDirectory().resolve(PluginData.id);
this.pluginContainer = container;

this.dataDir = Sponge.getGame().getSavesDirectory().resolve(this.getPluginContainer().getId());

this.logger = new NCLogger();
this.nytSettings = new Settings();
this.configDirPath = path.resolve(PluginData.shortName);
this.nytSettings = new NTSettings();
this.nmSettings = new NMSettings();
this.configDirPath = path.resolve("Nyx");
this.configFullPath = Paths.get(this.getConfigPath().toString(), "config.json");
this.backpackDir = Paths.get(this.getConfigPath().toString(), "NyxBackpack");
this.toolsDir = Paths.get(this.getConfigPath().toString(), "NyxTools");
this.backpacksDir = Paths.get(this.backpackDir.toString(), "backpacks");

this.effectDir = Paths.get(this.getConfigPath().toString(), "NyxEffect");
this.marketDir = Paths.get(this.getConfigPath().toString(), "NyxMarket");

this.logger.info(" ");
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "NyxCore") + CText.get(CText.Colors.YELLOW, 0, " v" + PluginData.version));
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "@name@") + CText.get(CText.Colors.YELLOW, 0, " v" + this.getVersion()));
this.logger.info("Starting...");
this.logger.info(" ");

Expand Down Expand Up @@ -117,21 +126,40 @@ public Path getBackpacksPath() {
return this.backpacksDir;
}

@Nonnull
public Path getEffectPath() {
return this.effectDir;
}

@Nonnull
public Path getMarketPath() {
return this.marketDir;
}

@Nonnull
public PluginContainer getPluginContainer() {
return this.pluginContainer;
}

@Nonnull
public String getVersion() {
return PluginData.version;
if (this.getPluginContainer().getVersion().isPresent()) {
return this.getPluginContainer().getVersion().get();
} else {
return "@version@";
}
}

@Nonnull
public Settings getToolsSettings() {
public NTSettings getToolsSettings() {
return this.nytSettings;
}

@Nonnull
public NMSettings getMarketSettings() {
return this.nmSettings;
}

@Nonnull
public NCLogger getLogger(String name) {
if (name == null || name.isEmpty()) {
Expand All @@ -154,7 +182,7 @@ public void setGame(Game game) {
@Listener
public void onGamePreInit(@Nullable final GamePreInitializationEvent event) {
this.logger.info(" ");
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "NyxCore") + CText.get(CText.Colors.YELLOW, 0, " v" + PluginData.version));
this.logger.info(CText.get(CText.Colors.MAGENTA, 0, "@name@") + CText.get(CText.Colors.YELLOW, 0, " v" + this.getVersion()));
this.logger.info("Initializing...");
this.logger.info(" ");
nyxcore = this;
Expand Down Expand Up @@ -415,6 +443,93 @@ public void onGameInit(@Nullable final GameInitializationEvent event) {
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();

//Market
this.permDescBuilder
.id(MarketPermission.COMMAND_HELP)
.description(Text.of("Allows the use of help command"))
.assign(PermissionDescription.ROLE_USER, true)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_MAIN)
.description(Text.of("Allows the use of /sm, /NyxMarket"))
.assign(PermissionDescription.ROLE_USER, true)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_SELL)
.description(Text.of("Allows the use of /market sell"))
.assign(PermissionDescription.ROLE_USER, true)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_BUY)
.description(Text.of("Allows the use of /market buy"))
.assign(PermissionDescription.ROLE_USER, true)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_HISTORY)
.description(Text.of("Allows the use of /market history"))
.assign(PermissionDescription.ROLE_USER, false)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_MAIL)
.description(Text.of("Allows the use of /market mail"))
.assign(PermissionDescription.ROLE_USER, true)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_PRICECHECK)
.description(Text.of("Allows the use of /market price"))
.assign(PermissionDescription.ROLE_USER, true)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_PRICELIMIT)
.description(Text.of("Allows the use of /market pricelimit"))
.assign(PermissionDescription.ROLE_USER, false)
.assign(PermissionDescription.ROLE_STAFF, false)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_RELOAD)
.description(Text.of("Allows the use of /market reload"))
.assign(PermissionDescription.ROLE_USER, false)
.assign(PermissionDescription.ROLE_STAFF, false)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_SEND)
.description(Text.of("Allows the use of /market send"))
.assign(PermissionDescription.ROLE_USER, true)
.assign(PermissionDescription.ROLE_STAFF, true)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();

this.permDescBuilder
.id(MarketPermission.ADMIN_CANCEL)
.description(Text.of("Allows the the admin to cancel market items"))
.assign(PermissionDescription.ROLE_USER, false)
.assign(PermissionDescription.ROLE_STAFF, false)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
this.permDescBuilder
.id(MarketPermission.COMMAND_SETTING)
.description(Text.of("Allows the the admin to change settings"))
.assign(PermissionDescription.ROLE_USER, false)
.assign(PermissionDescription.ROLE_STAFF, false)
.assign(PermissionDescription.ROLE_ADMIN, true)
.register();
}

this.logger.info("Plugin Initialized successfully!");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* This file is part of NyxCore.
*
* NyxCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NyxCore 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NyxCore. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (c) POQDavid <https://github.com/poqdavid/NyxCore>
* Copyright (c) contributors
*/

package io.github.poqdavid.nyx.nyxcore.Permissions;

public class EffectPermission {
public static final String COMMAND_HELP = "NyxCore.Effect.Command.Help";
public static final String COMMAND_MAIN = "NyxCore.Effect.Command.Main";

public static final String COMMAND_CHECK = "NyxCore.Effect.Command.Check";
public static final String COMMAND_CHECKOTHERS = "NyxCore.Effect.Command.CheckOthers";

public static final String COMMAND_DISABLEOTHERS = "NyxCore.Effect.Command.DisableOthers";

public static final String COMMAND_EFFECT = "NyxCore.Effect.Command.Effect";
public static final String COMMAND_EFFECT_OTHER = "NyxCore.Effect.Command.EffectOther";

public static final String COMMAND_TASK = "NyxCore.Effect.Command.Task";
public static final String COMMAND_LIST = "NyxCore.Effect.Command.List";

public static final String COMMAND_TASK_OTHER = "NyxCore.Effect.Command.TaskOther";

public static final String EFFECTS = "NyxCore.Effect.Effects";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of NyxCore.
*
* NyxCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NyxCore 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NyxCore. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (c) POQDavid <https://github.com/poqdavid/NyxCore>
* Copyright (c) contributors
*/

package io.github.poqdavid.nyx.nyxcore.Permissions;

public class MarketPermission {
//Commands
public static final String COMMAND_HELP = "NyxCore.Market.Command.Help";
public static final String COMMAND_MAIN = "NyxCore.Market.Command.Main";
public static final String COMMAND_SELL = "NyxCore.Market.Command.Sell";
public static final String COMMAND_BUY = "NyxCore.Market.Command.Buy";
public static final String COMMAND_HISTORY = "NyxCore.Market.Command.History";
public static final String COMMAND_MAIL = "NyxCore.Market.Command.Mail";
public static final String COMMAND_PRICECHECK = "NyxCore.Market.Command.PriceCheck";
public static final String COMMAND_PRICELIMIT = "NyxCore.Market.Command.PriceLimit";
public static final String COMMAND_RELOAD = "NyxCore.Market.Command.Reload";
public static final String COMMAND_SEND = "NyxCore.Market.Command.Send";
public static final String COMMAND_SETTING = "NyxCore.Market.Command.Setting";
public static final String ADMIN_CANCEL = "NyxCore.Market.ADMIN_CANCEL";
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,4 @@ public class ToolsPermission {
public static final String COMMAND_ENCHANTINGTABLE_POWER_13 = "NyxCore.Tools.Command.EnchantingtablePower.13";
public static final String COMMAND_ENCHANTINGTABLE_POWER_14 = "NyxCore.Tools.Command.EnchantingtablePower.14";
public static final String COMMAND_ENCHANTINGTABLE_POWER_15 = "NyxCore.Tools.Command.EnchantingtablePower.15";

public static final String OLD_COMMAND_ANVIL = "VirtualTool.command.anvil";
public static final String OLD_COMMAND_HELP = "VirtualTool.command.help";
public static final String OLD_COMMAND_MAIN = "VirtualTool.command.main";
public static final String OLD_COMMAND_ENDERCHEST = "VirtualTool.command.enderchest";
public static final String OLD_COMMAND_ENCHANTINGTABLE = "VirtualTool.command.enchantingtable";
public static final String OLD_COMMAND_WORKBENCH = "VirtualTool.command.workbench";


//Enchantment powers
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_0 = "VirtualTool.command.enchantingtablepower.0";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_1 = "VirtualTool.command.enchantingtablepower.1";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_2 = "VirtualTool.command.enchantingtablepower.2";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_3 = "VirtualTool.command.enchantingtablepower.3";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_4 = "VirtualTool.command.enchantingtablepower.4";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_5 = "VirtualTool.command.enchantingtablepower.5";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_6 = "VirtualTool.command.enchantingtablepower.6";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_7 = "VirtualTool.command.enchantingtablepower.7";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_8 = "VirtualTool.command.enchantingtablepower.8";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_9 = "VirtualTool.command.enchantingtablepower.9";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_10 = "VirtualTool.command.enchantingtablepower.10";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_11 = "VirtualTool.command.enchantingtablepower.11";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_12 = "VirtualTool.command.enchantingtablepower.12";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_13 = "VirtualTool.command.enchantingtablepower.13";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_14 = "VirtualTool.command.enchantingtablepower.14";
public static final String OLD_COMMAND_ENCHANTINGTABLE_POWER_15 = "VirtualTool.command.enchantingtablepower.15";
}
Loading

0 comments on commit 7a1f4f6

Please sign in to comment.