-
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 disable beacon sub command
- Loading branch information
Showing
13 changed files
with
171 additions
and
9 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
55 changes: 55 additions & 0 deletions
55
.../com/sekwah/advancedportals/core/commands/subcommands/portal/DisableBeaconSubCommand.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,55 @@ | ||
package com.sekwah.advancedportals.core.commands.subcommands.portal; | ||
|
||
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.services.PortalServices; | ||
import com.sekwah.advancedportals.core.util.Lang; | ||
import com.sekwah.advancedportals.core.util.TagReader; | ||
|
||
import java.util.List; | ||
|
||
public class DisableBeaconSubCommand implements SubCommand { | ||
@Inject | ||
PortalServices portalServices; | ||
|
||
@Override | ||
public void onCommand(CommandSenderContainer sender, String[] args) { | ||
if (args.length > 1) { | ||
var portalName = args[1]; | ||
var portal = portalServices.getPortal(portalName); | ||
if(portal == null) { | ||
sender.sendMessage(Lang.getNegativePrefix() | ||
+ Lang.translateInsertVariables("command.portal.disablebeacon.notfound", portalName)); | ||
return; | ||
} | ||
sender.sendMessage(Lang.getPositivePrefix() | ||
+ Lang.translateInsertVariables("command.portal.disablebeacon.complete", portalName)); | ||
sender.getPlayerContainer().getWorld().disableBeacon(portal); | ||
} else { | ||
sender.sendMessage(Lang.getNegativePrefix() | ||
+ Lang.translate("command.portal.disablebeacon.noname")); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(CommandSenderContainer sender) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSenderContainer sender, | ||
String[] args) { | ||
return portalServices.getPortalNames(); | ||
} | ||
|
||
@Override | ||
public String getBasicHelpText() { | ||
return Lang.translate("command.portal.disablebeacon.help"); | ||
} | ||
|
||
@Override | ||
public String getDetailedHelpText() { | ||
return Lang.translate("command.portal.disablebeacon.help"); | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
core/src/main/java/com/sekwah/advancedportals/core/connector/containers/WorldContainer.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 |
---|---|---|
@@ -1,14 +1,19 @@ | ||
package com.sekwah.advancedportals.core.connector.containers; | ||
|
||
import com.sekwah.advancedportals.core.data.BlockAxis; | ||
import com.sekwah.advancedportals.core.portal.AdvancedPortal; | ||
import com.sekwah.advancedportals.core.serializeddata.BlockLocation; | ||
|
||
public interface WorldContainer { | ||
void setBlock(BlockLocation location, String material); | ||
|
||
String getBlock(BlockLocation location); | ||
|
||
void disableBeacon(BlockLocation location); | ||
|
||
BlockAxis getBlockAxis(BlockLocation location); | ||
|
||
void setBlockAxis(BlockLocation location, BlockAxis axis); | ||
|
||
void disableBeacon(AdvancedPortal portal); | ||
} |
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