-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,220 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.erigitic.commands; | ||
|
||
import com.erigitic.jobs.TEJobManager; | ||
import com.erigitic.main.TotalEconomy; | ||
import org.spongepowered.api.command.CommandException; | ||
import org.spongepowered.api.command.CommandResult; | ||
import org.spongepowered.api.command.CommandSource; | ||
import org.spongepowered.api.command.args.CommandContext; | ||
import org.spongepowered.api.command.spec.CommandExecutor; | ||
import org.spongepowered.api.text.Text; | ||
import org.spongepowered.api.text.format.TextColors; | ||
|
||
/** | ||
* Created by Life4YourGames on 16.01.17. | ||
*/ | ||
public class JobReloadCommand implements CommandExecutor { | ||
|
||
private TEJobManager teJobManager; | ||
|
||
public JobReloadCommand(TotalEconomy totalEconomy) { | ||
this.teJobManager = totalEconomy.getTEJobManager(); | ||
} | ||
|
||
@Override | ||
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { | ||
if (teJobManager.reloadJobsAndSets()) { | ||
src.sendMessage(Text.of(TextColors.GREEN, "[TE] Sets and jobs reloaded.")); | ||
} else { | ||
throw new CommandException(Text.of(TextColors.RED, "[TE] Failed to reload sets and/or jobs!")); | ||
} | ||
|
||
return CommandResult.success(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* This file is part of Total Economy, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) Eric Grandt <https://www.ericgrandt.com> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.erigitic.jobs; | ||
|
||
import ninja.leaping.configurate.ConfigurationNode; | ||
|
||
/** | ||
* @author MarkL4YG | ||
* | ||
* Requirement notation that is usable in various places such as higher job tiers | ||
*/ | ||
public class JobBasedRequirement { | ||
private int needsJobLevel; | ||
private String needsJob; | ||
private String needsPermission; | ||
|
||
private JobBasedRequirement(ConfigurationNode node) { | ||
this(node.getNode("job").getString(null), | ||
node.getNode("level").getInt(0), | ||
node.getNode("permission").getString(null)); | ||
} | ||
|
||
private JobBasedRequirement(String needsJob, int needJobLevel, String needsPermission) { | ||
this.needsJob = needsJob; | ||
this.needsJobLevel = needJobLevel; | ||
this.needsPermission = needsPermission; | ||
} | ||
|
||
public static JobBasedRequirement of(ConfigurationNode node) { | ||
return new JobBasedRequirement(node); | ||
} | ||
public static JobBasedRequirement of(String needsJob, int needsJobLevel, String needsPermission) { | ||
return new JobBasedRequirement(needsJob, needsJobLevel, needsPermission); | ||
} | ||
|
||
public int jobLevelNeeded() { | ||
return needsJobLevel; | ||
} | ||
|
||
//@Nullable | ||
public String jobNeeded() { | ||
return needsJob; | ||
} | ||
|
||
//@Nullable | ||
public String permissionNeeded() { | ||
return needsPermission; | ||
} | ||
|
||
public void addTo(ConfigurationNode node) { | ||
node = node.getNode("require"); | ||
node.getNode("job").setValue(needsJob); | ||
node.getNode("level").setValue(needsJobLevel); | ||
node.getNode("permission").setValue(needsPermission); | ||
} | ||
} |
Oops, something went wrong.