') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); jsmod2-java-c.github.io/index.md at master · jsmod2-java-c/jsmod2-java-c.github.io · GitHub
Skip to content

Latest commit

History

History
199 lines (124 loc) · 4.72 KB

File metadata and controls

199 lines (124 loc) · 4.72 KB
titleHome

JSMod2

LICENSE

Copyright: JSmod2 LICENSE

/*JSmod2 is a java-based SCP: Secret Laboratory server initiated by jsmod2.cn.It needs to rely on Smod2 and the ProxyHandler. JSmod2 is an open sourcefree software that is released under the GNU license. Please readthe GNU open source license before using the software. To understandthe appropriateness, if infringement, will be handled in accordancewith the law, @Copyright JSmod2 China,more can see <a href="http://jsmod2.cn">that<a> */

About Us

Hi there!

We are JSmod2 developing team. This project is pure, public....and in an sense, it's welfare. ;) Most of us are high school students, we don't have enough time to find and fix all of the bugs, please forget it and create an issue :P Feel free to point out any omissions, thank you! If you are willing to help this project, there are three ways that you can do:

  1. Send an email to: 843983728@qq.com (Advice, questions, anyway.)
  2. Create an issue!
  3. Join our Discord Server and......: Hey, tap here! :P

Thanks for your supporting!

What is JSmod2?

JSmod2 is a java extension server. It's based on Smod2 and ProxyHandler

The aim of JSmod2 is to make Java developers develop in Java easily.

Also, it provides APIs that most of them are the same as Smod2.

JSmod2 needs Smod2, and you need to install ProxyHandler correctly (Grab it into \sm_plugins). In the future, JSmod2 will support connecting multiple Smod2 servers.

How's the project now?

Currently JSmod2 is still developing, issues, prs, criticsim and suggestions are welcomed!

If you want to participate in the development of JSmod2, you can refer to JSmod2-design for further information.

How to get start it?

Before you do it, please note that:

  • We recommend you to set up on Windows 2008 - the latest / Ubuntu Server 18.04.2 LTS

  • If you want to install automatically, Python and Pip are required

Auto-install JSmod2:

If there's no problem, please enter the following text in the terminal:

cd /path/to/jsmod2 & python3 -m pip install requirement.txt

And launch:

cd /path/to/jsmod2 & python3 -m jsmod2manager.py

Manual install JSmod2:

After finished installing JRE, you need to put ProxyHandler.dll into (Where your server is)\sm_plugins, then start LocalAdmin.exe / MultiAdmin.exe. If there's no problem, then launch JSmod2.jar: java -jar jsmod2.jar

Import the DevelopmentKit

Connect Repository

<repositories>
<repository>
<id>nexus</id>
<name>Team Neux Repository</name><url>http://repo.noyark.net/nexus/content/groups/public/</url>
</repository>
</repositories>

Import Dependency

 <dependency>
<groupId>cn.jsmod2</groupId>
<artifactId>jsmod2-dk</artifactId>
<version>1.0.3</version>
</dependency>

How to develop a plugin?

  1. New API can register the Listeners and Commands of JSmod2's;
packagecom.magiclu.plugin;
importcn.jsmod2.core.annotations.EnableRegister;
importcn.jsmod2.core.annotations.Main;
importcn.jsmod2.core.plugin.PluginBase;
@Main(name="exmaple")
@EnableRegisterpublicclassMainextendsPluginBase{
publicvoidonLoad(){
}
publicvoidonEnable(){
}
publicvoidonDisable(){
}
}
  1. Create a Command:
packagecom.magiclu.plugin.command;
importcn.jsmod2.api.player.IPlayer;
importcn.jsmod2.core.CommandSender;
importcn.jsmod2.core.command.Command;
importcn.jsmod2.core.plugin.Plugin;
publicclassTestCommandextendsCommand{
publicTestCommand(Pluginplugin){
super("test","CONSOLE", "hello,jsmod2",plugin);
}
//override the methodpublicbooleanexecute(CommandSendercommandSender, String[] args){
//Processing when executing instructions
}
}
  1. Create a Listener:
packagecom.magiclu.plugin.listener;
importcn.jsmod2.api.event.player.IPlayerJoinEvent;
importcn.jsmod2.core.annotations.EventManager;
importcn.jsmod2.core.event.Listener;
publicclassTestListenerimplementsListener{
//EventManager has a listener priority, see the note@EventManagerpublicvoidjoinEvent(PlayerJoinEvente){
//Trigger corresponding event will run
}
}