A Sponge plugin providing the Kotlin runtime, standard library, and reflection library to other plugins.
Licensed under the MIT License.
@Plugin(id = "messenger", name = "Messenger", version = "1.0", description = "Message and reply commands", authors = "pie_flavor") | |
public class MessengerPlugin { | |
private Map<UUID, UUID> lastMsg = new HashMap<>(); | |
@Listener | |
public void onInit(GameInitializationEvent e) { | |
CommandSpec msgCmd = CommandSpec.builder() | |
.description(Text.of("Messages a player.")) | |
.arguments(GenericArguments.onlyOne(GenericArguments.player("player")), GenericArguments.remainingJoinedStrings("message")) | |
.executor((src, args) -> { | |
if (!(src instanceof Player)) throw new CommandException(Text.of("Must be a player!")); |
package flavor.pie.testplugin; | |
import java.util.Optional; | |
import javax.annotation.Generated; | |
import org.spongepowered.api.Sponge; | |
import org.spongepowered.api.data.DataContainer; | |
import org.spongepowered.api.data.DataHolder; | |
import org.spongepowered.api.data.DataView; | |
import org.spongepowered.api.data.manipulator.DataManipulatorBuilder; | |
import org.spongepowered.api.data.manipulator.immutable.common.AbstractImmutableData; |
package flavor.pie.testplugin; | |
import org.spongepowered.api.Sponge; | |
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.CommandSpec; | |
import org.spongepowered.api.entity.living.player.Player; | |
import org.spongepowered.api.event.Listener; | |
import org.spongepowered.api.event.filter.cause.First; |
// Drag-and-drop one or several CSV files and/or folders onto this .js file; non-CSV files will be ignored | |
// If a folder is dropped, the script will automatically process all CSV files in the folder (but not subfolders) | |
// Each CSV file will be converted to an XLSX file, without any type conversion (all values treated as Text) | |
// If an XLSX file already exists with the same name as a CSV file, the CSV file will be skipped | |
// These default values are what you'll typically need for parsing Windows-based CSV files... | |
// (note: the CSV parser should handle multi-character delimiters just fine) | |
var CSV_ext = 'csv'; // CSV file extension (case-insensitive) | |
var CSV_ln = '\r\n'; // row delimiter (use '\n' for Unix-based files) | |
var CSV_delim = ','; // column delimiter (may need to be ';' in some locales) |
public class TextReplace { | |
public static Text replace(Text text, Pattern oldValue, Text newValue, boolean lossy) { | |
Text t = text.getChildren().isEmpty() ? text : text.toBuilder().removeAll().append(text.getChildren().stream() | |
.map(x -> replace(x, oldValue, newValue, lossy)).collect(Collectors.toList())).build(); | |
String plain = t.toPlainSingle(); | |
Matcher matcher = oldValue.matcher(plain); | |
if (!matcher.find()) { | |
if (lossy) { | |
plain = t.toPlain(); | |
matcher = oldValue.matcher(plain); |
@Plugin(id = "basic_plugin") | |
public class BasicPlugin { | |
@Inject @DefaultConfig(sharedRoot = true) | |
ConfigurationLoader<CommentedConfigurationNode> loader; | |
@Inject @DefaultConfig(sharedRoot = true) | |
Path path; | |
@Inject | |
Logger logger; | |
ConfigurationNode root; | |
public class TextUtils { | |
public static Text replaceText(Text original, String oldValue, Text newValue) { | |
Text text; | |
if (original.getChildren().isEmpty()) { | |
text = original; | |
} else { | |
text = original.toBuilder().removeAll() | |
.append(Lists.transform(original.getChildren(), t -> replaceText(t, oldValue, newValue))) | |
.build(); | |
} |
A Sponge plugin providing the Kotlin runtime, standard library, and reflection library to other plugins.
Licensed under the MIT License.
public class CopperRecipe implements SmeltingRecipe { | |
private ItemStackSnapshot exemplaryIngredient; | |
private ItemStackSnapshot exemplaryResult; | |
private Text ingredientName = Text.of(TextColors.WHITE, "Copper Ore"); | |
private Text resultName = Text.of(TextColors.WHITE, "Copper Nugget"); | |
{ | |
ItemStack ingredient = ItemStack.builder() | |
.itemType(ItemTypes.STONE) | |
.keyValue(Keys.STONE_TYPE, StoneTypes.GRANITE) | |
.keyValue(Keys.DISPLAY_NAME, ingredientName) |
hexchat.register("mch", "1.0.0", "General-purpose macros for #minecrafthelp.") | |
hexchat.hook_command(nil, function (words, word_eols) | |
if words[1]:sub(-1) == ":" then | |
local name = words[1]:sub(0, words[1]:len() - 1) | |
if words[2] == ".dxdiag" then | |
hexchat.command("say " .. name .. ": Do you have your DxDiag report? If so, please paste the link in chat.") | |
return hexchat.EAT_ALL | |
end | |
if words[2] == ".absol" then | |
hexchat.command("say " .. name .. ": Please read what Absol just said.") |