-
Notifications
You must be signed in to change notification settings - Fork 66
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
30 changed files
with
489 additions
and
140 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
10 changes: 1 addition & 9 deletions
10
...ands/reusable/CreateTaggedSubCommand.java → ...mmands/common/CreateTaggedSubCommand.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
2 changes: 1 addition & 1 deletion
2
...ava/com/sekwah/advancedportals/core/commands/subcommands/desti/CreateDestiSubCommand.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
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
48 changes: 48 additions & 0 deletions
48
...ava/com/sekwah/advancedportals/core/commands/subcommands/desti/ReloadDestiSubCommand.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,48 @@ | ||
package com.sekwah.advancedportals.core.commands.subcommands.desti; | ||
|
||
import com.google.inject.Inject; | ||
import com.sekwah.advancedportals.core.AdvancedPortalsCore; | ||
import com.sekwah.advancedportals.core.commands.SubCommand; | ||
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer; | ||
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer; | ||
import com.sekwah.advancedportals.core.connector.containers.ServerContainer; | ||
import com.sekwah.advancedportals.core.services.DestinationServices; | ||
import com.sekwah.advancedportals.core.services.PortalTempDataServices; | ||
import com.sekwah.advancedportals.core.util.GameScheduler; | ||
import com.sekwah.advancedportals.core.util.Lang; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This will be different from the old show command and I believe it is 1.16+ till the latest version as of writing this. | ||
*/ | ||
public class ReloadDestiSubCommand implements SubCommand { | ||
|
||
@Inject | ||
DestinationServices destinationServices; | ||
|
||
@Override | ||
public void onCommand(CommandSenderContainer sender, String[] args) { | ||
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.destination.reload")); | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(CommandSenderContainer sender) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getBasicHelpText() { | ||
return Lang.translate("command.destination.reload.help"); | ||
} | ||
|
||
@Override | ||
public String getDetailedHelpText() { | ||
return Lang.translate("command.destination.reload.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
100 changes: 100 additions & 0 deletions
100
.../java/com/sekwah/advancedportals/core/commands/subcommands/desti/ShowDestiSubCommand.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,100 @@ | ||
package com.sekwah.advancedportals.core.commands.subcommands.desti; | ||
|
||
import com.google.inject.Inject; | ||
import com.sekwah.advancedportals.core.AdvancedPortalsCore; | ||
import com.sekwah.advancedportals.core.commands.SubCommand; | ||
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer; | ||
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer; | ||
import com.sekwah.advancedportals.core.connector.containers.ServerContainer; | ||
import com.sekwah.advancedportals.core.destination.Destination; | ||
import com.sekwah.advancedportals.core.repository.ConfigRepository; | ||
import com.sekwah.advancedportals.core.services.DestinationServices; | ||
import com.sekwah.advancedportals.core.services.PortalTempDataServices; | ||
import com.sekwah.advancedportals.core.tags.activation.NameTag; | ||
import com.sekwah.advancedportals.core.util.Debug; | ||
import com.sekwah.advancedportals.core.util.GameScheduler; | ||
import com.sekwah.advancedportals.core.util.Lang; | ||
|
||
import java.awt.*; | ||
import java.util.List; | ||
|
||
/** | ||
* This will be different from the old show command and I believe it is 1.16+ till the latest version as of writing this. | ||
*/ | ||
public class ShowDestiSubCommand implements SubCommand, SubCommand.SubCommandOnInit { | ||
|
||
@Inject | ||
PortalTempDataServices tempDataServices; | ||
|
||
@Inject | ||
GameScheduler gameScheduler; | ||
|
||
@Inject | ||
AdvancedPortalsCore core; | ||
|
||
@Inject | ||
DestinationServices destinationServices; | ||
|
||
@Inject | ||
ServerContainer serverContainer; | ||
|
||
@Inject | ||
ConfigRepository config; | ||
|
||
@Override | ||
public void onCommand(CommandSenderContainer sender, String[] args) { | ||
if(core.getMcVersion()[1] < 16) { | ||
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.portal.show.unsupported")); | ||
return; | ||
} | ||
|
||
var tempData = tempDataServices.getPlayerTempData(sender.getPlayerContainer()); | ||
if(tempData.isDestiVisible()) { | ||
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.destination.show.disabled")); | ||
} else { | ||
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.destination.show.enabled")); | ||
} | ||
tempData.setDestiVisible(!tempData.isDestiVisible()); | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(CommandSenderContainer sender) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getBasicHelpText() { | ||
return Lang.translate("command.destination.show.help"); | ||
} | ||
|
||
@Override | ||
public String getDetailedHelpText() { | ||
return Lang.translate("command.destination.show.detailedhelp"); | ||
} | ||
|
||
@Override | ||
public void registered() { | ||
gameScheduler.intervalTickEvent("show_portal", () -> { | ||
for(PlayerContainer player : serverContainer.getPlayers()) { | ||
var tempData = tempDataServices.getPlayerTempData(player); | ||
if(!tempData.isDestiVisible()) { | ||
return; | ||
} | ||
|
||
for (Destination destination : destinationServices.getDestinations()) { | ||
var pos = destination.getLoc(); | ||
if(pos.distanceTo(player.getLoc()) < config.getVisibleRange()) { | ||
Debug.addMarker(player, pos.toBlockPos(), destination.getArgValues("name")[0], new Color(100, 100, 100, 100), 1000); | ||
} | ||
} | ||
//Debug.addMarker(player, pos, "", new Color(255, 0, 0, 100), 1000 * 10); | ||
|
||
} | ||
}, 1, 20); | ||
} | ||
} |
5 changes: 1 addition & 4 deletions
5
...a/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.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
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.