-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add basic desti create and remove
- Loading branch information
Showing
23 changed files
with
260 additions
and
100 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
63 changes: 63 additions & 0 deletions
63
...ava/com/sekwah/advancedportals/core/commands/subcommands/desti/RemoveDestiSubCommand.java
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,63 @@ | ||
package com.sekwah.advancedportals.core.commands.subcommands.desti; | ||
|
||
import com.google.inject.Inject; | ||
import com.sekwah.advancedportals.core.commands.SubCommand; | ||
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer; | ||
import com.sekwah.advancedportals.core.destination.Destination; | ||
import com.sekwah.advancedportals.core.permissions.PortalPermissions; | ||
import com.sekwah.advancedportals.core.portal.AdvancedPortal; | ||
import com.sekwah.advancedportals.core.services.DestinationServices; | ||
import com.sekwah.advancedportals.core.util.Lang; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class RemoveDestiSubCommand implements SubCommand { | ||
|
||
|
||
@Inject | ||
DestinationServices destinationServices; | ||
|
||
@Override | ||
public void onCommand(CommandSenderContainer sender, String[] args) { | ||
if(args.length > 1) { | ||
if(destinationServices.removeDesti(args[1], sender.getPlayerContainer())) { | ||
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.portal.remove.complete")); | ||
} | ||
else { | ||
sender.sendMessage(Lang.translate("messageprefix.negative") | ||
+ Lang.translate("command.destination.remove.error")); | ||
} | ||
} | ||
else { | ||
sender.sendMessage(Lang.translate("command.portal.remove.noname")); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(CommandSenderContainer sender) { | ||
return sender.isOp() || PortalPermissions.CREATE_PORTAL.hasPermission(sender); | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) { | ||
if(args.length > 2) { | ||
return Collections.emptyList(); | ||
} | ||
List<String> destiNames = destinationServices.getDestinations(); | ||
Collections.sort(destiNames); | ||
return destiNames; | ||
} | ||
|
||
@Override | ||
public String getBasicHelpText() { | ||
return Lang.translate("command.create.help"); | ||
} | ||
|
||
@Override | ||
public String getDetailedHelpText() { | ||
return Lang.translate("command.create.detailedhelp"); | ||
} | ||
} |
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
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
Oops, something went wrong.