-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add BungeeCord support * dots * Add missing `bungee.yml`, change author and bump to 1.2 * Improve readme * SpaceIsCommand interface * chamgves * Update license * 2023 * empty line * empty line * s * variable * lol * add missing final
- Loading branch information
Showing
24 changed files
with
671 additions
and
71 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
35 changes: 35 additions & 0 deletions
35
bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.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,35 @@ | ||
/* | ||
* Copyright (C) 2023 SpaceIs-plugin Contributors | ||
* https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pl.spaceis.plugin.bukkit; | ||
|
||
import org.bukkit.ChatColor; | ||
import pl.spaceis.plugin.config.Messages; | ||
|
||
public class BukkitMessages extends Messages<String> { | ||
|
||
@Override | ||
protected String color(final String message) { | ||
return ChatColor.translateAlternateColorCodes('&', message); | ||
} | ||
|
||
@Override | ||
public String appendMessage(final String message, final String append) { | ||
return message + append; | ||
} | ||
|
||
} |
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
31 changes: 0 additions & 31 deletions
31
bukkit/src/main/java/pl/spaceis/plugin/bukkit/Messages.java
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
dependencies { | ||
implementation project(':common') | ||
compileOnly 'net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT' | ||
} |
45 changes: 45 additions & 0 deletions
45
bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.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,45 @@ | ||
/* | ||
* Copyright (C) 2023 SpaceIs-plugin Contributors | ||
* https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pl.spaceis.plugin.bungee; | ||
|
||
import net.md_5.bungee.api.ProxyServer; | ||
import okhttp3.OkHttpClient; | ||
import pl.spaceis.plugin.command.CommandsTask; | ||
import pl.spaceis.plugin.config.Config; | ||
import pl.spaceis.plugin.logger.SpaceIsLogger; | ||
|
||
public class BungeeCommandsTask extends CommandsTask { | ||
|
||
private final ProxyServer proxy; | ||
|
||
public BungeeCommandsTask(final OkHttpClient httpClient, final Config config, final SpaceIsLogger logger) { | ||
super(httpClient, config, logger); | ||
this.proxy = ProxyServer.getInstance(); | ||
} | ||
|
||
@Override | ||
public boolean isPlayerOnline(final String playerName) { | ||
return this.proxy.getPlayer(playerName) != null; | ||
} | ||
|
||
@Override | ||
public void executeCommand(final String command) { | ||
this.proxy.getPluginManager().dispatchCommand(this.proxy.getConsole(), command); | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.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,52 @@ | ||
/* | ||
* Copyright (C) 2023 SpaceIs-plugin Contributors | ||
* https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pl.spaceis.plugin.bungee; | ||
|
||
import net.md_5.bungee.config.Configuration; | ||
import pl.spaceis.plugin.config.ConfigLoader; | ||
import pl.spaceis.plugin.resource.ResourceLoader; | ||
import pl.spaceis.plugin.resource.ResourceLoaderException; | ||
|
||
public class BungeeConfigLoader implements ConfigLoader { | ||
|
||
private final ResourceLoader<Configuration> resourceLoader; | ||
private final String configFileName; | ||
private Configuration configFile; | ||
|
||
public BungeeConfigLoader(final ResourceLoader<Configuration> resourceLoader, final String configFileName) { | ||
this.resourceLoader = resourceLoader; | ||
this.configFileName = configFileName; | ||
} | ||
|
||
@Override | ||
public void reloadConfig() throws ResourceLoaderException { | ||
this.resourceLoader.saveDefault(this.configFileName); | ||
this.configFile = this.resourceLoader.load(this.configFileName); | ||
} | ||
|
||
@Override | ||
public boolean getBoolean(final String key) { | ||
return this.configFile.getBoolean(key); | ||
} | ||
|
||
@Override | ||
public String getString(final String key) { | ||
return this.configFile.getString(key); | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.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,40 @@ | ||
/* | ||
* Copyright (C) 2023 SpaceIs-plugin Contributors | ||
* https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pl.spaceis.plugin.bungee; | ||
|
||
import net.md_5.bungee.api.ChatColor; | ||
import net.md_5.bungee.api.chat.BaseComponent; | ||
import net.md_5.bungee.api.chat.TextComponent; | ||
import pl.spaceis.plugin.config.Messages; | ||
|
||
public class BungeeMessages extends Messages<BaseComponent> { | ||
|
||
@Override | ||
protected BaseComponent color(final String message) { | ||
String coloredMessage = ChatColor.translateAlternateColorCodes('&', message); | ||
return new TextComponent(TextComponent.fromLegacyText(coloredMessage)); | ||
} | ||
|
||
@Override | ||
public BaseComponent appendMessage(final BaseComponent message, final String append) { | ||
BaseComponent finalMessage = message.duplicate(); | ||
finalMessage.addExtra(append); | ||
return finalMessage; | ||
} | ||
|
||
} |
Oops, something went wrong.